# HG changeset patch # User FUJIWARA Katsunori # Date 2014-06-05 07:47:13 # Node ID 99f7e5fe35f269708a29a9d9b9ca6c6a4b308b09 # Parent dedb68a9532cafde83ccafee1ef2c1e6b02ac189 keyword: suppress keyword expansion while 'hg unshelve' for internal merge Before this patch, 'hg unshelve' may cause unexpected conflict, if 'hg unshelve'-ed changes are located near lines in which keywords are embedded, because keywords are substituted with other strings in the working directory. This patch suppresses keyword expansion while 'hg unshelve' for internal merge by adding 'unshelve' to 'restricted' command list like 'merge'. diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -102,7 +102,8 @@ nokwcommands = ('add addremove annotate # hg commands that trigger expansion only when writing to working dir, # not when reading filelog, and unexpand when reading from working dir -restricted = 'merge kwexpand kwshrink record qrecord resolve transplant' +restricted = ('merge kwexpand kwshrink record qrecord resolve transplant' + ' unshelve') # names of extensions using dorecord recordextensions = 'record' diff --git a/tests/test-keyword.t b/tests/test-keyword.t --- a/tests/test-keyword.t +++ b/tests/test-keyword.t @@ -1137,6 +1137,7 @@ Keywords shrunk in working directory, bu Now disable keyword expansion + $ cp $HGRCPATH $HGRCPATH.backup $ rm "$HGRCPATH" $ cat a b expand $Id$ @@ -1152,4 +1153,50 @@ Now disable keyword expansion ignore $Id$ a +enable keyword expansion again + + $ cat $HGRCPATH.backup >> $HGRCPATH + +Test restricted mode with unshelve + + $ cat <> $HGRCPATH + > [extensions] + > shelve = + > EOF + + $ echo xxxx >> a + $ hg diff + diff -r 800511b3a22d a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a * (glob) + @@ -2,3 +2,4 @@ + do not process $Id: + xxx $ + $Xinfo$ + +xxxx + $ hg shelve -q --name tmp + $ hg shelve --list --patch + tmp (*) changes to 'localresolve' (glob) + + diff --git a/a b/a + --- a/a + +++ b/a + @@ -2,3 +2,4 @@ + do not process $Id: + xxx $ + $Xinfo$ + +xxxx + + $ hg update -q -C 10 + $ hg unshelve -q tmp + $ hg diff + diff -r 4aa30d025d50 a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a * (glob) + @@ -3,3 +3,4 @@ + do not process $Id: + xxx $ + $Xinfo$ + +xxxx + $ cd ..