Commit Graph

197 Commits

Author SHA1 Message Date
Brendan Cully
4f1b3a83bb Move patch-related code into its own module. 2006-08-11 15:50:16 -07:00
Brendan Cully
7601c19932 Teach import to understand git diff extensions.
Vanilla patch chokes on git patches that include files that are copied
or renamed, then modified. So this code detects that case and rewrites
the patch if necessary.
2006-08-11 15:50:07 -07:00
Benoit Boissinot
dc4c4a5959 util.patch: use shellquote 2006-08-06 16:42:36 +02:00
Brendan Cully
5d7f00c97d Add portable shell-quoting function; teach mq to use it. 2006-08-05 15:23:26 -07:00
Vadim Gelfer
74f5dcdc3d import: make patch apply if run in subdir
fix is same as for mq patch. patch apply code should be merged.
2006-08-01 15:51:13 -07:00
Vadim Gelfer
b7a96d1742 clean up hg.py: move repo constructor code into each repo module 2006-07-31 07:11:12 -07:00
Vadim Gelfer
4f0a39d96b util.getuser: better comments 2006-07-24 09:22:47 -07:00
Vadim Gelfer
b5dfaa64f0 util.getuser: raise exception if win32api not available. 2006-07-24 09:19:25 -07:00
Vadim Gelfer
07de9b45fd fix windows username problem. 2006-07-24 09:11:26 -07:00
Vadim Gelfer
9ea4436262 add support for streaming clone.
existing clone code uses pull to get changes from remote repo.  is very
slow, uses lots of memory and cpu.

new clone code has server write file data straight to client, client
writes file data straight to disk.  memory and cpu used are very low,
clone is much faster over lan.

new client can still clone with pull, can still clone from older servers.
new server can still serve older clients.
2006-07-14 11:17:22 -07:00
Chris Mason
e09c656d7d util.parsedate should understand dates from hg export 2006-07-13 09:40:01 -07:00
Vadim Gelfer
a7c3b963b0 move most of tag code to localrepository class. 2006-07-12 08:59:20 -07:00
Benoit Boissinot
7dd019b60b use __contains__, index or split instead of str.find
str.find return -1 when the substring is not found, -1 evaluate
to True and is a valid index, which can lead to bugs.
Using alternatives when possible makes the code clearer and less
prone to bugs. (and __contains__ is faster in microbenchmarks)
2006-07-09 01:30:30 +02:00
Benoit Boissinot
fbf78b7285 str.rsplit does not exist in python 2.3 2006-06-30 23:02:08 +02:00
Benoit Boissinot
eb4253c05c validate the resulting date in parsedate 2006-06-30 18:48:06 +02:00
Jose M. Prieto
9f3a9a5e6e Allow the use of human readable dates (issue 251) 2006-06-30 18:47:35 +02:00
Vadim Gelfer
29a0efc318 fix -I/-X when relative paths used or in subdir 2006-06-21 17:30:31 -07:00
Vadim Gelfer
cbbcaa74fe merge with crew. 2006-06-20 23:58:45 -07:00
Vadim Gelfer
9a0c813fdc use demandload more. 2006-06-20 23:58:21 -07:00
Vadim Gelfer
b1e704337e util: add limit to amount filechunkiter will read 2006-06-20 15:13:17 -07:00
Vadim Gelfer
6144b74dd7 replace os.stat with os.lstat in some where. 2006-06-16 12:58:24 -07:00
Volker Kleinfeld
138d9f83fc Remove quotes from patch command.
When the gpatch fix for solaris was introduced in b67447b909f3 the
patch command was "". For some strange reason windows 2000 is
not happy with those quotes when given in os.popen.
2006-05-18 22:35:41 -07:00
Thomas Arendsen Hein
cfcf8066dd Use platform path for renaming file in util.atomictempfile.rename() 2006-05-18 21:01:38 +02:00
Volker Kleinfeld
94db8d7fec On win98 os.path.expanuser('~') does not result in a useable directory.
The MSDN recommendation for user specific directories is the use of
shell.ShGetSpecialFolder, so use it.

For details see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shgetspecialfolderpath.asp
2006-05-14 23:44:50 -07:00
Thomas Arendsen Hein
d8dda7e592 On Windows look for mercurial.ini in $USERPROFILE, too, if available
as os.path.expanduser('~') does not always yield a useful directory.

