extdiff: enable -I/-X with --patch
Not sure how useful this really is, but it's trivial to add and ignoring the
existing arguments supported seems like a bad UI.
--- a/hgext/extdiff.py Wed Sep 09 21:07:38 2015 -0400
+++ b/hgext/extdiff.py Wed Sep 09 22:27:48 2015 -0400
@@ -223,10 +223,10 @@
dir2 = os.path.join(dir2root, dir2, common_file)
label2 = common_file + rev2
else:
- # XXX: export doesn't support -I/-X like extdiff does
template = 'hg-%h.patch'
cmdutil.export(repo, [repo[node1a].rev(), repo[node2].rev()],
- template=repo.vfs.reljoin(tmproot, template))
+ template=repo.vfs.reljoin(tmproot, template),
+ match=matcher)
label1a = cmdutil.makefilename(repo, template, node1a)
label2 = cmdutil.makefilename(repo, template, node2)
dir1a = repo.vfs.reljoin(tmproot, label1a)
--- a/mercurial/cmdutil.py Wed Sep 09 21:07:38 2015 -0400
+++ b/mercurial/cmdutil.py Wed Sep 09 22:27:48 2015 -0400
@@ -992,7 +992,7 @@
os.unlink(tmpname)
def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
- opts=None):
+ opts=None, match=None):
'''export changesets as hg patches.'''
total = len(revs)
@@ -1043,7 +1043,7 @@
write(ctx.description().rstrip())
write("\n\n")
- for chunk, label in patch.diffui(repo, prev, node, opts=opts):
+ for chunk, label in patch.diffui(repo, prev, node, match, opts=opts):
write(chunk, label=label)
if shouldclose:
--- a/tests/test-graft.t Wed Sep 09 21:07:38 2015 -0400
+++ b/tests/test-graft.t Wed Sep 09 22:27:48 2015 -0400
@@ -363,6 +363,22 @@
++a
[1]
+ $ hg extdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
+ --- */hg-5c095ad7e90f.patch * +0000 (glob)
+ +++ */hg-7a4785234d87.patch * +0000 (glob)
+ @@ -1,8 +1,8 @@
+ # HG changeset patch
+ -# User test
+ +# User foo
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
+ -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
+ +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
+ +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
+ 2
+
+ [1]
Disallow grafting already grafted csets with the same origin onto each other
$ hg up -q 13