Fix regressions introduced in 9d01f9cab5e2
authorChristian Ebert <blacktrash@gmx.net>
Mon, 25 Oct 2010 19:21:06 +0100
changeset 846 d565787a8a5d
parent 845 42c5129e9c66
child 847 1a00e2718cde
child 848 3e57838f5434
Fix regressions introduced in 9d01f9cab5e2 - dirstate of overwritten files must be forced to normal with kwexpand/kwshrink, not commit. - recorded files must be weeded before overwriting. - add test cases.
hgkw/keyword.py
tests/test-keyword.t
--- a/hgkw/keyword.py	Wed Oct 20 22:46:09 2010 +0100
+++ b/hgkw/keyword.py	Mon Oct 25 19:21:06 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	Wed Oct 20 22:46:09 2010 +0100
+++ b/tests/test-keyword.t	Mon Oct 25 19:21:06 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