changeset 22903:3d51e756b1ec

graft: use merge.graft
author Matt Mackall <mpm@selenic.com>
date Mon, 13 Oct 2014 17:12:31 -0500
parents ce0592328d68
children baa3cfa03a83
files mercurial/commands.py
diffstat 1 files changed, 2 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Oct 13 17:12:12 2014 -0500
+++ b/mercurial/commands.py	Mon Oct 13 17:12:31 2014 -0500
@@ -3454,7 +3454,6 @@
 
     wlock = repo.wlock()
     try:
-        current = repo['.']
         for pos, ctx in enumerate(repo.set("%ld", revs)):
 
             ui.status(_('grafting revision %s\n') % ctx.rev())
@@ -3482,16 +3481,8 @@
                     # ui.forcemerge is an internal variable, do not document
                     repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
                                       'graft')
-                    stats = mergemod.update(repo, ctx.node(), True, True, False,
-                                            ctx.p1().node(),
-                                            labels=['local', 'graft'])
-                    # drop the second merge parent
-                    repo.dirstate.beginparentchange()
-                    repo.setparents(current.node(), nullid)
-                    repo.dirstate.write()
-                    # fix up dirstate for copies and renames
-                    copies.duplicatecopies(repo, ctx.rev(), ctx.p1().rev())
-                    repo.dirstate.endparentchange()
+                    stats = mergemod.graft(repo, ctx, ctx.p1(),
+                                           ['local', 'graft'])
                 finally:
                     repo.ui.setconfig('ui', 'forcemerge', '', 'graft')
                 # report any conflicts
@@ -3510,8 +3501,6 @@
                         date=date, extra=extra, editor=editor)
             if node is None:
                 ui.status(_('graft for revision %s is empty\n') % ctx.rev())
-            else:
-                current = repo[node]
     finally:
         wlock.release()