# HG changeset patch # User Christian Ebert # Date 1200320517 -3600 # Node ID 98336da24c5e03c2c43b27915e565a1c680a62b2 # Parent 578317f9e2f039f4e8ba500c185e76f9059a6303 (0.9.2compat) get changes from default branch diff -r 578317f9e2f0 -r 98336da24c5e hgkw/keyword.py --- a/hgkw/keyword.py Wed Jan 09 18:17:23 2008 +0100 +++ b/hgkw/keyword.py Mon Jan 14 15:21:57 2008 +0100 @@ -1,6 +1,6 @@ # keyword.py - $Keyword$ expansion for Mercurial # -# Copyright 2007 Christian Ebert +# Copyright 2007, 2008 Christian Ebert # # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. @@ -263,9 +263,8 @@ def process(self, node, data, expand): '''Returns a tuple: data, count. - Count is number of keywords/keyword substitutions, indicates - to caller whether to act on file containing data. - Keywords in data are expanded, if templater was initialized.''' + Count is number of keywords/keyword substitutions, + telling caller whether to act on file containing data.''' if util.binary(data): return data, None if expand: @@ -288,8 +287,7 @@ _kwtemplater.path = path def kwctread(self, node, expand): - '''Reads expanding and counting keywords - (only called from kwtemplater.overwrite).''' + '''Reads expanding and counting keywords, called from _overwrite.''' data = super(kwfilelog, self).read(node) return _kwtemplater.process(node, data, expand) diff -r 578317f9e2f0 -r 98336da24c5e tests/test-keyword --- a/tests/test-keyword Wed Jan 09 18:17:23 2008 +0100 +++ b/tests/test-keyword Mon Jan 14 15:21:57 2008 +0100 @@ -45,7 +45,7 @@ echo % default keyword expansion including commit hook #echo % interrupted commit should not change state or run commit hook -#HGEDITOR=false hg --debug commit +#hg --debug commit #echo % status #hg status @@ -80,6 +80,19 @@ echo % cat cat a b +echo % check whether expansion is filewise +echo '$Id$' > c +echo 'tests for different changenodes' >> c +echo % commit c +hg commit -A -mcndiff -d '1 0' -u 'User Name ' +echo % force expansion +hg -v kwexpand +echo % compare changenodes in a c +cat a c +echo % rollback and remove c +hg rollback +rm c + echo % copy hg cp a c @@ -130,9 +143,8 @@ secondline EOF -#echo % interrupted commit -## redirection and grep for backwards compatibility -#HGEDITOR=false hg commit 2>&1 | grep -v 'edit failed:' +#echo % interrupted commit should not change state +#hg commit #echo % status #hg status @@ -206,7 +218,7 @@ hg --verbose kwshrink a echo % cat a cat a -cd - > /dev/null 2>&1 +cd .. echo % kwexpand nonexistent hg kwexpand nonexistent diff -r 578317f9e2f0 -r 98336da24c5e tests/test-keyword.out --- a/tests/test-keyword.out Wed Jan 09 18:17:23 2008 +0100 +++ b/tests/test-keyword.out Mon Jan 14 15:21:57 2008 +0100 @@ -109,6 +109,20 @@ do not process $Id: xxx $ ignore $Id$ +% check whether expansion is filewise +% commit c +adding c +% force expansion +overwriting a expanding keywords +overwriting c expanding keywords +% compare changenodes in a c +expand $Id: a,v 7f0665a496fd 1970/01/01 00:00:00 user $ +do not process $Id: +xxx $ +$Id: c,v 7fefeeacf359 1970/01/01 00:00:01 user $ +tests for different changenodes +% rollback and remove c +rolling back last transaction % copy % kwfiles added a