[PATCH 1 of 3] export: add 'Amends' hgpatchheader line

Matthew Turk matthewturk at gmail.com
Thu Nov 21 16:33:28 CST 2013


# HG changeset patch
# User Matthew Turk <matthewturk at gmail.com>
# Date 1385069336 18000
#      Thu Nov 21 16:28:56 2013 -0500
# Node ID 4c14c3925a004ef7036715ec954c9695cdb05783
# Parent  986d09e696ff83def479a2e7adb237131d10dc09
export: add 'Amends' hgpatchheader line

If 'amend_source' is found, the patch is an amend.  This adds the amend_source
key to the exported patch, which will subsequently be ignored in patch.extract.

diff -r 986d09e696ff -r 4c14c3925a00 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Thu Nov 21 12:47:03 2013 -0800
+++ b/mercurial/cmdutil.py	Thu Nov 21 16:28:56 2013 -0500
@@ -555,6 +555,7 @@
         node = ctx.node()
         parents = [p.node() for p in ctx.parents() if p]
         branch = ctx.branch()
+        extras = ctx.extra()
         if switch_parent:
             parents.reverse()
         prev = (parents and parents[0]) or nullid
@@ -588,6 +589,8 @@
         write("# Parent  %s\n" % hex(prev))
         if len(parents) > 1:
             write("# Parent  %s\n" % hex(parents[1]))
+        if 'amend_source' in extras:
+            write("# Amends  %s\n" % extras['amend_source'])
         write(ctx.description().rstrip())
         write("\n\n")
 


More information about the Mercurial-devel mailing list