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.
This commit is contained in:
Matt Harbison 2015-09-09 22:27:48 -04:00
parent c3b634a166
commit 99ffdaafef
3 changed files with 20 additions and 4 deletions

View File

@ -223,10 +223,10 @@ def dodiff(ui, repo, cmdline, pats, opts):
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)

View File

@ -992,7 +992,7 @@ def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc):
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 @@ def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
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:

View File

@ -363,6 +363,22 @@ Disallow grafting an already grafted cset onto its original branch
++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