# HG changeset patch # User Christian Ebert # Date 1172314568 -3600 # Node ID 5f3856a6ce5694f1fd42625fee65f1b94e140120 # Parent ba5cb61db7a0a989bfed19f67f266bd8f5c568fd Extend test for archive mode diff -r ba5cb61db7a0 -r 5f3856a6ce56 tests/test-keyword --- a/tests/test-keyword Sat Feb 24 11:19:34 2007 +0100 +++ b/tests/test-keyword Sat Feb 24 11:56:08 2007 +0100 @@ -6,6 +6,7 @@ [keyword] a = b = ignore +c = archive EOF echo % help @@ -15,27 +16,36 @@ cd Test echo 'expand $Id$' > a echo 'ignore $Id$' > b +echo 'archive $Id$' > c ln -s a sym echo % cat -cat sym a b +cat a b c sym echo % default keyword expansion echo % commit -hg --debug commit -A -mabsym -d '0 0' -u 'User Name ' +hg --debug commit -A -mabcsym -d '0 0' -u 'User Name ' echo % status hg status echo % cat -cat sym a b +cat a b c sym echo % hg cat -hg cat sym a b +hg cat a b c sym echo -rm sym a b +rm a b c sym echo % update hg update echo % cat -cat sym a b +cat a b c sym + +echo % archive +hg archive ../Archive +cd ../Archive +echo % cat +cat a b c sym +echo +cd - echo % custom keyword expansion cat <>$HGRCPATH @@ -45,9 +55,9 @@ EOF echo % cat -cat sym a b +cat a b c sym echo % hg cat -hg cat sym a b +hg cat a b c sym echo echo '$Xinfo$' >> a @@ -63,9 +73,9 @@ hg status echo % cat -cat sym a b +cat a b c sym echo % hg cat -hg cat sym a b +hg cat a b c sym echo cd .. @@ -83,14 +93,14 @@ cd ../Test echo % cat -cat sym a b +cat a b c sym echo % hg cat -hg cat sym a b +hg cat a b c sym echo echo % update -rm sym a b +rm a b c sym hg update echo % cat -cat sym a b +cat a b c sym diff -r ba5cb61db7a0 -r 5f3856a6ce56 tests/test-keyword.out --- a/tests/test-keyword.out Sat Feb 24 11:19:34 2007 +0100 +++ b/tests/test-keyword.out Sat Feb 24 11:56:08 2007 +0100 @@ -8,8 +8,10 @@ Mercurial internally. The mechanism can be regarded as a convenience for the current user and may be turned off anytime. -Substitution takes place on every commit and update of the working -repository. +The exansion works in 2 modes: + 1) working mode: substitution takes place on every commit and + update of the working repository. + 2) archive mode: substitution is only triggered by "hg archive". Caveat: "hg import" might fail if the patches were exported from a repo with a different/no keyword setup, whereas "hg unbundle" is @@ -24,6 +26,10 @@ # files matching patterns with value 'ignore' are ignored **.py = ## expand keywords in all python files x* = ignore ## but ignore files matching "x*" + ** = archive ## keywords in all textfiles are expanded + ## when creating a distribution + y* = noarchive ## keywords in files matching "y*" are not expanded + ## on archive creation ... [keywordmaps] # custom hg template maps _replace_ the CVS-like default ones @@ -46,39 +52,53 @@ no commands defined % cat expand $Id$ +ignore $Id$ +archive $Id$ expand $Id$ -ignore $Id$ % default keyword expansion % commit adding a adding b +adding c adding sym a b +c sym overwriting a expanding keywords % status % cat -expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ -expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ +expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ ignore $Id$ +archive $Id$ +expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ % hg cat -expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ +expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ +archive $Id$ ignore $Id$ a % update -3 files updated, 0 files merged, 0 files removed, 0 files unresolved +4 files updated, 0 files merged, 0 files removed, 0 files unresolved % cat -expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ -expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ +expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ ignore $Id$ +archive $Id$ +expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ +% archive +% cat +expand $Id$ +ignore $Id$ +archive $Id: c,v 99e97605039e 1970/01/01 00:00:00 user $ +a % custom keyword expansion % cat -expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ -expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ +expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ ignore $Id$ +archive $Id$ +expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ % hg cat -expand $Id: a 126ec311add6 Thu, 01 Jan 1970 00:00:00 +0000 user $ +expand $Id: a 99e97605039e Thu, 01 Jan 1970 00:00:00 +0000 user $ +archive $Id$ ignore $Id$ a % commit @@ -86,25 +106,27 @@ overwriting a expanding keywords % status % cat -expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $ -$Xinfo: User Name : firstline $ -expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $ +expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ $Xinfo: User Name : firstline $ ignore $Id$ +archive $Id$ +expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ +$Xinfo: User Name : firstline $ % hg cat -expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $ +expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ $Xinfo: User Name : firstline $ +archive $Id$ ignore $Id$ a requesting all changes adding changesets adding manifests adding file changes -added 1 changesets with 3 changes to 3 files -3 files updated, 0 files merged, 0 files removed, 0 files unresolved +added 1 changesets with 4 changes to 4 files +4 files updated, 0 files merged, 0 files removed, 0 files unresolved % incoming searching for changes -changeset: 1:6022c13396d3 +changeset: 1:001dbcdc5258 tag: tip user: User Name date: Thu Jan 01 00:00:01 1970 +0000 @@ -112,21 +134,24 @@ % switch off expansion % cat -expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $ -$Xinfo: User Name : firstline $ -expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $ +expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ $Xinfo: User Name : firstline $ ignore $Id$ +archive $Id$ +expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ +$Xinfo: User Name : firstline $ % hg cat expand $Id$ $Xinfo$ +archive $Id$ +ignore $Id$ +a +% update +4 files updated, 0 files merged, 0 files removed, 0 files unresolved +% cat +expand $Id$ +$Xinfo$ ignore $Id$ -a -% update -3 files updated, 0 files merged, 0 files removed, 0 files unresolved -% cat +archive $Id$ expand $Id$ $Xinfo$ -expand $Id$ -$Xinfo$ -ignore $Id$