[PATCH 3 of 3] extdiff: enable -I/-X with --patch
Augie Fackler
raf at durin42.com
Thu Sep 10 08:38:36 CDT 2015
On Wed, Sep 09, 2015 at 11:25:05PM -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1441852068 14400
> # Wed Sep 09 22:27:48 2015 -0400
> # Node ID c6623927cd32a3e4629803cb923bdeef74412e6d
> # Parent fa2dc3e1d7718b7a2803f7384b9b423a1ffdae83
> extdiff: enable -I/-X with --patch
Seems like a nice enhancement, perhaps also suitable for just 'hg
diff' (even if diff-of-diff is mind-altering at times.)
I want mpm and/or marmoute to look at it too though.
>
> 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 @@
> 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 @@
> 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:
> 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 @@
> ++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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list