Commit Graph

38 Commits

Author SHA1 Message Date
Brodie Rao
0f9d940cb9 cleanup: remove unused variables 2010-08-27 13:32:40 -04:00
Patrick Mezard
842d65c40f acl: grp module is not available on windows 2010-05-10 21:09:48 +02:00
Patrick Mezard
b7c02777e0 util: fix default termwidth() under Windows
sys.stdout.write('-'*80 + '\n')

or

  sys.stdout.write('-'*80 + '\r')

do not work on Windows as they do on unix. On a 80 columns Windows console, the
extra CR or LF are interpreted as if belonging to the next line, so the first
command displays 2 lines (only one on unix) and the second one leave the line
visible and move back to the following line. To avoid this, we sacrifice one
column under Windows.
2010-04-26 22:30:40 +02:00
Benoit Boissinot
328394047f fix coding style (reported by pylint) 2010-02-08 15:36:34 +01:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Patrick Mezard
48eee05938 Find right hg command for detached process
On Windows, Mercurial can be run from the python script of from a frozen
executable. In the first case, we have to call the python interpreter since the
script is not executable. Frozen executable can be called directly.

Fix 3/3 for issue421
2010-01-06 21:11:58 +01:00
Matt Mackall
b6547e5312 Merge with stable 2009-10-11 13:54:19 -05:00
Patrick Mezard
6815e3dc8d windows: fix unlink() not dropping empty tree (issue1861) 2009-10-08 23:32:36 +02:00
Adrian Buehlmann
db3cee7306 util: move rename into posix.py and windows.py 2009-10-07 20:32:07 +02:00
Steve Borho
9a9a300480 Merge with crew-stable 2009-09-15 11:18:12 -05:00
Steve Borho
68d79882b6 windows: provide filename in IOError exceptions
This brings the Windows posixfile errors in line with the errors
on other platforms.
2009-09-14 19:53:43 -05:00
James Abbatiello
493895e163 Fix test-demandimport and test-trusted under Windows
The Windows-only wrapper around stdout is causing both of these tests to fail.
test-demandimport fails because it tries to print repr(sys.stdout).  Use
stderr instead since that is not wrapped.

test-trusted fails because the wrapper doesn't handle softspace and an
unexpected extra space gets printed.
2009-07-14 22:38:12 -04:00
Shun-ichi GOTO
e9a5aa00b3 Use os.path.split() for MBCS with win32mbcs extension. 2009-07-09 21:39:19 +09:00
Dan Villiom Podlaski Christiansen
5cd95d0ef8 util: add realpath() for getting the 'true' path.
The function is implemented for Mac OS X using the F_GETPATH fcntl,
and a basic implementation for Windows is provided as well. On other
POSIX systems, vanilla os.path.realpath() is used.
2009-07-26 17:25:08 +02:00
Henrik Stuart
97f9be9c1f windows: fix use of undefined exception (issue1707)
This fixes the implied reliance on pywin32 and the win32 module. This
also fixes a regression in fe7c89838a64 that made Mercurial unusable
without pywin32.
2009-06-25 22:43:58 +02:00
Dirkjan Ochtman
115b52ec56 windows: import WinIOError from win32 module (issue1707)
Quick fix pending further refactoring of windows error handling.
2009-06-24 12:03:53 +02:00
Benoit Boissinot
125a85ec87 use new style classes 2009-06-10 15:10:21 +02:00
timeless
fb33de67af Generally replace "file name" with "filename" in help and comments. 2009-06-09 09:25:17 -04:00
Martin Geisler
cac71647b1 posix: do not use fstat in isowner
The fstat function was undefined, but never used since a stat object
was always passed in the optional st argument. Passing st is now
mandatory.

This bug crept in when util was split up into posix and windows
modules. The fstat function is still defined in util, but importing it
into posix would create an import cycle which seems unnecessary.
2009-05-30 23:42:35 +02:00
Matt Mackall
a30eb02911 cmdutils: Take over glob expansion duties from util 2009-05-24 16:38:29 -05:00
Henrik Stuart
fa95cc9642 windows: make openhardlinks work
Despite the intention, openhardlinks would always evaluate to False.
2009-05-23 19:57:25 +02:00
Patrick Mezard
e8790c2140 serve: add and use portable spawnvp replacement
There is no standard python command to really detach a process under Windows.
Instead we use the low level API wrapped by subprocess module with all
necessary options to avoid any kind of context inheritance. Unfortunately, this
version still opens a new window for the child process.

The following have been tried:
- os.spawnv(os.P_NOWAIT): works but the child process is killed when parent
  console terminates.
- os.spawnv(os.P_DETACH): works on python25, hang on python26 when writing to
  the hgweb output socket.
- subprocess.CreateProcess() hack without shell mode: similar to
  os.spawnv(os.P_DETACH).

Fix 1/3 for issue421
2009-04-10 21:20:25 +02:00
Steve Borho
16fe149299 windows: expand environment vars in find_exe
This allows us to use ${ProgramFiles} in our [merge-tools] sections so
we can provide locale safe program paths.
2009-12-29 23:59:41 -06:00
Sune Foldager
adc90b2605 posixfile: remove posixfile_nt and fix import bug in windows.py
The posixfile_nt class has been superseded by posixfile in osutils.c,
which works on Windows NT and above. All other systems get the regular
python file class which is assigned to posixfile in posix.py (for POSIX)
and in the pure python version of osutils.py (for Win 9x or Windows NT
in pure mode).
2009-05-13 21:36:16 +02:00
Henrik Stuart
f69c330ac1 windows: avoid deleting non-empty reparse points
If a hg repository including working directory is a reparse point (directory
symlinked or a junction point), then using os.removedirs will remove the
reparse point erroneously. This is fixed by only removing directories if they
are empty.
2009-05-12 15:50:44 +02:00
Bryan O'Sullivan
3054118009 Windows: improve performance via buffered I/O
The posixfile_nt code hits the win32 file API directly, which
essentially amounts to performing a system call for every read and
write. This is slow.

We add a C extension that lets us use a Python file object instead,
but preserve our desired POSIX-like semantics (the ability to rename
or delete a file that is being accessed).

If the C extension is not available (e.g. in a VPS environment
without a compiler), we fall back to the posixfile_nt code.
2009-05-08 15:52:26 -07:00
Simon Heimberg
09ac1e6c92 separate import lines from mercurial and general python modules 2009-04-28 17:40:46 +02:00
Martin Geisler
8e4bc1e9ad put license and copyright info into comment blocks 2009-04-26 01:13:08 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Matt Mackall
d60aaf81dc windows: get Abort from error 2009-04-03 14:52:03 -05:00
Martin Geisler
df38a73894 windows: break import cycle with util 2009-04-02 18:04:42 +02:00
Sune Foldager
a909400362 windows: fix missing import of util.Abort 2009-04-02 17:09:17 +02:00
Sune Foldager
9aaf69227a windows: fix import of win32.py (was util_win32.py) 2009-04-02 16:49:34 +02:00
Steve Borho
582e7e6612 windows: add various missing import 2009-03-26 23:02:21 -05:00
Steve Borho
67420334f3 windows: hoist expand_glob() back into util.py
The windows version of expand_glob() requires patkind(). To
avoid a circular dependency, move function back into util.py.
2009-03-26 22:07:01 -05:00
Matt Mackall
0952760f82 util: split out posix, windows, and win32 modules 2009-03-26 13:54:44 -05:00