Patchwork [5,of,6,STABLE] keyword: suppress keyword expansion while 'hg histedit' for internal merge

login
register
mail settings
Submitter Katsunori FUJIWARA
Date June 5, 2014, 7:52 a.m.
Message ID <c6842a36e5778ae31174.1401954725@juju>
Download mbox | patch
Permalink /patch/4931/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - June 5, 2014, 7:52 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1401954434 -32400
#      Thu Jun 05 16:47:14 2014 +0900
# Branch stable
# Node ID c6842a36e5778ae3117402d505af8a54fb81beb5
# Parent  bd7d7ff223b97a722b173fb76efa6dcd08b0bc94
keyword: suppress keyword expansion while 'hg histedit' for internal merge

Before this patch, 'hg histedit' may cause unexpected conflict, if 'hg
histedit'-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 histedit' for
internal merge by adding 'histedit' to 'restricted' command list like
'merge'.

Test in this patch just swaps order of revision #13 and #14: this is
enough to cause internal merge.

Patch

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -103,7 +103,7 @@  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'
-              ' unshelve rebase graft backout')
+              ' unshelve rebase graft backout histedit')
 
 # 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
@@ -1271,4 +1271,17 @@  Test restricted mode with backout
    $Xinfo$
   -xxxx
 
+Test restricted mode with histedit
+
+  $ cat <<EOF >> $HGRCPATH
+  > [extensions]
+  > histedit =
+  > EOF
+
+  $ hg commit -m 'backout #11'
+  $ hg histedit -q --command - 13 <<EOF
+  > pick 49f5f2d940c3 14 backout #11
+  > pick 01a68de1003a 13 9foobranch
+  > EOF
+
   $ cd ..