Patchwork [2,of,4,STABLE] keyword: use parent of working copy as base for status

login
register
mail settings
Submitter Martin von Zweigbergk
Date Oct. 23, 2014, 9:27 p.m.
Message ID <066f1db71b729c05d744.1414099642@handduk2.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6451/
State Superseded
Headers show

Comments

Martin von Zweigbergk - Oct. 23, 2014, 9:27 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1414095457 25200
#      Thu Oct 23 13:17:37 2014 -0700
# Branch stable
# Node ID 066f1db71b729c05d74418e214d21b377f51c396
# Parent  47c820255552a450adf81209fa61cd8ccd8792b0
keyword: use parent of working copy as base for status

Instead of calling repo[None].status(), use the more common form that
uses the parent of the working copy as the base:
repo['.'].status(). Note that the former defaults to comparing to
revision '.', while the latter defaults to revision None, so the
contexts being compared are the same.

It might seem like this would result in a reverse diff, but it turns
out that workingctx.status() incorrectly reverses the result. That bug
will be fixed in a later commit.

Patch

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -619,7 +619,7 @@ 
                 ret = super(kwrepo, self).rollback(dryrun, force)
                 if not dryrun:
                     ctx = self['.']
-                    modified, added = _preselect(self[None].status(), changed)
+                    modified, added = _preselect(ctx.status(), changed)
                     kwt.overwrite(ctx, modified, True, True)
                     kwt.overwrite(ctx, added, True, False)
                 return ret
@@ -702,7 +702,7 @@ 
             # therefore compare nodes before and after
             kwt.postcommit = True
             ctx = repo['.']
-            wstatus = repo[None].status()
+            wstatus = ctx.status()
             ret = orig(ui, repo, commitfunc, *pats, **opts)
             recctx = repo['.']
             if ctx != recctx: