Merge with stable
authorMartin Geisler <mg@lazybytes.net>
Wed, 23 Dec 2009 18:04:57 +0100
changeset 10118 333193c025ad
parent 10115 c23626384b7e (current diff)
parent 10117 98867145f4b5 (diff)
child 10119 bb5ea66789e3
Merge with stable
hgext/keyword.py
--- a/hgext/keyword.py	Wed Dec 23 13:12:36 2009 +0100
+++ b/hgext/keyword.py	Wed Dec 23 18:04:57 2009 +0100
@@ -93,7 +93,8 @@
 
 # hg commands that trigger expansion only when writing to working dir,
 # not when reading filelog, and unexpand when reading from working dir
-restricted = 'merge record resolve qfold qimport qnew qpush qrefresh qrecord'
+restricted = ('merge record resolve qfold qimport qnew qpush qrefresh qrecord'
+              ' transplant')
 
 # provide cvs-like UTC date filter
 utcdate = lambda x: util.datestr(x, '%Y/%m/%d %H:%M:%S')
@@ -537,7 +538,8 @@
     repo.__class__ = kwrepo
 
     extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init)
-    extensions.wrapfunction(patch, 'diff', kw_diff)
+    if not kwt.restrict:
+        extensions.wrapfunction(patch, 'diff', kw_diff)
     for c in 'annotate changeset rev filediff diff'.split():
         extensions.wrapfunction(webcommands, c, kwweb_skip)
 
--- a/tests/test-keyword	Wed Dec 23 13:12:36 2009 +0100
+++ b/tests/test-keyword	Wed Dec 23 18:04:57 2009 +0100
@@ -5,6 +5,7 @@
 hgext.keyword =
 hgext.mq =
 hgext.notify =
+hgext.transplant =
 EOF
 
 # demo before [keyword] files are set up
@@ -337,6 +338,23 @@
 hg commit -m localresolve
 cat m
 
+echo % test restricted mode with transplant -b
+hg update 6
+hg branch foo
+mv a a.bak
+echo foobranch > a
+cat a.bak >> a
+rm a.bak
+hg commit -m 9foobranch
+hg update default
+hg -y transplant -b foo tip
+echo % no expansion in changeset
+hg tip -p
+echo % expansion in file
+head -n 2 a
+hg -q rollback
+hg -q update -C
+
 echo % switch off expansion
 echo % kwshrink with unknown file u
 cp a u
--- a/tests/test-keyword.out	Wed Dec 23 13:12:36 2009 +0100
+++ b/tests/test-keyword.out	Wed Dec 23 18:04:57 2009 +0100
@@ -420,6 +420,33 @@
 % resolve to local
 $Id: m 43dfd2854b5b Thu, 01 Jan 1970 00:00:00 +0000 test $
 bar
+% test restricted mode with transplant -b
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+marked working directory as branch foo
+created new head
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+applying 1c4378f51c4d
+1c4378f51c4d transplanted to 7d855abcab87
+% no expansion in changeset
+changeset:   11:7d855abcab87
+tag:         tip
+parent:      9:43dfd2854b5b
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     9foobranch
+
+diff -r 43dfd2854b5b -r 7d855abcab87 a
+--- a/a	Thu Jan 01 00:00:00 1970 +0000
++++ b/a	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,3 +1,4 @@
++foobranch
+ expand $Id$
+ do not process $Id:
+ xxx $
+
+% expansion in file
+foobranch
+expand $Id: a 7d855abcab87 Thu, 01 Jan 1970 00:00:00 +0000 test $
 % switch off expansion
 % kwshrink with unknown file u
 overwriting a shrinking keywords