Martin Geisler
750183bdad
updated license to be explicit about GPL version 2
2009-04-26 01:08:54 +02:00
Matt Mackall
2f9b02c62d
replace util.sort with sorted built-in
...
This is marginally faster for small and moderately-sized lists
2009-04-26 16:50:44 -05:00
Wagner Bruna
1f15ab3b5a
patch, i18n: avoid parameterized plural
2009-04-20 21:16:14 -03:00
Dirkjan Ochtman
049b5daa9b
merge with crew-stable
2009-04-04 19:43:00 +02:00
Vsevolod Solovyov
201e56ffbb
Fix issue1495, corner case of adding empty files via patching
2009-03-24 23:28:55 +00:00
Matt Mackall
02f3d06343
diffstat: use width 80 by default and avoid division by zero
2009-03-20 14:38:50 -05:00
Peter Arrenbrecht
bc21361ed2
cleanup: drop unused imports
2009-03-23 13:12:07 +01:00
Matt Mackall
2e1730294c
patch: teach selectfile about symlinks (issue1438)
2009-02-16 17:37:23 -06:00
Dirkjan Ochtman
a61aacf5f2
patch: no need to instantiate a match catch-all in diff()
2009-02-12 12:35:48 +01:00
Dirkjan Ochtman
5de1ecaba0
merge with mpm
2009-02-07 23:29:12 +01:00
Martin Geisler
fdc5030e00
patch: turned strings with backslashes into raw strings
...
In Python, the backslash in an unrecognized escape sequence is left
behind, which makes '\.' the same as r'\.'. Relying on this feature is
quite brittle, IMHO.
Removed unnecessary string concatenation as well.
2009-02-04 20:53:38 +01:00
Dirkjan Ochtman
0f821bb2e9
kill some trailing whitespace
2009-01-19 12:59:56 +01:00
Patrick Mezard
7ab8b3fde9
diffstat: don't fail on merges
...
First version by Alexander Solovyov <piranha@piranha.org.ua>
2009-01-13 20:28:06 +02:00
Benoit Boissinot
11526cacc9
patch: export shouldn't close files received as a parameter
...
We rely on __del__ to close the fd instead. Patchbomb was relying
on this behaviour, fix it.
Thanks to Manuel Barkhau for reporting it.
2009-01-09 01:36:35 +01:00
Dirkjan Ochtman
25cd3135ab
merge with crew-stable
2009-01-03 21:24:31 +01:00
Dirkjan Ochtman
5d131cc7a2
patch: kill some trailing whitespace
2009-01-03 20:33:37 +01:00
Martin Geisler
336bd98e22
use repo.wjoin(f) instead of os.path.join(repo.root, f)
2009-01-02 22:53:33 +01:00
Mads Kiilerich
d775f5aa2a
Make util.find_exe alway returns existing file, fixing issue1459
...
It seems like the old behaviour with different handling for commands with and
without path was intended, but I think this behaviour of util.find_exe is
better:
* Always returns existing file
* or None if command not found - no default
* Windows: Returned file thus always ends with extension from PATHEXT
This fixes http://www.selenic.com/mercurial/bts/issue1459 . The change might
fix other unintended behaviour too.
2009-01-25 21:20:13 +01:00
Alexander Solovyov
c1774bb6c3
python implementation of diffstat
...
Implemented as two functions: diffstat, which yields lines of text,
formatted as a usual diffstat output, and diffstatdata, which is called
inside diffstat to do real performing and yield file names with
appropriate data (numbers of added and removed lines).
2008-12-25 10:48:24 +02:00
Brendan Cully
81d39df2bc
Merge with crew-stable
2008-12-14 23:05:18 -08:00
Brendan Cully
6e6159b63f
patch: handle git patches that remove symlinks (issue1438)
2008-12-14 23:04:29 -08:00
Bartosz SKOWRON
5c9eae5dcc
patch: simplify linereader
2008-12-05 14:51:50 +01:00
Patrick Mezard
1ac6f464a8
patch: catch only IOError from makedirs()
2008-12-11 22:59:35 +01:00
Stefan Rusek
601a15ee5f
When applying a git diff, ensure that the target dir exists for new files
2008-12-09 14:27:47 +01:00
Brendan Cully
aad17924e9
import: add similarity option (issue295)
2008-11-22 00:21:57 -08:00
Patrick Mezard
b4165c254b
patch: isolate patchfile filesystem calls into methods
...
This is a first step toward an svn-like patch driver and makes patchfile
monkeypatching much easier. The latter is currently required to support
in-memory patching until the code is refactored.
2008-11-19 13:27:57 +01:00
Patrick Mezard
b023997f48
patch: pass an opener to patchfile
2008-11-19 13:27:57 +01:00
Patrick Mezard
c7c4e521be
patch: remove useless unlink() call
2008-11-19 13:27:57 +01:00
Ronny Pfannschmidt
599e773be7
export: fixed silent output file overwriting
...
hg export -o outfile 1 2 3 4 had the same effect as hg -o outfile 4
This was caused by opening with 'w' instead of 'a'. This only occurs when
the filename pattern resulted in ambiguous patch filenames.
2008-11-06 11:17:38 +01:00
Dirkjan Ochtman
2f6d26d640
patch: turn patch.diff() into a generator
...
This should even be a little faster than passing in an fp argument.
2008-11-03 16:48:23 +01:00
Patrick Mezard
98804940d3
patch: rewrite diffstat with util.filter()
...
Simpler and works under Windows.
2008-10-27 22:57:55 +01:00
Patrick Mezard
ef4d9a9d32
patch: fix patched files records in externalpatcher()
2008-10-26 17:26:28 +01:00
Bartosz SKOWRON
6ad08c06ee
patch: remove double variables in copyfile() func
2008-10-24 20:46:56 +02:00
Dirkjan Ochtman
7c9e09c95d
patch/diff: use a separate function to write the first line of a file diff
2008-10-22 13:14:52 +02:00
Dirkjan Ochtman
78076ceffb
patch: consolidate two different regexes for parsing of git diffs
2008-10-22 12:56:28 +02:00
Dirkjan Ochtman
fd4600fc66
patch: extract local function addmodehdr
2008-10-22 09:29:26 +02:00
Dirkjan Ochtman
f5ea74b223
clean up trailing spaces, leading spaces in C
2008-10-20 14:57:04 +02:00
Patrick Mezard
907514d367
patch: pass linereader to binaryhunk.extract() instead of wrapped fp
...
It unifies input patch file access methods
2008-10-18 23:45:46 +02:00
Patrick Mezard
7e769ebcae
patch: pass linereader to scangitpatch(), extract from iterhunks()
...
It's good because it unifies the patch file access methods.
2008-10-18 23:45:46 +02:00
Patrick Mezard
92038e51fa
patch: change functions definition order for readability
2008-10-18 23:45:45 +02:00
Patrick Mezard
3eb6564f0f
patch: map changed files to patchmeta directly
2008-10-18 23:45:45 +02:00
Patrick Mezard
caa00c7b41
patch: patchmeta gives (islink, isexec) tuple instead of int mode
2008-10-18 23:45:45 +02:00
Patrick Mezard
5924883bb6
patch: extract and rename gitpatch into patchmeta, document
2008-10-18 23:45:45 +02:00
Patrick Mezard
d76f01041c
patch: remove applydiff() useless updatedir and rejmerge arguments
2008-10-18 23:45:45 +02:00
Dirkjan Ochtman
67bd09df5b
python2.6: use subprocess if available
2008-10-05 21:35:26 +02:00
Matt Mackall
d8fdfa3f85
diff: pass contexts to status
...
Allow status() to take contexts as well as nodes. This lets us avoid
unpacking manifests multiple times and intelligently unpack manifests
in revision order. Also, we can avoid unpacking manifests at all when
there are no changes in the working directory.
2008-10-12 15:21:08 -05:00
Martin Geisler
28fb695e9a
i18n: mark strings for translation in Mercurial
2008-08-31 16:12:02 +02:00
Martin Geisler
897f1ddab8
i18n: avoid naive plural tricks
2008-08-31 16:12:02 +02:00
Dirkjan Ochtman
fcaabba3ec
fix double indentation and trailing whitespace
2008-08-31 11:41:52 +02:00
Dirkjan Ochtman
6b51480caa
merge with crew-stable
2008-08-12 17:47:08 +02:00
Matt Mackall
e03f4e2f73
util: set_flags shouldn't know about repo flag formats
2008-08-10 21:55:06 -05:00
Brendan Cully
2aef8dbc09
Check that git patches only touch files under root
2008-06-25 14:13:20 -07:00
Matt Mackall
a65ef7bc5d
util: add sort helper
2008-06-27 18:28:45 -05:00
Matt Mackall
d4ab55a92b
status: clean up all users for unknown files
2008-06-27 13:43:29 -05:00
Brendan Cully
f5b1d49e0d
Check that git patches only touch files under root
2008-06-25 14:13:20 -07:00
Matt Mackall
fbb5127472
use repo[changeid] to get a changectx
2008-06-26 14:35:46 -05:00
Matt Mackall
d462e1fc26
simplify flag handling
...
add _checklink var to dirstate
introduce dirstate.flagfunc
switch users of util.execfunc/linkfunc to flagfunc
change manifestdict.set to take a flags string
change ctx.fileflags to ctx.flags
change gitmode func to a dict
remove util.execfunc/linkfunc
2008-06-26 13:46:34 -05:00
Matt Mackall
5867ff1667
use repo.changectx(None) to get a workingctx
2008-06-26 13:46:29 -05:00
Matt Mackall
5001543d15
use repo.changectx rather than context.changectx
2008-06-25 17:34:28 -05:00
Matt Mackall
fb88571d19
match: remove files arg from repo.status and friends
2008-05-12 11:37:08 -05:00
Matt Mackall
081e89551b
match: remove files argument from patch.diff
2008-05-12 11:37:08 -05:00
Adrian Buehlmann
8dddfa01ec
removing unused local ccache in patch.diff
2008-04-11 15:14:00 +02:00
Benoit Boissinot
60caa13781
merge with -stable
2008-04-12 23:05:51 -04:00
Benoit Boissinot
e297c198c0
fix import with -p0
2008-04-12 22:41:07 -04:00
Patrick Mezard
8e0cbccd26
Let --unified default to diff.unified (issue 1076)
2008-04-04 22:15:14 +02:00
Dirkjan Ochtman
34d6bea8db
python 2.6 compatibility: compatibility wrappers for hash functions
2008-04-04 22:36:40 +02:00
Patrick Mezard
d65e9c81dd
patch: fix corner case with update + copy patch handling (issue 937)
...
The self patching of files when diffed with a backup is a bit peculiar to me.
It makes sense in mpatch, that's less clear in mercurial patching code. Let's
document and preserve it for now.
2008-03-17 23:36:45 +01:00
Patrick Mezard
107a228e2f
patch: check filename is /dev/null for creation or deletion (issue 1033)
...
Otherwise, file creation or deletion is ambiguous with file being filled or
emptied.
2008-03-16 00:35:12 +01:00
Matt Mackall
5c5200eb63
diff: use copy smarts from copies.py
2008-03-15 10:02:31 -05:00
Joel Rosdahl
5dae3059a0
Expand import * to allow Pyflakes to find problems
2008-03-06 22:23:26 +01:00
Patrick Mezard
d5040b6003
patch: fix iterhunks() with trailing binary file removal
...
Like some renames or copy operations, binary file removal does not generate any
"file" or "hunk" action, but was not tagged as such and let iterhunk() assume
no hunk was applied for the deleted file.
2008-02-28 00:07:37 +01:00
Bryan O'Sullivan
4a012ef2b9
Merge with crew
2008-02-06 19:57:52 -08:00
Matt Mackall
63cc8c83c8
transform a bunch of print statements to appropriate ui calls
2008-01-18 10:48:25 -06:00
Patrick Mezard
d1c841154d
Merge with crew-stable
2008-01-12 20:49:07 +01:00
Patrick Mezard
2d2126f043
patch: handle empty vs no file in git patches (issue906)
2008-01-12 19:35:11 +01:00
Patrick Mezard
b3a11777ac
patch: remove CRLF when parsing file names
2008-01-12 20:43:09 +01:00
Thomas Arendsen Hein
347da85c36
Removed tabs and trailing whitespace in python files
2007-12-29 19:49:48 +01:00
Patrick Mezard
a802f4255a
patch: be more tolerant to diffstat failures (issue 865)
...
Sometimes, revisions cannot be represented by a regular diff, only a git diff
would capture binary files or permission changes. diffstat cannot handle git
patches and will output "0 files changed" when fed with an empty diff. We
cannot consider the latter to be an error, unless we rewrite diffstat to handle
these correctly.
2007-12-25 22:21:51 +01:00
Matt Mackall
f21286882c
patch: use util.set_flags
2007-12-27 22:29:21 -06:00
Patrick Mezard
cf0ec16a92
Merge with crew-stable
2007-12-25 22:23:58 +01:00
Patrick Mezard
0661d4b997
patch: simplify directory creation
2007-12-17 23:42:48 +01:00
Patrick Mezard
1fb759fad1
patch: write rej files for missing targets (issue 853)
2007-12-17 23:42:46 +01:00
Patrick Mezard
29045b226b
patch: avoid file existence tests when possible in selectfile()
2007-12-17 23:06:04 +01:00
Patrick Mezard
c43b58242b
patch: move diff parsing in iterhunks generator
2007-12-17 23:06:01 +01:00
Patrick Mezard
b4f670a426
patch: move NoHunk detection up with parsing code
2007-12-17 22:19:21 +01:00
Patrick Mezard
4bd17cf5de
mq: missing target files do not make qpush to fail immediately (issue 835)
...
Reported and explained by Peter Arrenbrecht <peter.arrenbrecht@gmail.com>.
Following file additions were skipped but empty files were still created. This situation could lead to qrefresh losing patch information.
2007-12-02 13:53:29 +01:00
Jim Hague
5ef18ea71f
patch: fix sort() comparator argument
...
'hg import' fails under Python 2.3. The name of the compare function parameter in the call to list.sort() is 'cmpfunc' in Python 2.3 and
'cmp' in Python 2.4+. Passing the compare function as a named parameter is therefore problematic.
2007-11-25 11:49:34 +01:00
Dustin Sallings
bebcdac954
Use both the from and to name in mdiff.unidiff.
...
This fixes a compatibility issue with git diffs.
* * *
2007-11-01 12:17:59 -07:00
Patrick Mezard
6aa1e21320
Fix Windows os.popen bug with interleaved stdout/stderr output
...
See python bug 1366 "popen spawned process may not write to stdout under windows" for more details.
2007-11-01 12:05:14 +01:00
Thomas Arendsen Hein
d3c1b2079e
Only set mode of new patch if the target file was removed before.
...
If the file is writable by the user, but owned by a different user, the
chmod will otherwise fail with "Operation not permitted".
Additionally make very sure that the file is only written if either the number
of links is <= 1 or the file was successfully removed.
Maybe this minimal COW code should be replaced by something from util.
2007-10-25 19:40:56 +02:00
jorendorff@mozilla.com
c3848517a7
commands.py, patch.py: add -U option to hg diff command
2007-07-26 07:56:04 -04:00
Matt Mackall
cd72dc7f1b
Merge with crew
2007-07-21 16:44:38 -05:00
Matt Mackall
3a3bd8ec5b
Make repo locks recursive, eliminate all passing of lock/wlock
2007-07-21 16:02:10 -05:00
Patrick Mezard
dd336a8d1a
patch: patches should be read and written in binary mode when possible.
2007-07-17 23:35:24 +02:00
Patrick Mezard
ccc14e4990
patch: fix normalized paths separators.
2007-07-17 23:34:52 +02:00
Bryan O'Sullivan
6c741e45c0
patch.py: re-add the ability to use an external patch program
...
This is now invoked by default only if ui.patch is set. Otherwise, we
use our built-in patch. If that fails because it can't find any valid
hunks, we'll fall back to trying the external patch command.
2007-07-17 09:39:30 -07:00
Bryan O'Sullivan
78c5b7bde0
patch.py: don't mark files as changed unless they have actually been changed
2007-07-17 09:39:30 -07:00
Bryan O'Sullivan
691d74d7d4
patch.py: fix some incorrect uses of _() for i18n
2007-07-17 09:39:30 -07:00
Bryan O'Sullivan
590b9213d3
Add Chris Mason's mpatch library.
...
The original repo is http://oss.oracle.com/mercurial/mason/mpatch
2007-07-17 09:39:30 -07:00
Brendan Cully
e8ad904a56
patch.extract: fix test-import breakage introduced in the previous changeset
2007-07-02 13:26:12 -07:00