[PATCH stable] keyword: fix regression introduced in d87f3ff904ba

Christian Ebert blacktrash at gmx.net
Sat Oct 23 20:50:39 CDT 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1287885034 -3600
# Branch stable
# Node ID e0070eab7953105dcd1b65a4a88e0cd3721def28
# Parent  5082e2f3f8e02d73ca05b6ab989c49d5be73f50f
keyword: fix regression introduced in d87f3ff904ba

dirstate of overwritten files must be forced to normal
with kwexpand/kwshrink, not commit.
Add test for both cases.

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -209,7 +209,7 @@
             candidates = self.iskwfile(candidates, ctx)
         if not candidates:
             return
-        commit = self.restrict and not lookup
+        kwcmd = self.restrict and lookup # kwexpand/kwshrink
         if self.restrict or expand and lookup:
             mf = ctx.manifest()
         fctx = ctx
@@ -234,7 +234,7 @@
             if found:
                 self.ui.note(msg % f)
                 self.repo.wwrite(f, data, ctx.flags(f))
-                if commit:
+                if kwcmd:
                     self.repo.dirstate.normal(f)
                 elif self.record:
                     self.repo.dirstate.normallookup(f)
diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -775,8 +775,12 @@
 
   $ mkdir x
   $ hg copy a x/a
+  $ hg --verbose kwshrink a
+  overwriting a shrinking keywords
+  $ hg status a
   $ hg --verbose kwexpand a
   overwriting a expanding keywords
+  $ hg status a
 
 kwexpand x/a should abort
 


More information about the Mercurial-devel mailing list