[PATCH 2 of 2] keyword: disable expansion in queue repos
Christian Ebert
blacktrash at gmx.net
Tue Feb 5 09:46:30 UTC 2008
# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1202204345 -3600
# Node ID f353e28a5af56ed5eb4c7a1c92f43657b0472308
# Parent 0e8fed312e6e506fe8bc584455d7e635729b3157
keyword: disable expansion in queue repos
Prevent global [keyword] filename patterns creating expansion
havoc in versioned mq repos.
Add test with qcommit.
diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -5,7 +5,7 @@
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
#
-# $Id: keyword.py,v 0e8fed312e6e 2008-02-05 06:52 +0100 blacktrash $
+# $Id: keyword.py,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
#
# Keyword expansion hack against the grain of a DSCM
#
@@ -410,7 +410,7 @@
This is done for local repos only, and only if there are
files configured at all for keyword substitution.'''
- if not repo.local():
+ if not repo.local() or repo.root.endswith('/.hg/patches'):
return
hgcmd, func, args, opts, cmdopts = dispatch._parse(ui, sys.argv[1:])
diff --git a/tests/test-keyword b/tests/test-keyword
--- a/tests/test-keyword
+++ b/tests/test-keyword
@@ -30,10 +30,10 @@
echo % kwshrink should exit silently in empty/invalid repo
hg kwshrink
-echo 'expand $Id: test-keyword,v e181665c1c79 2008-01-19 03:06 +0100 blacktrash $' > a
+echo 'expand $Id: test-keyword,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $' > a
echo 'do not process $Id:' >> a
echo 'xxx $' >> a
-echo 'ignore $Id: test-keyword,v e181665c1c79 2008-01-19 03:06 +0100 blacktrash $' > b
+echo 'ignore $Id: test-keyword,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $' > b
ln -s a sym
echo % cat
cat sym a b
@@ -81,7 +81,7 @@
cat sym a b
echo % check whether expansion is filewise
-echo '$Id: test-keyword,v e181665c1c79 2008-01-19 03:06 +0100 blacktrash $' > c
+echo '$Id: test-keyword,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $' > c
echo 'tests for different changenodes' >> c
echo % commit c
hg commit -A -mcndiff -d '1 0' -u 'User Name <user at example.com>'
@@ -90,8 +90,12 @@
echo % compare changenodes in a c
cat a c
+echo % qinit -c
+hg qinit -c
echo % qimport
hg qimport -r tip -n mqtest.diff
+echo % qcommit
+hg qcommit -mqtest
echo % keywords should not be expanded in patch
cat .hg/patches/mqtest.diff
echo % qpop
diff --git a/tests/test-keyword.out b/tests/test-keyword.out
--- a/tests/test-keyword.out
+++ b/tests/test-keyword.out
@@ -72,7 +72,7 @@
$Header: /TMP/demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
$Source: /TMP/demo.txt,v $
$Date: 2000/00/00 00:00:00 $
-$Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+$Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
$Revision: xxxxxxxxxxxx $
[extensions]
hgext.keyword =
@@ -85,13 +85,13 @@
$Branch: demobranch $
% kwshrink should exit silently in empty/invalid repo
% cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
% addremove
adding a
adding b
@@ -123,18 +123,18 @@
% identify
f782df5f9602
% cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
% hg cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
a
% diff a hooktest
% removing commit hook from config
@@ -143,13 +143,13 @@
% update
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
% check whether expansion is filewise
% commit c
adding c
@@ -157,12 +157,14 @@
overwriting a expanding keywords
overwriting c expanding keywords
% compare changenodes in a c
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-$Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+$Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
tests for different changenodes
+% qinit -c
% qimport
+% qcommit
% keywords should not be expanded in patch
# HG changeset patch
# User User Name <user at example.com>
@@ -175,7 +177,7 @@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/c Thu Jan 01 00:00:01 1970 +0000
@@ -0,0 +1,2 @@
-+$Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
++$Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
+tests for different changenodes
% qpop
Patch queue now empty
@@ -183,7 +185,7 @@
applying mqtest.diff
Now at: mqtest.diff
% cat
-$Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+$Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
tests for different changenodes
% qpop and move on
Patch queue now empty
@@ -196,10 +198,10 @@
c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
overwriting c expanding keywords
% cat a c
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
% touch copied c after 1 second
@@ -211,7 +213,7 @@
diff -r f782df5f9602 c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,3 @@
-+expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
++expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
+do not process $Id:
+xxx $
% rollback
@@ -232,18 +234,18 @@
Xinfo = {author}: {desc}
$Xinfo: test: hg keyword config and expansion example $
% cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
% hg cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
a
% interrupted commit should not change state
transaction abort!
@@ -257,21 +259,21 @@
overwriting a expanding keywords
% status
% cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo: User Name <user at example.com>: firstline $
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo: User Name <user at example.com>: firstline $
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
% hg cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo: User Name <user at example.com>: firstline $
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
a
% remove
% status
@@ -281,7 +283,7 @@
R a
% revert a
% cat a
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo: User Name <user at example.com>: firstline $
@@ -308,15 +310,15 @@
% import
applying ../rejecttest.diff
% cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $ rejecttest
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $ rejecttest
do not process $Id: rejecttest
xxx $
$Xinfo: User Name <user at example.com>: rejects? $
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $ rejecttest
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $ rejecttest
do not process $Id: rejecttest
xxx $
$Xinfo: User Name <user at example.com>: rejects? $
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
% rollback
rolling back last transaction
@@ -332,14 +334,14 @@
x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
overwriting x/a expanding keywords
% cat a
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo: User Name <user at example.com>: xa $
% kwshrink a inside directory x
overwriting x/a shrinking keywords
% cat a
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo$
@@ -350,36 +352,36 @@
overwriting a shrinking keywords
overwriting x/a shrinking keywords
% cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo$
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo$
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
% hg cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo: User Name <user at example.com>: firstline $
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
a
% cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo$
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo$
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
% hg cat
-expand $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+expand $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
do not process $Id:
xxx $
$Xinfo$
-ignore $Id: test-keyword.out,v ffaf2419de44 2008-01-08 22:40 -0500 jesse $
+ignore $Id: test-keyword.out,v f353e28a5af5 2008-02-05 10:39 +0100 blacktrash $
a
More information about the Mercurial-devel
mailing list