changeset 12684:8348599c68d7

keyword: fix weeding of expansion candidates when recording Rearrange tests to check this, i.e. that there are changes in other files, not only the recorded one.
author Christian Ebert <blacktrash@gmx.net>
date Sun, 10 Oct 2010 00:30:09 +0100
parents ada47c38f4e5
children a247751652ba
files hgext/keyword.py tests/test-keyword.t
diffstat 2 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/keyword.py	Sun Oct 10 09:48:37 2010 -0500
+++ b/hgext/keyword.py	Sun Oct 10 00:30:09 2010 +0100
@@ -574,8 +574,9 @@
             ret = orig(ui, repo, commitfunc, *pats, **opts)
             recctx = repo['.']
             if ctx != recctx:
-                modified = [f for f in modified if f in recctx]
-                added = [f for f in added if f in recctx]
+                changed = recctx.files()
+                modified = [f for f in modified if f in changed]
+                added = [f for f in added if f in changed]
                 kwt.restrict = False
                 kwt.overwrite(recctx, modified, False, True, kwt.re_kwexp.subn)
                 kwt.overwrite(recctx, added, False, True, kwt.re_kw.subn)
--- a/tests/test-keyword.t	Sun Oct 10 09:48:37 2010 -0500
+++ b/tests/test-keyword.t	Sun Oct 10 00:30:09 2010 +0100
@@ -291,11 +291,16 @@
   $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
   tests for different changenodes
 
+record
+
+  $ echo '$Id$' > r
+  $ hg add r
+
 record chunk
 
   $ python -c \
   > 'l=open("a").readlines();l.insert(1,"foo\n");l.append("bar\n");open("a","w").writelines(l);'
-  $ hg record -d '1 10' -m rectest<<EOF
+  $ hg record -d '1 10' -m rectest a<<EOF
   > y
   > y
   > n
@@ -319,6 +324,7 @@
   d17e03c92c97+ tip
   $ hg status
   M a
+  A r
 
 Cat modified file a
 
@@ -331,7 +337,7 @@
 
 Diff remaining chunk
 
-  $ hg diff
+  $ hg diff a
   diff -r d17e03c92c97 a
   --- a/a	Wed Dec 31 23:59:51 1969 -0000
   +++ b/a	* (glob)
@@ -350,7 +356,7 @@
 
  - do not use "hg record -m" here!
 
-  $ hg record -l msg -d '1 11'<<EOF
+  $ hg record -l msg -d '1 11' a<<EOF
   > y
   > y
   > y
@@ -415,13 +421,8 @@
   $ hg forget y z
   $ rm y z
 
-  $ hg update -C
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+record added file alone
 
-record added file
-
-  $ echo '$Id$' > r
-  $ hg add r
   $ hg -v record -l msg -d '1 12' r<<EOF
   > y
   > EOF
@@ -436,6 +437,8 @@
   overwriting r shrinking keywords
   $ hg forget r
   $ rm msg r
+  $ hg update -C
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Test patch queue repo