Mads Kiilerich
865bdae0fa
patch: strip paths in leaked git patchmeta objects
2010-04-26 13:21:03 +02:00
Mads Kiilerich
345145e804
patch: minor cleanup of _applydiff
2010-04-26 13:21:03 +02:00
Mads Kiilerich
63938a51f6
patch: git delete mode shouldn't be used at all
2010-04-26 13:21:02 +02:00
Mads Kiilerich
9f2ca1164a
patch: make "unable to strip away" message less confusing
2010-04-26 13:21:02 +02:00
Mads Kiilerich
10fedd8d3d
patch: descriptive patchmeta.__repr__ to help debugging
2010-04-26 13:21:02 +02:00
Augie Fackler
2556500e58
patch: refactor applydiff to allow for mempatching
2010-04-17 13:23:24 -05:00
Augie Fackler
4da02e74e7
patch: move mercurial-specific imports after stdlib imports
2010-04-17 13:13:57 -05:00
Nicolas Dumazet
7f1a963829
pylint, pyflakes: remove unused or duplicate imports
2010-04-14 17:58:10 +09:00
Brendan Cully
76b7a3a26b
Merge with stable
2010-04-11 20:59:55 -07:00
Peter Arrenbrecht
7abe6f6609
patch: don't look for headers in diff lines
...
If you have a diff line that matches a header line, the patch splitter
currently breaks your patch at this line. For example a line like:
+key: value
This can lead to "malformed patch" exceptions. Now fixed.
2010-04-09 20:34:05 +02:00
Brodie Rao
e504a56477
diff: make use of output labeling
2010-04-02 15:22:06 -05:00
Benoit Boissinot
6173388ed6
patch: warn when the internal patcher fails
...
hopefully we'll soon fix the remaining failures from the internal patcher, and
not use the external one anymore.
2010-03-22 11:08:42 +01:00
Matt Mackall
092c3572fb
Merge with stable
2010-03-20 16:57:24 -05:00
Matt Mackall
453a04eaaf
Merge with stable
2010-03-20 10:01:56 -05:00
Benoit Boissinot
879a4a71db
patch: more precise NoHunk, raised for every file (issue2102)
2010-03-20 14:47:05 +01:00
Benoit Boissinot
6ed4471107
patch: differentiate start of file with diff --git vs '--- '
2010-03-20 21:16:22 +01:00
Benoit Boissinot
f5bfcde5cb
patch: try harder to find the file to patch on file creation (issue2041)
...
accept the following patch header:
first line: foo/a.orig
second line: foo/a
2010-03-19 22:52:38 +01:00
Matt Mackall
ef87d8630d
Merge with stable
2010-03-19 16:05:16 -05:00
Benoit Boissinot
223c085b2b
patch: second line of a context diff starts with '--- ', not '+++ '
2010-03-19 12:45:39 +01:00
Benoit Boissinot
0ad95ca3aa
patch: enhance diff detection regexp, allow '--- ' in patch message
2010-03-18 18:22:34 +01:00
Brendan Cully
791f92f6bd
Merge with stable
2010-03-18 14:36:24 -07:00
Benoit Boissinot
5af4a60795
patch/diff: move diff related code next to each other
2010-03-09 19:04:18 +01:00
Benoit Boissinot
04d99f9fbc
patch/diff: move patch.export() to cmdutil.export()
...
This API change will allow us to break a cycle between patch and cmdutil.
2010-03-08 19:43:24 +01:00
Patrick Mezard
dede247fea
patch: fix patching with fuzz and eol normalization
2010-02-22 22:55:58 +01:00
Wagner Bruna
9b81c3ec4d
patch, i18n: avoid parameterized messages
...
Singular message removed for simplicity.
2010-02-19 13:04:11 -02:00
Brendan Cully
de7c8ccdfb
import: if in doubt, consume stream until start of diff
...
This prevents a header-like line in the message body from causing a spurious split.
2010-02-18 10:46:01 -08:00
Patrick Mezard
908955c63c
patch: remove useless copy, cleanup
2010-02-14 17:53:23 +01:00
Wagner Bruna
ce83d27cac
patch: separate reverse copy data (issue1959)
2010-02-11 11:22:57 -02:00
Brendan Cully
ce047e9ab3
import: import each patch in a file or stream as a separate change
...
Supports hg export <revrange>, mail messages, and mailboxes.
Does not support multiple patches in a single MIME attachment.
Closes issue167.
2010-02-07 18:06:52 +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
c6da65973e
patch: explicitely close input patch files when leaving
...
If applydiff() raises an exception, the opened patch file is kept alive in the
exception context. If it is a temporary file (for instance supplied by import
command with stdin input), Windows cannot clean it up.
2010-01-03 19:47:07 +01:00
Greg Onufer
5056bcbd9e
patch: better handling of sequence of offset patch hunks (issue1941)
...
The built-in patch implementation applied the hunks to the wrong lines of the
file if the file in the repo has been modified to skew the patch line numbers
and the file contains repetitive sequences of lines.
2009-12-09 16:56:00 -08:00
Yannick Gingras
ed1d8b7e7a
diff: add --inverse option
...
Most of the time, one can reverse a diff by swapping the revisions passed with
-r but it happens that if you use the global -R, and diff against the tip of
the current repo, you can't swap the revisions. One use-case for that is
reviewing changes from a bundle before unbundling. One could also pipe the
output of `hg diff` to a command line filter that reverses the diff, but that
would remove the benefit from color diffs. Therefore, having an option in
`hg diff` to reverse a diff is a good thing.
The option flag selection was tricky. GNU patch uses -R/--reverse but -R is
already used as a global option and --reverse would make --rev ambiguous.
2009-11-05 15:18:56 +01:00
Dirkjan Ochtman
12c5890a70
kill trailing whitespace
2009-11-05 10:44:36 +01:00
Benoit Boissinot
01d3fbbbd0
patch: use the public ctx API instead of the internals
2009-10-31 18:02:34 +01:00
Benoit Boissinot
9015e8911f
patch: don't use mutable object as default argument
2009-10-31 18:02:13 +01:00
Benoit Boissinot
1c058dc6e9
patch: initialize all attributes of the hunk class
2009-10-31 18:01:08 +01:00
Benoit Boissinot
667b87aaec
patch: simplify logic
2009-10-31 18:00:05 +01:00
Brodie Rao
7c2f2247c5
diffstat: with --git, mark binary files with Bin
...
Normally, diffs without any text insertions or deletions are reported
as having 0 lines changed by stock diffstat. Compatibility is
preserved with stock diffstat in this case, but when using --git,
binary files are marked with Bin as a means of clarification.
git diff --stat does something similar, though it also includes the
old and new file sizes.
2009-10-25 02:53:33 +02:00
Brodie Rao
cd4a91c73f
diffstat: print 0 instead of nothing for 0 adds or removes
...
This is in line with how the stock diffstat behaves when processing a
single diff with no line modifications (like a binary diff).
2009-10-25 02:35:35 +02:00
Patrick Mezard
990e7895a0
Merge with crew-stable
2009-10-16 00:06:23 +02:00
Patrick Mezard
7b9a712086
patch: handle symlink updates/replacements (issue1785)
2009-10-15 23:15:30 +02:00
Patrick Mezard
5c89cb752a
patch: handle symlinks without symlinkhunk
...
Symlink creations and deletions were handled with a special symlinkhunk object,
working like a binary hunk. However, this model does not support symlink
updates or replacements, so we teach regular hunks how to handle symlinks.
2009-10-15 23:15:30 +02:00
Patrick Mezard
a7d029beb4
patch: do not swallow header-like patch first line (issue1859)
...
Current solution is hackish but looks like a good trade-off short of rewriting
patch.extract() significantly.
2009-10-08 23:42:33 +02:00
Matt Mackall
b6547e5312
Merge with stable
2009-10-11 13:54:19 -05:00
Martin Geisler
9f1896c083
do not attempt to translate ui.debug output
2009-09-19 01:15:38 +02:00
Nicolas Dumazet
908bc54270
patch: remove the unused, broken reverse() function
2009-08-23 14:32:58 +02:00
Nicolas Dumazet
1291ef7c74
patch: readgitpatch: remove unused variable 'src'
2009-08-24 14:40:21 +02:00
Bill Barry
5c4fb9e616
fix issue 1763: strip chars from end of line when parsing gitpatch lines
2009-07-24 15:53:40 -06:00
Brendan Cully
31a596d574
Make patch.diff filelog cache LRU of 20 files. Fixes issue1738.
...
20 files is as fast as 200 for hg diff -r 28015:30103 of mozilla-central.
Ideally we'd use util.lrucachefunc, but the interface doesn't quite work.
2009-07-14 16:50:37 -07:00
Martin Geisler
f5e48ed894
patch: marked string for translation
2009-08-10 23:02:58 +02:00
Brodie Rao
5c00bff54a
diffstat: scale adds/removes proportionally to graph width
...
The previous method of scaling had a tendency to include graph lines that
went past the output width when the file with the most changes had a very
large number of changes.
2009-08-10 22:59:29 +02:00
Brendan Cully
dcdbd19aef
patch: create file even if source is not /dev/null
...
as long as the first hunk is -0,0 and the source and destination have the
same name. Matt found a patch like this, and /usr/bin/patch accepts it.
2009-08-07 19:27:54 -07:00
Matt Mackall
eba820848f
Merge with crew
2009-07-27 18:38:20 -05:00
Brendan Cully
330d2aecf7
Merge with crew-stable
2009-07-14 16:51:52 -07:00
Alejandro Santos
1ef2fb42a7
compat: use 'key' argument instead of 'cmp' when sorting a list
2009-07-05 11:02:00 +02:00
Alejandro Santos
77d606ac51
compat: use open() instead of file() everywhere
2009-07-05 11:01:30 +02:00
Alejandro Santos
3183e52503
compat: use // for integer division
2009-07-05 11:00:44 +02:00
Simon Heimberg
66c4ab1cbf
patch: use new style class in linereader
2009-06-22 12:05:11 +02:00
Dirkjan Ochtman
605b944edf
kill trailing whitespace
2009-06-19 13:47:50 +02:00
Colin Caughie
53aca7b1bf
Fixed patch.eol bug that truncated all patched lines to one character
...
Also updated the import-eol test to test with lines longer than one character,
and also empty lines.
2009-06-16 16:22:42 +01:00
Patrick Mezard
c1548a6a3e
Add patch.eol to ignore EOLs when patching (issue1019)
...
The intent is to fix many issues involving patching when win32ext is enabled.
With win32ext, the working directory and repository files EOLs are not the same
which means that patches made on a non-win32ext host do not apply cleanly
because of EOLs discrepancies. A theorically correct approach would be
transform either the patched file or the patch content with the
encoding/decoding filters used by win32ext. This solution is tricky to
implement and invasive, instead we prefer to address the win32ext case, by
offering a way to ignore input EOLs when patching and rewriting them when
saving the patched result.
2009-06-15 00:03:26 +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
5b4e5428df
replace "i in range(len(xs))" with "i, x in enumerate(xs)"
...
The remaining occurrences should be the ones where "xs" is mutated or
where "i" is used for index arithmetic.
2009-05-26 22:59:52 +02:00
Patrick Mezard
270c4ac7da
Merge with crew-stable
2010-01-03 20:36:30 +01:00
Patrick Mezard
d6ce43b965
patch: support diff data loss detection and upgrade
...
In worst case, generating diff in upgrade mode can be two times more expensive
than generating it in git mode directly: we may have to regenerate the whole
diff again whenever a git feature is detected. Also, the first diff attempt is
completely buffered instead of being streamed. That said, even without having
profiled it yet, I am convinced we can fast-path the upgrade mode if necessary
were it to be used in regular diff commands, and not only in mq where avoiding
data loss is worth the price.
2010-01-01 20:54:05 +01:00
Patrick Mezard
9a59d5af22
patch: make git diffline generation more explicit
2009-12-29 16:00:38 +01:00
Patrick Mezard
bf3c546c3f
Merge with crew-stable
2009-12-24 00:01:13 +01:00
Patrick Mezard
32212929f1
patch: drop unused hunk.newctrl()
2009-12-23 19:31:48 +01:00
Patrick Mezard
cd49284bae
patch: drop eol normalization fast-path for 'lf' and 'crlf'
...
With eolmode set to 'lf' or 'crlf' we avoided the hunk duplication and
normalization by reading the input patch in text mode. Dropping this
optimization simplifies code expectations for a small overhead.
The change in test-mq-eol comes from a tolerance to CRLF instead of LF for last
lines without newlines being broken by this revision. This tolerance was only
partially supported and will be added again in a better way.
2009-12-23 19:31:48 +01:00
Patrick Mezard
7d0eedb075
patch: fix eolmode=auto with new files
...
If target file does not exist or has no eol, current code was normalizing eols
to LF. Preserve patch file eols instead.
2009-12-23 19:31:47 +01:00
Martin Geisler
8a5bf57c34
patch: implement patch.eol=auto mode
...
EOLs in patched files are restored to their original value after
patching. We use the first EOL found in the file, files with
inconsistent EOLs will thus be normalized during this process.
2009-12-20 17:18:04 +01:00
Martin Geisler
6e4790ea0c
patch: propagate eolmode down to patchfile
...
The old code mapped the value of eolmode ('strict', 'crlf' or 'lf') to
eol (None, '\r\n' or '\n') at the entry point in internalpatch. The
value of eol was then used directly as the desired EOL in patchfile.
We now delay the mapping and let patchfile do it instead. This allows
for more complicated behavior where it does not make sense to map
eolmode directly to the target EOLs.
2009-12-20 17:18:02 +01:00
Martin Geisler
0a365d5ca2
use 'x is None' instead of 'x == None'
...
The built-in None object is a singleton and it is therefore safe to
compare memory addresses with is. It is also faster, how much depends
on the object being compared. For a simple type like str I get:
| s = "foo" | s = None
----------+-----------+----------
s == None | 0.25 usec | 0.21 usec
s is None | 0.17 usec | 0.17 usec
2009-05-20 00:52:46 +02:00
Martin Geisler
d4730b32a3
patch: simplify Boolean expression slightly
...
The context variable is either True, False or None. Abbreviate it as C
and we get the following truth table where the second column is the
original expression and the third column is the new expression:
C | C or C == None | C is not False
True | True | True
False | False | False
None | True | True
2009-05-20 00:43:23 +02:00
Benoit Boissinot
a59b10003e
patch: use set instead of dict
2009-05-17 03:28:49 +02:00
Matt Mackall
06f4d7f9fa
patch: copy copies dict before changing it (issue1651)
2009-05-14 13:20:40 -05:00
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
Brendan Cully
099f763bc1
patch.extract: do not prepend subject if the description already starts with it
2007-07-02 10:59:16 -07:00
Thomas Arendsen Hein
3019bb7a0b
Kill trailing spaces
2007-06-21 09:25:49 +02:00
Patrick Mezard
8f4c2f4b77
patch: fix ui.patch regression introduced by ef94caf261ce.
...
The idea is ui.patch is either empty or wisely filled by user.
2007-06-19 17:02:07 +02:00
Thomas Arendsen Hein
49220695bc
Removed trailing whitespace and tabs from python files
2007-06-06 20:22:52 +02:00
Alexis S. L. Carvalho
976e7af22b
patch.diff: avoid calling workingctx().manifest()
...
Right now, to generate the manifest of the working dir, we have to
perform a full walk of the working dir, which will be very slow,
especially if we're interested in only a small part of it.
Since we use the manifest only to find out the mode of files for git
patches, manually build an execf function to do it.
This should fix issue567.
2007-06-03 14:38:52 -03:00
Bryan O'Sullivan
4eff752451
Automated merge with http://hg.intevation.org/mercurial/crew
2007-05-27 14:43:29 -07:00
Bryan O'Sullivan
d67a234671
Introduce find_exe. Use instead of find_in_path for programs.
...
The behaviour of find_in_path was broken for config options containing
path names, because it always searched the given path, even when not
necessary. The find_exe function is more polite: if the name passed
to it contains a path component, it just returns it.
2007-05-27 14:26:54 -07:00
Eric Hopper
9da473c4e8
Add ability to parse branch information to hg import
2007-05-17 20:09:47 -07:00
Eric Hopper
119a887cdc
Add branch information to hg export.
2007-05-10 13:42:36 -07:00
Patrick Mezard
3e2c29954d
Add ui.patch option.
...
ui.patch overrides the default patch/gpatch command and options.
2007-05-12 21:09:31 +02:00
Patrick Mezard
37afbaec09
Fix issue483 - mq does not work under windows with gnu-win32 patch.
...
Add --binary option to patch command under win32.
2007-05-12 21:09:29 +02:00
Patrick Mezard
59a5193f63
patch: fix git sendmail handling without proper mail headers
2007-10-08 22:20:23 +02:00
Alexis S. L. Carvalho
fa0374301e
Always copy the necessary files before applying a git patch
...
This patch removes the "copymod" attribute from the gitpatch
class.
AFAICS, that attribute was only used to delay the copying of
renamed/copied files if there are no other changes to the target,
but in this case, if there are changes to the source, we'll end
up copying the wrong version.
This should fix issue762.
2007-10-06 15:30:15 -03:00
Alexis S. L. Carvalho
de9e404b5c
Avoid a working dir walk while trying to detect copies for diff --git
2007-08-28 23:02:41 -03:00
Alexis S. L. Carvalho
a718b1f9b5
Make hg diff --git -r revA:revB detect (inverted) copies if revA > revB
2007-08-28 22:48:25 -03:00
Thomas Arendsen Hein
e34927453f
Remove trailing spaces, fix indentation
2007-08-07 10:28:43 +02:00
Brendan Cully
7bd6f8b503
patch: add git symlink support
2007-08-04 23:07:52 -07:00
Bryan O'Sullivan
ce7f264f24
patch: make internal code a bit friendlier to use
2007-07-31 16:28:05 -07:00
Bryan O'Sullivan
46b7a3a9ca
patch: remove unused parameter from b85diff
2007-07-30 20:49:08 -07:00
Alexis S. L. Carvalho
047c4b002b
Merge with crew-stable.
2007-04-07 04:45:27 -03:00
Alexis S. L. Carvalho
0489c59b5e
Try to find diffstat in PATH before calling it
...
At least on Solaris, /bin/sh will print a "command not found" message
even if we redirect stderr.
2007-04-07 04:27:55 -03:00
Alexis S. L. Carvalho
fcb39243b1
pass repo.root to util.pathto() in preparation for the next patch
2007-03-16 00:22:57 -03:00
Brendan Cully
00246f4c76
Add import --exact.
...
When this option is set, import will apply the patch (which must
be generated by export) to the parents specified in the patch,
and check that the node produced by the patch matches the node
ID in the patch.
2007-03-22 10:44:59 -07:00
Alexis S. L. Carvalho
47cb22b5a2
Merge with crew-stable
2007-03-16 00:45:18 -03:00
Brendan Cully
1c21b0ba74
git-send-email compatibility: stop reading changelog after ^---$
2007-03-14 11:46:07 -07:00
Brendan Cully
6b751ffa32
Make [PATCH] removal slightly more robust
2007-03-13 21:54:34 -07:00
Brendan Cully
cdd51812ef
Strip [PATCH...] from message subject when importing patches
2007-03-12 13:58:06 -07:00
Alexis S. L. Carvalho
641d95a966
Merge a bunch of matcher and locate fixes.
2007-03-10 23:21:33 -03:00
Alexis S. L. Carvalho
1ac4016af4
remove obsolete code from patch.diff
...
repo.status already does this filtering. If the caller supplies a set of
changes, it's his responsibility to filter out what he doesn't want.
2007-03-10 23:00:43 -03:00
Alexis S. L. Carvalho
8cab83c8ec
git binary patches: don't print the header for identical files
2007-02-17 09:55:00 -02:00
Alexis S. L. Carvalho
fe408bb673
git binary patches: use hashes to detect identical files
2007-02-17 09:54:59 -02:00
Alexis S. L. Carvalho
14c4429263
git patches: handle renames of binary files
2007-02-16 04:54:46 -02:00
Brendan Cully
d71b00e6f3
Suppress <stdout> before hg export -v (regression from previous patch).
2007-03-02 14:03:30 -08:00
Brendan Cully
507ce565c1
Let patch.export handle any fp-like object
2007-03-01 20:53:38 -08:00
Thomas Arendsen Hein
134efad44c
merge with crew-stable
2007-02-20 20:55:23 +01:00
Alexis S. L. Carvalho
d4de823a64
merge with crew-stable
2007-02-16 05:27:37 -02:00
Matt Mackall
9a533e02cb
symlinks: add flags param to wwrite
...
Now wwrite can set symlink and exec for files
2006-12-29 20:04:31 -06:00
Matt Mackall
b875ad6c04
exec: add execfunc to simplify exec flag support on non-exec filesystems
2006-12-29 20:04:30 -06:00
Benoit Boissinot
7451685c26
commands.py: use contexts in export
2006-12-26 03:12:23 +01:00
Benoit Boissinot
a05f887d12
patch: use contexts for diff
2006-12-25 17:43:49 +01:00
Benoit Boissinot
cd66ae056f
remove various unused import
2006-12-25 13:37:00 +01:00
Brendan Cully
8c26621151
Merge with crew-stable
2006-12-15 18:38:09 -08:00
Thomas Arendsen Hein
a6c0381996
Don't use node length for calculating revision number length.
...
Done by moving repo.lookup of revisions from commands.export to patch.export
2006-12-15 19:30:20 +01:00
Thomas Arendsen Hein
f0c446ce6e
Make sequence number on hg export start at 1 (as documented for %n). Add test.
2006-12-15 19:09:10 +01:00
Matt Mackall
296d6a7cb8
Simplify i18n imports
2006-12-14 20:25:19 -06:00
Matt Mackall
f17a4e1934
Replace demandload with new demandimport
2006-12-13 13:27:09 -06:00
Alexis S. L. Carvalho
7781594dc0
handle files with more than one git binary patch
2006-11-27 22:03:36 -02:00
Alexis S. L. Carvalho
b0141a470e
handle files with both git binary patches and copy/rename ops
2006-11-27 22:03:31 -02:00
Alexis S. L. Carvalho
6d99bd2633
Don't generate git patches that rename a file to multiple destinations
...
With this patch, instead of generating N renames, we'll generate
1 rename and N-1 copies.
Ideally the rename should come after the copies instead of before
them, but that'd be harder to do.
2006-11-20 19:32:46 -02:00
Alexis S. L. Carvalho
7f7845c518
handle git patches that rename a file to more than one destination
2006-11-20 19:32:45 -02:00
Alexis S. L. Carvalho
f2de15a6f8
diff: better detection of renames when comparing with the working dir.
2006-11-20 19:32:38 -02:00
Alexis S. L. Carvalho
bc9e70b94a
fix typo in mercurial/patch.py
2006-11-20 19:32:37 -02:00
Alexis S. L. Carvalho
fdbef41b13
renamedbetween: only return (file, node) pairs that exist in the original rev
2006-11-20 19:32:36 -02:00
Alexis S. L. Carvalho
588b7cf1f1
diff: improve detection of renames when diffing across many revisions
2006-11-20 19:32:35 -02:00
Thomas Arendsen Hein
411d64ce3e
white space and line break cleanups
2006-11-17 08:06:54 +01:00
Matt Mackall
0cc86247a3
util: add copyfile function
2006-11-13 13:26:57 -06:00
Brendan Cully
803c7dd950
git patch: create empty added files
2006-10-30 16:10:58 -08:00
Alexis S. L. Carvalho
18fea415ad
add untrusted argument to patch.diffopts
2006-10-26 19:25:45 +02:00
Benoit Boissinot
3f09dfef56
use xrange instead of range
2006-10-19 14:16:51 +02:00
Brendan Cully
c3df18d34b
patch: return list of modified files even when an exception is raised
...
The file list is passed in as an argument and updated in place.
This fixes issue399.
2006-10-18 10:37:34 -07:00
Alexis S. L. Carvalho
38eb833dca
use short hashes with diff -v
2006-10-13 15:34:35 -03:00
Brendan Cully
2b2122f24a
Add popen2 demandload to patch.py, required by diffstat
2006-10-12 16:34:32 -07:00
Brendan Cully
490357d105
Use line length field when extracting git binary patches
2006-10-12 13:39:14 -07:00
Brendan Cully
59b9d3d043
Add git-1.4 binary patch support
2006-10-12 09:17:16 -07:00
Brendan Cully
2b9e1a5fbd
Don't generate git diff header for empty diffs
2006-10-10 14:48:26 -07:00
Benoit Boissinot
b58f394b3c
fix warnings from pychecker
2006-10-02 21:10:31 +02:00
Thomas Arendsen Hein
0a7b982aa6
Whitespace/Tab cleanup
2006-10-01 19:26:33 +02:00
Stephen Darnell
a808384cf1
Add -D/--nodates options to hg diff/export that removes dates from diff headers
...
and replace uses of sed in the tests with --nodates.
2006-09-26 00:05:24 +01:00
Benoit Boissinot
a952c24cfd
fix users of dirstate.copies broken by 2f0cc26377ab
2006-09-26 13:58:58 +02:00
Matt Doar
223e5f58eb
Add support for diffstat in commit emails, and move diffstat from
...
patchbomb to patch
2006-09-13 13:14:08 -07:00
Benoit Boissinot
670858c395
git --diff: fix traceback when getting mode change
...
- use the manifest instead of the mode in the working dir
if the diff is against two revisions
- add a testcase
2006-09-07 14:12:39 +02:00
Benoit Boissinot
c0b915f6a5
unlink temporary patch files even when an exception is raised
2006-09-05 01:11:14 +02:00
Brendan Cully
5d3521d32c
Remove temporary git patch files
2006-08-30 13:42:57 -07:00
Brendan Cully
955a275a1c
Fix git patch application when cwd != repo.root
2006-08-30 13:12:26 -07:00
Vadim Gelfer
0d5df3aaf3
merge.
2006-08-18 17:02:38 -07:00
Giorgos Keramidas
a1e9b12e3d
add missing import of errno
2006-08-17 21:13:35 +03:00
Brendan Cully
16fb95a415
Teach mq about git patches
2006-08-16 19:49:45 -07:00
Brendan Cully
bbf7e4e798
Move import's working dir update code into patch.updatedir
2006-08-16 19:46:18 -07:00
Vadim Gelfer
9614f4bd5b
redo merge with mpm.
...
previous merge at 8c0343e3f2b7 was bad.
2006-08-16 10:52:19 -07:00
Brendan Cully
2709262462
Unify mq and hg patch invocation.
...
This makes patch a little less verbose by default, so the tests
had to be updated.
2006-08-15 11:28:50 -07:00
Matt Mackall
6ecbc46d1a
Move ui.diffopts to patch.diffopts where it belongs
2006-08-15 11:34:08 -05:00
Brendan Cully
c18265f47c
Add diff --git option
2006-08-14 22:48:03 -07:00
Vadim Gelfer
ed05627ce0
fix patch.patch.filterfiles.
...
now test-diff-subdir passes.
2006-08-13 15:24:30 -07:00
Vadim Gelfer
80d6f2f7c7
remove localrepository.changes.
...
use localrepository.status instead.
2006-08-12 16:40:12 -07:00
Vadim Gelfer
13d751feaf
refactor text diff/patch code.
...
rename commands.dodiff to patch.diff.
rename commands.doexport to patch.export.
move some functions from commands to new mercurial.cmdutil module.
turn list of diff options into mdiff.diffopts class.
patch.diff and patch.export now has clean api for call from 3rd party
python code.
2006-08-12 16:13:27 -07:00
Vadim Gelfer
57aab63e91
util: qualify name properly.
2006-08-12 15:41:26 -07:00
Vadim Gelfer
beb26e5257
commands.import: refactor patch parsing into patch.extract.
2006-08-12 13:16:48 -07:00
Vadim Gelfer
2eab8e108e
merge git patch code.
2006-08-12 12:47:18 -07:00
Brendan Cully
81f4208ee0
Remove debugging line
2006-08-11 16:55:48 -07:00
Brendan Cully
4f1b3a83bb
Move patch-related code into its own module.
2006-08-11 15:50:16 -07:00