Based on a patch from Edouard Gomez <ed.gomez@free.fr>
2006-05-14 18:24:32 +02:00
Manpreet Singh
cc6f64ec98 Make hg status work for repositories in root directory on windows (issue 228) 2006-05-13 23:00:05 -07:00
Manpreet Singh
05f4a37fe7 Make it possible to use the root directory as the root of a repository. 2006-05-11 21:55:15 -07:00
Vadim Gelfer
5a3e6d2974 make reason for sys.argv change obvious in code. 2006-05-11 09:01:32 -07:00
Vadim Gelfer
edc07498a2 merge with crew. 2006-05-11 08:48:52 -07:00
Shun-ichi GOTO
876fe3cdc4 Check existance of sys.argv for the use from mod_python. 2006-05-11 08:48:36 -07:00
Vadim Gelfer
20d2979fe8 windows: revlog.lazyparser not always safe to use.
can not use on windows < nt or if win32 api not available.
2006-05-10 11:10:18 -07:00
Vadim Gelfer
4b2d02c52a reduce memory used by util.opener when making a temp copy of a file. 2006-05-09 11:12:45 -07:00
Vadim Gelfer
f337648835 add filename to IOError if read of file fails.
if file replaced with directory or symlink, IOError not fully filled out.
2006-05-08 08:20:56 -07:00
Vadim Gelfer
47101ddc97 add util.samestat function for windows.
windows does not have os.path.samestat, and stat().st_ino is always zero,
so util.samestat always returns false on windows.
2006-05-03 22:47:08 -07:00
Vadim Gelfer
75ddc9a984 merge with crew. 2006-05-02 14:37:55 -07:00
Vadim Gelfer
fad839fb0b fix file handling bugs on windows.
add util.posixfile class that has posix semantics on windows.
fix util.rename so it works with stupid windows delete semantics.
2006-05-02 14:30:00 -07:00
Thomas Arendsen Hein
092be2daa9 Use better names (hg-{usage}-{random}.{suffix}) for temporary files. 2006-04-30 21:11:22 +02:00
Vadim Gelfer
3f5f35a23b move SignalInterrupt class into util module. 2006-04-28 14:50:23 -07:00
Vadim Gelfer
acc87bc678 fix issue 217.
fall back to fixed path if windows >= nt function not present.
2006-04-25 08:37:05 -07:00
Jim Meyering
29bdfc218f Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails 2006-04-21 16:09:43 -07:00
Alexis S. L. Carvalho
e1e5a2b65c Ignore EPIPE in pipefilter
This hides the following traceback (there's a race condition involved,
so you may have to try a few times to hit it):

$ hg sign --key key-that-does-not-exist
Signing 2062:4bad92f4ea65
gpg: skipped "key-that-does-not-exist": secret key not available
gpg: signing failed: secret key not available
Exception in thread Thread-1:
Traceback (most recent call last):
  File "threading.py", line 442, in __bootstrap
    self.run()
  File "threading.py", line 422, in run
    self.__target(*self.__args, **self.__kwargs)
  File "mercurial/util.py", line 24, in writer
    pin.close()
IOError: [Errno 32] Broken pipe

abort: Error while signing
2006-04-19 11:41:25 -07:00
Vadim Gelfer
39bf3d1d78 fix util.canonpath on windows.
old test for absolute path was not portable. use os.path api instead.
2006-04-19 09:08:45 -07:00
Chris Mason
92b1bcb569 merge revlogng with mpm tip 2006-04-18 19:50:12 -04:00
Vadim Gelfer
7c29a12e6d import: use gpatch if present on system. patch is broken on solaris.
fixes issue 205.

add new useful function, util.find_in_path.
2006-04-13 17:42:49 -07:00
Vadim Gelfer
d688aaeffa util.unlink should only catch OSError. 2006-04-13 13:46:56 -07:00
Chris Mason
b52474f560 merge 0.8.1 with revlogng 2006-04-08 20:10:46 -04:00
Vadim Gelfer
86b6b506c0 fix exception handling on windows.
move win32 code into util_win32.py.
2006-04-08 14:12:43 -07:00
Vadim Gelfer
3e74e23053 util.copyfiles: only switch to copy if hardlink raises IOError or OSError.
before this, interrupting clone would give "file a same as file b" error
because caught KeyboardInterrupt.
2006-04-05 17:17:07 -07:00
mason@suse.com
9131eec8e3 Create an atomic opener that does not automatically rename on close
The revlog.checkinlinesize() uses an atomic opener to replace the
index file after converting it from inline to traditional .i and .d
files.  If this operation is interrupted, the atomic file class can
overwrite a valid file with a partially written one.

