[PATCH 4 of 5 v3] graft: explicit current node tracking

David Schleimer dschleimer at fb.com
Tue Dec 4 14:58:39 CST 2012


# HG changeset patch
# User David Schleimer <dschleimer at fb.com>
# Date 1354654458 28800
# Node ID 7cc8b808bfcb3a282cdcfeacd73a0583efc4b58a
# Parent  5b80a205b9a25ef1f6b292c5ded87a8fc73007ec
graft: explicit current node tracking

This changes graft to explicitly track the progression of commits it
makes, and updates it's idea of the current node based on it's last
commit, rather than from the working copy parent.  This should have no
effect on the value of current since we were reading the working copy
parent immediately after commiting to it.

The motivation for this change is that a subsequent patch will break
the current node and working copy relationship.  Splitting this out
into a separate patch will make that one more readible.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2830,8 +2830,8 @@
 
     wlock = repo.wlock()
     try:
+        current = repo['.']
         for pos, ctx in enumerate(repo.set("%ld", revs)):
-            current = repo['.']
 
             ui.status(_('grafting revision %s\n') % ctx.rev())
             if opts.get('dry_run'):
@@ -2883,6 +2883,8 @@
                         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()
 


More information about the Mercurial-devel mailing list