[PATCH] graft: allow to not preserve original source in subsequent grafts

Alexander Drozdov al.drozdov at gmail.com
Mon Mar 31 22:24:38 CDT 2014


# HG changeset patch
# User Alexander Drozdov <al.drozdov at gmail.com>
# Date 1393909791 -14400
#      Tue Mar 04 09:09:51 2014 +0400
# Node ID e7b0eaf7bbbd35d5cc0b1415014749d4b8e533d0
# Parent  8a6a86c9a5b58ccc020de1ff0429e72dfa5599fc
graft: allow to not preserve original source in subsequent grafts

>From dc9fb7015d7f, graft preserves original source when grafting
changeset that was grafted from another branch.

That may be undesirable in some situations. For example, the first
graft may be from user's private branch, so the source changeset may
not be present in a public repository.

This changeset adds -S (--currentsource) option to always refer to
grafted changeset as a source revision.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3036,6 +3036,8 @@
      ('', 'log', None, _('append graft info to log message')),
      ('D', 'currentdate', False,
       _('record the current date as commit date')),
+     ('S', 'currentsource', False,
+      _('do not refer to original source for subsequent graft')),
      ('U', 'currentuser', False,
       _('record the current user as committer'), _('DATE'))]
     + commitopts2 + mergetoolopts  + dryrunopts,
@@ -3181,7 +3183,9 @@
             if opts.get('dry_run'):
                 continue
 
-            source = ctx.extra().get('source')
+            source = None
+            if not opts.get('currentsource'):
+                source = ctx.extra().get('source')
             if not source:
                 source = ctx.hex()
             extra = {'source': source}


More information about the Mercurial-devel mailing list