This patch introduces an atomic opener that does not automatically
replace the destination file with the tempfile.  This way
an interrupted checkinlinesize() call turns into a noop.
2006-04-04 16:38:44 -04:00
Vadim Gelfer
74afe6ba38 more windows fixes. 2006-03-30 18:35:52 -08:00
Vadim Gelfer
08cb794787 clean up lee's windows testpid fix. 2006-03-30 18:27:04 -08:00
Lee Cantey
5f23e95446 Fixes to testpid() for Windows.
Handle processes that no longer exist and processes that belong to another user.

Enables the lock breaking changes from 0ab4c12ad060 and subsequently "fixes" the left over locks reported in bug 112.
2006-03-30 18:20:08 -08:00
Benoit Boissinot
cc702f58e2 merge with self 2006-03-23 23:55:51 +01:00
Benoit Boissinot
61a488204f make it possible to escape characters in a glob expression 2006-03-23 23:39:53 +01:00
Vadim Gelfer
2e0f1be283 add changelog style to command line template.
to use, "hg log --style=changelog".  makes different output with no
flags, -q, -v, --debug.

templater module has new template filters for this.
email - committer email address
fill68 - refill text to 68 colums
fill76 - refill text to 76 colums
tabindent - prefix every not empty line with tab
shortdate - iso 8631 date, no time zone
stringify - turn template iterator into string
2006-03-21 23:29:21 -08:00
Thomas Arendsen Hein
1bf1db0503 Enable path validation for copy, rename, debugwalk and other canonpath users.
This fixed the last bit of issue134.
Added some tests to test-rename and test-walk.
2006-03-19 14:53:58 +01:00
Benoit Boissinot
5d3762058d merge with crew 2006-03-15 07:15:13 +01:00
Benoit Boissinot
c1f8a06c2d use a proper test instead of catching every exception 2006-03-15 07:09:42 +01:00
TK Soh
d55c1834ad change default strftime format for better portability
On some systems, such as Solaris and HP-UX, "%c" format
give output without the leading zero on the single-digit
month-day.
2006-03-14 22:01:30 -08:00
Vadim Gelfer
9504f432e5 add HGRCPATH env var, list of places to look for hgrc files.
if set, override default hgrc search path.
if empty, only .hg/hgrc of current repo read.

for each element, if directory, all entries in directory with end in
".rc" are added to path.  else, element is added to path.

big thing about this change is that user "~/.hgrc" and system hgrc not
longer breaks tests.  run-tests makes HGRCPATH empty now.
2006-03-14 21:40:46 -08:00
Vadim Gelfer
03ca08b56f merge with crew. 2006-03-12 16:21:59 -08:00
Vadim Gelfer
97a9d5c4ee merge util.esystem and util.system. 2006-03-10 22:42:59 -08:00
Vadim Gelfer
a8e31fc914 fix broken environment save/restore when a hook runs.
move "run commend with different env/cwd" code out to function in util.
new function is called esystem.
2006-03-10 22:24:19 -08:00
Vadim Gelfer
61a7953729 change lock format to let us detect and break stale locks.
old style: symlink to pid
new style: symlink to hostname:pid

if lock code finds new-style lock, it breaks lock if locking pid is on
same machine and pid is not alive.

otherwise, lock is left alone.  this makes locking code safe with
old-style locks and with locks on other machines.

