keyword: fix regressions introduced in d87f3ff904ba stable
authorChristian Ebert <blacktrash@gmx.net>
Sun, 24 Oct 2010 15:11:41 +0100
branchstable
changeset 12844 a1b49b9a0328
parent 12843 8aeb6184b008
child 12845 685d884fd2b6
keyword: fix regressions introduced in d87f3ff904ba - dirstate of overwritten files must be forced to normal with kwexpand/kwshrink, not commit. - recorded files must be weeded before overwriting. - add test cases.
hgext/keyword.py
tests/test-keyword.t
--- a/hgext/keyword.py	Mon Oct 25 23:55:43 2010 +0200
+++ b/hgext/keyword.py	Sun Oct 24 15:11:41 2010 +0100
@@ -205,11 +205,11 @@
 
     def overwrite(self, ctx, candidates, lookup, expand, rekw=False):
         '''Overwrites selected files expanding/shrinking keywords.'''
-        if self.restrict or lookup: # exclude kw_copy
+        if self.restrict or lookup or self.record: # exclude kw_copy
             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)
--- a/tests/test-keyword.t	Mon Oct 25 23:55:43 2010 +0200
+++ b/tests/test-keyword.t	Sun Oct 24 15:11:41 2010 +0100
@@ -440,6 +440,24 @@
   $ hg update -C
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
+record added keyword ignored file
+
+  $ echo '$Id$' > i
+  $ hg add i
+  $ hg --verbose record -d '1 13' -m recignored<<EOF
+  > y
+  > EOF
+  diff --git a/i b/i
+  new file mode 100644
+  examine changes to 'i'? [Ynsfdaq?] 
+  i
+  committed changeset 3:5f40fe93bbdc
+  $ cat i
+  $Id$
+  $ hg -q rollback
+  $ hg forget i
+  $ rm i
+
 Test patch queue repo
 
   $ hg init --mq
@@ -775,8 +793,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