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