new code makes server part of mercurial more robust in case machine
crashes, power fails, or crazy user does kill -9.
2006-03-10 08:31:31 -08:00
Thomas Arendsen Hein
3ffc79286b Validate paths before reading or writing files in repository or working dir.
Fixes security relevant issue134.
2006-03-04 19:01:45 +01:00
Vadim Gelfer
cd790c58f1 merge with crew. 2006-03-03 09:39:37 -08:00
Thomas Arendsen Hein
47314a5f51 Whitespace, tab and formatting cleanups, mainly in mq.py 2006-02-28 23:25:34 +01:00
Vadim Gelfer
75d0535141 move shortuser into util module. 2006-02-27 11:32:10 -08:00
Vadim Gelfer
3052663b45 hgwebdir: export collections of repos
now you can use [collections] section in hgweb.config to export entire
tree of repos.
2006-02-10 11:25:07 -08:00
efiring@manini.soest.hawaii.edu
75812b6144 Fix rcpath for hgwebdir case (sys.argv is empty) 2006-01-24 13:59:11 +13:00
Vadim Gelfer
f1758a02f6 make invalid pattern message not confusing. 2006-01-02 15:52:56 -08:00
Vadim Gelfer
859b47ca42 if hgignore contains errors, print message that is not confusing. 2006-01-02 15:48:16 -08:00
Vadim Gelfer
ff1f653af7 eliminate backtrace when piping output on windows.
this fixes issue 54.
2006-01-02 15:25:33 -08:00
Matt Mackall
2df834f9a4 Merge with crew 2005-12-16 11:13:08 -06:00
Benoit Boissinot
f88ffe1792 do not copy atime and mtime in util.copyfiles
it is unsupported on some fs (vfat) and we don't need to copy
it one clone anyway
2005-12-16 01:32:44 -06:00
Benoit Boissinot
78898f92b4 if a filename contains spaces, patch adds quote around it 2005-12-15 17:50:10 +01:00
Vadim Gelfer
3ec3d8787c delete unintended print statement 2005-12-12 07:50:43 -08:00
Vadim Gelfer
c968155220 merge with crew 2005-12-11 15:38:42 -08:00
Arun Sharma
ee55457e68 Handle hg under / 2005-12-01 10:48:42 -06:00
Robin Farine
42b0262a8a export patkind() from util 2005-12-01 10:48:22 -06:00
Benoit Boissinot
f7ef42efdd close file before renaming it (since it doesn't work the other way on windows) 2005-11-14 21:47:07 +01:00
twaldmann@thinkmo.de
55d74a6b77 fixed some stuff pychecker shows, marked unclear/wrong stuff with XXX 2005-11-14 03:59:35 +02:00
Benoit Boissinot
4aae3736a7 add an atomic argument to util.opener
when atomic is used, the file while be renamed on close
2005-11-11 15:33:59 -08:00
Benoit Boissinot
8a08aa0106 copy the mode of the file when breaking hardlinks 2005-11-09 13:38:46 -08:00
Vadim Gelfer
c9f1399932 make mercurial look in more places for config files.
now it searches <install dir>/etc/mercurial, /etc/mercurial, and user
hgrc.

this allows site-wide configuration to be shared over automounted nfs
partition, instead of chenging on every system.  option of having local
configuration on every system remains.

old code for searching /etc/mercurial/hgrc.d never worked, this code
is tested and works.
2005-11-04 11:51:01 -08:00
Benoit Boissinot
8be93f3049 fix handling of daylight saving time 2005-10-31 10:56:42 -07:00
Benoit Boissinot
bc51f024c7 fix a bug where hg could remove file ending with .tmp
util.opener used a fixed filename for writing tempfile
instead of using the tempfile module.
2005-10-28 17:18:50 -07:00
Benoit Boissinot
93854a176d further fix traceback on invalid .hgignore patterns
Please apply this little fix (matchfn return None if no patterns are
specified).
2005-10-26 16:10:56 -07:00
Benoit Boissinot
0e649f370c abort on invalid pattern in matcher 2005-10-25 14:58:11 -07:00
olivier.maquelin@intel.com
fa3a9847db Avoid insertion/deletion of CRs on stdio during hg serve 2005-10-24 14:34:48 -07:00
Benoit Boissinot
abe08fd52f refactor some unlink/remove code and make sure we prune empty dir 2005-10-19 00:10:52 -07:00
Benoit Boissinot
6c6a4b138f Do not use 'glob' expansion by default on OS != 'nt' 2005-10-19 00:02:41 -07:00
Benoit Boissinot
06e39e559b i18n part2: use '_' for all strings who are part of the user interface 2005-10-18 18:38:39 -07:00
Benoit Boissinot
e38e94088a i18n first part: make '_' available for files who need it 2005-10-18 18:37:48 -07:00
Zbynek Winkler
f5c4f54863 Try to use ini-file in the same directory as the exe as the default on NT. 2005-10-18 17:57:27 -07:00
Matt Mackall
42508becda Fix patch failure reporting exception 2005-10-15 15:04:45 -07:00
Eric Hopper
01737b862f Fixed a bug in my changes to httprepo.py 2005-10-03 16:07:54 -07:00
mpm@selenic.com
d701e53cd5 Add support for /etc/mercurial/hgrc.d/*.rc 2005-09-23 19:35:23 -07:00
Bryan O'Sullivan
139919b045 Allow files to be opened in text mode, even on Windows. 2005-09-23 10:28:55 -07:00
Bryan O'Sullivan
566df77193 Clean up date and timezone handling.
We used to pass changelog dates around as a "unixtime timezone" string
containing a pair of encoded ints.  Now, they get passed around as a
(unixtime, timezone) tuple of numbers, which makes much more sense.
2005-09-22 23:19:47 -07:00