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

login
register
mail settings
Submitter David Schleimer
Date Dec. 4, 2012, 8:58 p.m.
Message ID <7cc8b808bfcb3a282cdc.1354654719@dev010.prn1.facebook.com>
Download mbox | patch
Permalink /patch/17/
State Accepted
Commit 2c2564280900009655d69be3c09e03af3f368d11
Headers show

Comments

David Schleimer - Dec. 4, 2012, 8:58 p.m.
# 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.
Matt Mackall - Dec. 4, 2012, 10:37 p.m.
On Tue, 2012-12-04 at 12:58 -0800, David Schleimer wrote:
> # HG changeset patch
> # User David Schleimer <dschleimer at fb.com>
> # Date 1354654458 28800
> # Node ID 7cc8b808bfcb3a282cdcfeacd73a0583efc4b58a
> # Parent  5b80a205b9a25ef1f6b292c5ded87a8fc73007ec
> graft: explicit current node tracking

The first four here are queued for default, thanks.

Patch

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()