# HG changeset patch # User Matt Harbison # Date 2015-09-10 02:27:48 # Node ID d1530c6e8613cc5b2e993ba639b30abda7aed80c # Parent 0fd20a71abdb7b352df9cc0ea12282a3288012b9 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. diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -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) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -992,7 +992,7 @@ def tryimportone(ui, repo, hunk, parents 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.p 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: diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -363,6 +363,22 @@ Disallow grafting an already grafted cse ++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