[PATCH 2 of 2] graft: implement --log (issue3438)

Levi Bard taktaktaktaktaktaktaktaktaktak at gmail.com
Fri May 11 11:57:11 CDT 2012


# HG changeset patch
# User Levi Bard <levi at unity3d.com>
# Date 1336755157 -7200
# Node ID eae6ee88d462227a11ac5dc0134f4bb0517aadb7
# Parent  d6e083fc7d57ee09f9ce6f21b4d6c51295adc98f
graft: implement --log (issue3438)

diff -r d6e083fc7d57 -r eae6ee88d462 mercurial/commands.py
--- a/mercurial/commands.py	Fri May 11 18:51:35 2012 +0200
+++ b/mercurial/commands.py	Fri May 11 18:52:37 2012 +0200
@@ -2553,6 +2553,7 @@
     'graft',
     [('c', 'continue', False, _('resume interrupted graft')),
      ('e', 'edit', False, _('invoke editor on commit messages')),
+     ('', 'log', None, _('append graft info to log message')),
      ('D', 'currentdate', False,
       _('record the current date as commit date')),
      ('U', 'currentuser', False,
@@ -2571,6 +2572,11 @@
     Changesets that are ancestors of the current revision, that have
     already been grafted, or that are merges will be skipped.
 
+    If --log is specified, log messages will have a comment appended
+    of the form::
+
+      (grafted from CHANGESETHASH)
+
     If a graft merge results in conflicts, the graft process is
     interrupted so that the current merge can be manually resolved.
     Once all conflicts are addressed, the graft process can be
@@ -2720,7 +2726,10 @@
             date = ctx.date()
             if opts.get('date'):
                 date = opts['date']
-            node = repo.commit(text=ctx.description(), user=user,
+            message = ctx.description()
+            if opts.get('log'):
+                message += '\n(grafted from %s)' % ctx.hex()
+            node = repo.commit(text=message, user=user,
                         date=date, extra=extra, editor=editor)
             if node is None:
                 ui.status(_('graft for revision %s is empty\n') % ctx.rev())


More information about the Mercurial-devel mailing list