tests/test-keyword.t
changeset 782 09bae16e7a6d
parent 773 9f939fae8ff3
child 784 7e69e2b40d9b
equal deleted inserted replaced
781:c7a471b49819 782:09bae16e7a6d
       
     1   $ cat <<EOF >> $HGRCPATH
       
     2   > [extensions]
       
     3   > keyword =
       
     4   > mq =
       
     5   > notify =
       
     6   > record =
       
     7   > transplant =
       
     8   > [ui]
       
     9   > interactive = true
       
    10   > EOF
       
    11 
       
    12 Run kwdemo before [keyword] files are set up
       
    13 as it would succeed without uisetup otherwise
       
    14 
       
    15   $ hg --quiet kwdemo \
       
    16   > | sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
       
    17   >  -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
       
    18   >  -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
       
    19   >  -e 's! 20[0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]! 2000/00/00 00:00:00!'
       
    20   [extensions]
       
    21   keyword =
       
    22   [keyword]
       
    23   demo.txt = 
       
    24   [keywordmaps]
       
    25   Author = {author|user}
       
    26   Date = {date|utcdate}
       
    27   Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
       
    28   Id = {file|basename},v {node|short} {date|utcdate} {author|user}
       
    29   RCSFile = {file|basename},v
       
    30   RCSfile = {file|basename},v
       
    31   Revision = {node|short}
       
    32   Source = {root}/{file},v
       
    33   $Author: test $
       
    34   $Date: 2000/00/00 00:00:00 $
       
    35   $Header: /TMP/demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
       
    36   $Id: demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
       
    37   $RCSFile: demo.txt,v $
       
    38   $RCSfile: demo.txt,v $
       
    39   $Revision: xxxxxxxxxxxx $
       
    40   $Source: /TMP/demo.txt,v $
       
    41 
       
    42   $ hg --quiet kwdemo "Branch = {branches}"
       
    43   [extensions]
       
    44   keyword =
       
    45   [keyword]
       
    46   demo.txt = 
       
    47   [keywordmaps]
       
    48   Branch = {branches}
       
    49   $Branch: demobranch $
       
    50 
       
    51   $ cat <<EOF >> $HGRCPATH
       
    52   > [keyword]
       
    53   > ** =
       
    54   > b = ignore
       
    55   > [hooks]
       
    56   > commit=
       
    57   > commit.test=cp a hooktest
       
    58   > EOF
       
    59 
       
    60   $ hg init Test-bndl
       
    61   $ cd Test-bndl
       
    62 
       
    63 kwshrink should exit silently in empty/invalid repo
       
    64 
       
    65   $ hg kwshrink
       
    66 
       
    67 Symlinks cannot be created on Windows.
       
    68 A bundle to test this was made with:
       
    69  hg init t
       
    70  cd t
       
    71  echo a > a
       
    72  ln -s a sym
       
    73  hg add sym
       
    74  hg ci -m addsym -u mercurial
       
    75  hg bundle --base null ../test-keyword.hg
       
    76 
       
    77   $ hg pull -u "$TESTDIR"/test-keyword.hg
       
    78   pulling from .*test-keyword.hg
       
    79   requesting all changes
       
    80   adding changesets
       
    81   adding manifests
       
    82   adding file changes
       
    83   added 1 changesets with 1 changes to 1 files
       
    84   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    85 
       
    86   $ echo 'expand $Id$' > a
       
    87   $ echo 'do not process $Id:' >> a
       
    88   $ echo 'xxx $' >> a
       
    89   $ echo 'ignore $Id$' > b
       
    90 
       
    91 Output files as they were created
       
    92 
       
    93   $ cat a b
       
    94   expand $Id$
       
    95   do not process $Id:
       
    96   xxx $
       
    97   ignore $Id$
       
    98 
       
    99 no kwfiles
       
   100 
       
   101   $ hg kwfiles
       
   102 
       
   103 untracked candidates
       
   104 
       
   105   $ hg -v kwfiles --unknown
       
   106   k a
       
   107 
       
   108 Add files and check status
       
   109 
       
   110   $ hg addremove
       
   111   adding a
       
   112   adding b
       
   113   $ hg status
       
   114   A a
       
   115   A b
       
   116 
       
   117 
       
   118 Default keyword expansion including commit hook
       
   119 Interrupted commit should not change state or run commit hook
       
   120 
       
   121   $ hg --debug commit
       
   122   abort: empty commit message
       
   123   $ hg status
       
   124   A a
       
   125   A b
       
   126 
       
   127 Commit with several checks
       
   128 
       
   129   $ hg --debug commit -mabsym -u 'User Name <user@example.com>'
       
   130   a
       
   131   b
       
   132   overwriting a expanding keywords
       
   133   running hook commit.test: cp a hooktest
       
   134   committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
       
   135   $ hg status
       
   136   ? hooktest
       
   137   $ hg debugrebuildstate
       
   138   $ hg --quiet identify
       
   139   ef63ca68695b
       
   140 
       
   141 cat files in working directory with keywords expanded
       
   142 
       
   143   $ cat a b
       
   144   expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
       
   145   do not process $Id:
       
   146   xxx $
       
   147   ignore $Id$
       
   148 
       
   149 hg cat files and symlink, no expansion
       
   150 
       
   151   $ hg cat sym a b && echo
       
   152   expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
       
   153   do not process $Id:
       
   154   xxx $
       
   155   ignore $Id$
       
   156   a.*
       
   157 
       
   158 Test hook execution
       
   159 
       
   160   $ diff a hooktest
       
   161 
       
   162 Removing commit hook from config
       
   163 
       
   164   $ sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nohook
       
   165   $ mv "$HGRCPATH".nohook "$HGRCPATH"
       
   166   $ rm hooktest
       
   167 
       
   168 bundle
       
   169 
       
   170   $ hg bundle --base null ../kw.hg
       
   171   2 changesets found
       
   172   $ cd ..
       
   173   $ hg init Test
       
   174   $ cd Test
       
   175 
       
   176 Notify on pull to check whether keywords stay as is in email
       
   177 ie. if patch.diff wrapper acts as it should
       
   178 
       
   179   $ cat <<EOF >> $HGRCPATH
       
   180   > [hooks]
       
   181   > incoming.notify = python:hgext.notify.hook
       
   182   > [notify]
       
   183   > sources = pull
       
   184   > diffstat = False
       
   185   > [reposubs]
       
   186   > * = Test
       
   187   > EOF
       
   188 
       
   189 Pull from bundle and trigger notify
       
   190 
       
   191   $ hg pull -u ../kw.hg
       
   192   pulling from ../kw.hg
       
   193   requesting all changes
       
   194   adding changesets
       
   195   adding manifests
       
   196   adding file changes
       
   197   added 2 changesets with 3 changes to 3 files
       
   198   Content-Type: text/plain; charset="us-ascii"
       
   199   MIME-Version: 1.0
       
   200   Content-Transfer-Encoding: 7bit
       
   201   Date: .*
       
   202   Subject: changeset in .*
       
   203   From: mercurial
       
   204   X-Hg-Notification: changeset a2392c293916
       
   205   Message-Id: <hg.a2392c293916.*>
       
   206   To: Test
       
   207   
       
   208   changeset a2392c293916 in .*
       
   209   details: .*?cmd=changeset;node=a2392c293916
       
   210   description:
       
   211   	addsym
       
   212   
       
   213   diffs (6 lines):
       
   214   
       
   215   diff -r 000000000000 -r a2392c293916 sym
       
   216   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   217   +++ b/sym	Sat Feb 09 20:25:47 2008 +0100
       
   218   @@ -0,0 +1,1 @@
       
   219   +a
       
   220   \ No newline at end of file
       
   221   Content-Type: text/plain; charset="us-ascii"
       
   222   MIME-Version: 1.0
       
   223   Content-Transfer-Encoding: 7bit
       
   224   Date:.*
       
   225   Subject: changeset in.*
       
   226   From: User Name <user@example.com>
       
   227   X-Hg-Notification: changeset ef63ca68695b
       
   228   Message-Id: <hg.ef63ca68695b.*>
       
   229   To: Test
       
   230   
       
   231   changeset ef63ca68695b in .*
       
   232   details: .*?cmd=changeset;node=ef63ca68695b
       
   233   description:
       
   234   	absym
       
   235   
       
   236   diffs (12 lines):
       
   237   
       
   238   diff -r a2392c293916 -r ef63ca68695b a
       
   239   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   240   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   241   @@ -0,0 +1,3 @@
       
   242   +expand $Id$
       
   243   +do not process $Id:
       
   244   +xxx $
       
   245   diff -r a2392c293916 -r ef63ca68695b b
       
   246   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   247   +++ b/b	Thu Jan 01 00:00:00 1970 +0000
       
   248   @@ -0,0 +1,1 @@
       
   249   +ignore $Id$
       
   250   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   251 
       
   252 Remove notify config
       
   253 
       
   254   $ sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nonotify
       
   255   $ mv "$HGRCPATH".nonotify "$HGRCPATH"
       
   256 
       
   257 Touch files and check with status
       
   258 
       
   259   $ touch a b
       
   260   $ hg status
       
   261 
       
   262 Update and expand
       
   263 
       
   264   $ rm sym a b
       
   265   $ hg update -C
       
   266   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   267   $ cat a b
       
   268   expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
       
   269   do not process $Id:
       
   270   xxx $
       
   271   ignore $Id$
       
   272 
       
   273 Check whether expansion is filewise
       
   274 
       
   275   $ echo '$Id$' > c
       
   276   $ echo 'tests for different changenodes' >> c
       
   277 
       
   278 commit file c
       
   279 
       
   280   $ hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
       
   281   adding c
       
   282 
       
   283 force expansion
       
   284 
       
   285   $ hg -v kwexpand
       
   286   overwriting a expanding keywords
       
   287   overwriting c expanding keywords
       
   288 
       
   289 compare changenodes in a and c
       
   290 
       
   291   $ cat a c
       
   292   expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
       
   293   do not process $Id:
       
   294   xxx $
       
   295   $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
       
   296   tests for different changenodes
       
   297 
       
   298 record chunk
       
   299 
       
   300   $ python -c \
       
   301   > 'l=open("a").readlines();l.insert(1,"foo\n");l.append("bar\n");open("a","w").writelines(l);'
       
   302   $ hg record -d '1 10' -m rectest<<EOF
       
   303   > y
       
   304   > y
       
   305   > n
       
   306   > EOF
       
   307   diff --git a/a b/a
       
   308   2 hunks, 2 lines changed
       
   309   examine changes to 'a'? [Ynsfdaq?] 
       
   310   @@ -1,3 +1,4 @@
       
   311    expand $Id$
       
   312   +foo
       
   313    do not process $Id:
       
   314    xxx $
       
   315   record change 1/2 to 'a'? [Ynsfdaq?] 
       
   316   @@ -2,2 +3,3 @@
       
   317    do not process $Id:
       
   318    xxx $
       
   319   +bar
       
   320   record change 2/2 to 'a'? [Ynsfdaq?] 
       
   321 
       
   322   $ hg identify
       
   323   d17e03c92c97+ tip
       
   324   $ hg status
       
   325   M a
       
   326 
       
   327 Cat modified file a
       
   328 
       
   329   $ cat a
       
   330   expand $Id: a,v d17e03c92c97 1970/01/01 00:00:01 test $
       
   331   foo
       
   332   do not process $Id:
       
   333   xxx $
       
   334   bar
       
   335 
       
   336 Diff remaining chunk
       
   337 
       
   338   $ hg diff | grep -v 'b/a'
       
   339   diff -r d17e03c92c97 a
       
   340   --- a/a	Wed Dec 31 23:59:51 1969 -0000
       
   341   @@ -2,3 +2,4 @@
       
   342    foo
       
   343    do not process $Id:
       
   344    xxx $
       
   345   +bar
       
   346 
       
   347   $ hg rollback
       
   348   rolling back to revision 2 (undo commit)
       
   349 
       
   350 Record all chunks in file a
       
   351 
       
   352   $ echo foo > msg
       
   353 
       
   354  - do not use "hg record -m" here!
       
   355 
       
   356   $ hg record -l msg -d '1 11'<<EOF
       
   357   > y
       
   358   > y
       
   359   > y
       
   360   > EOF
       
   361   diff --git a/a b/a
       
   362   2 hunks, 2 lines changed
       
   363   examine changes to 'a'? [Ynsfdaq?] 
       
   364   @@ -1,3 +1,4 @@
       
   365    expand $Id$
       
   366   +foo
       
   367    do not process $Id:
       
   368    xxx $
       
   369   record change 1/2 to 'a'? [Ynsfdaq?] 
       
   370   @@ -2,2 +3,3 @@
       
   371    do not process $Id:
       
   372    xxx $
       
   373   +bar
       
   374   record change 2/2 to 'a'? [Ynsfdaq?] 
       
   375 
       
   376 File a should be clean
       
   377 
       
   378   $ hg status -A a
       
   379   C a
       
   380 
       
   381   $ rm msg
       
   382   $ hg rollback
       
   383   rolling back to revision 2 (undo commit)
       
   384   $ hg update -C
       
   385   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   386 
       
   387 Test patch queue repo
       
   388 
       
   389   $ hg init --mq
       
   390   $ hg qimport -r tip -n mqtest.diff
       
   391   $ hg commit --mq -m mqtest
       
   392 
       
   393 Keywords should not be expanded in patch
       
   394 
       
   395   $ cat .hg/patches/mqtest.diff
       
   396   # HG changeset patch
       
   397   # User User Name <user@example.com>
       
   398   # Date 1 0
       
   399   # Node ID 40a904bbbe4cd4ab0a1f28411e35db26341a40ad
       
   400   # Parent  ef63ca68695bc9495032c6fda1350c71e6d256e9
       
   401   cndiff
       
   402   
       
   403   diff -r ef63ca68695b -r 40a904bbbe4c c
       
   404   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   405   +++ b/c	Thu Jan 01 00:00:01 1970 +0000
       
   406   @@ -0,0 +1,2 @@
       
   407   +$Id$
       
   408   +tests for different changenodes
       
   409 
       
   410   $ hg qpop
       
   411   popping mqtest.diff
       
   412   patch queue now empty
       
   413 
       
   414 qgoto, implying qpush, should expand
       
   415 
       
   416   $ hg qgoto mqtest.diff
       
   417   applying mqtest.diff
       
   418   now at: mqtest.diff
       
   419   $ cat c
       
   420   $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
       
   421   tests for different changenodes
       
   422   $ hg cat c
       
   423   $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
       
   424   tests for different changenodes
       
   425 
       
   426 Keywords should not be expanded in filelog
       
   427 
       
   428   $ hg --config 'extensions.keyword=!' cat c
       
   429   $Id$
       
   430   tests for different changenodes
       
   431 
       
   432 qpop and move on
       
   433 
       
   434   $ hg qpop
       
   435   popping mqtest.diff
       
   436   patch queue now empty
       
   437 
       
   438 Copy and show added kwfiles
       
   439 
       
   440   $ hg cp a c
       
   441   $ hg kwfiles
       
   442   a
       
   443   c
       
   444 
       
   445 Commit and show expansion in original and copy
       
   446 
       
   447   $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
       
   448   c
       
   449    c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
       
   450   overwriting c expanding keywords
       
   451   committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
       
   452   $ cat a c
       
   453   expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
       
   454   do not process $Id:
       
   455   xxx $
       
   456   expand $Id: c,v 25736cf2f5cb 1970/01/01 00:00:01 user $
       
   457   do not process $Id:
       
   458   xxx $
       
   459 
       
   460 Touch copied c and check its status
       
   461 
       
   462   $ touch c
       
   463   $ hg status
       
   464 
       
   465 Test different options of hg kwfiles
       
   466 
       
   467   $ hg kwfiles
       
   468   a
       
   469   c
       
   470   $ hg -v kwfiles --ignore
       
   471   I b
       
   472   I sym
       
   473   $ hg kwfiles --all
       
   474   K a
       
   475   K c
       
   476   I b
       
   477   I sym
       
   478 
       
   479 Diff specific revision
       
   480 
       
   481   $ hg diff --rev 1 | grep -v 'b/c'
       
   482   diff -r ef63ca68695b c
       
   483   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   484   @@ -0,0 +1,3 @@
       
   485   +expand $Id$
       
   486   +do not process $Id:
       
   487   +xxx $
       
   488 
       
   489 Status after rollback:
       
   490 
       
   491   $ hg rollback
       
   492   rolling back to revision 1 (undo commit)
       
   493   $ hg status
       
   494   A c
       
   495   $ hg update --clean
       
   496   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   497 
       
   498 Custom keywordmaps as argument to kwdemo
       
   499 
       
   500   $ hg --quiet kwdemo "Xinfo = {author}: {desc}"
       
   501   [extensions]
       
   502   keyword =
       
   503   [keyword]
       
   504   ** = 
       
   505   b = ignore
       
   506   demo.txt = 
       
   507   [keywordmaps]
       
   508   Xinfo = {author}: {desc}
       
   509   $Xinfo: test: hg keyword configuration and expansion example $
       
   510 
       
   511 Configure custom keywordmaps
       
   512 
       
   513   $ cat <<EOF >>$HGRCPATH
       
   514   > [keywordmaps]
       
   515   > Id = {file} {node|short} {date|rfc822date} {author|user}
       
   516   > Xinfo = {author}: {desc}
       
   517   > EOF
       
   518 
       
   519 Cat and hg cat files before custom expansion
       
   520 
       
   521   $ cat a b
       
   522   expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
       
   523   do not process $Id:
       
   524   xxx $
       
   525   ignore $Id$
       
   526   $ hg cat sym a b && echo
       
   527   expand $Id: a ef63ca68695b Thu, 01 Jan 1970 00:00:00 +0000 user $
       
   528   do not process $Id:
       
   529   xxx $
       
   530   ignore $Id$
       
   531   a.*
       
   532 
       
   533 Write custom keyword and prepare multiline commit message
       
   534 
       
   535   $ echo '$Xinfo$' >> a
       
   536   $ cat <<EOF >> log
       
   537   > firstline
       
   538   > secondline
       
   539   > EOF
       
   540 
       
   541 Interrupted commit should not change state
       
   542 
       
   543   $ hg commit
       
   544   abort: empty commit message
       
   545   $ hg status
       
   546   M a
       
   547   ? c
       
   548   ? log
       
   549 
       
   550 Commit with multiline message and custom expansion
       
   551 
       
   552   $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
       
   553   a
       
   554   overwriting a expanding keywords
       
   555   committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
       
   556   $ rm log
       
   557 
       
   558 Stat, verify and show custom expansion (firstline)
       
   559 
       
   560   $ hg status
       
   561   ? c
       
   562   $ hg verify
       
   563   checking changesets
       
   564   checking manifests
       
   565   crosschecking files in changesets and manifests
       
   566   checking files
       
   567   3 files, 3 changesets, 4 total revisions
       
   568   $ cat a b
       
   569   expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
       
   570   do not process $Id:
       
   571   xxx $
       
   572   $Xinfo: User Name <user@example.com>: firstline $
       
   573   ignore $Id$
       
   574   $ hg cat sym a b && echo
       
   575   expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
       
   576   do not process $Id:
       
   577   xxx $
       
   578   $Xinfo: User Name <user@example.com>: firstline $
       
   579   ignore $Id$
       
   580   a.*
       
   581 
       
   582 annotate
       
   583 
       
   584   $ hg annotate a
       
   585   1: expand $Id$
       
   586   1: do not process $Id:
       
   587   1: xxx $
       
   588   2: $Xinfo$
       
   589 
       
   590 remove with status checks
       
   591 
       
   592   $ hg debugrebuildstate
       
   593   $ hg remove a
       
   594   $ hg --debug commit -m rma
       
   595   committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
       
   596   $ hg status
       
   597   ? c
       
   598 
       
   599 Rollback, revert, and check expansion
       
   600 
       
   601   $ hg rollback
       
   602   rolling back to revision 2 (undo commit)
       
   603   $ hg status
       
   604   R a
       
   605   ? c
       
   606   $ hg revert --no-backup --rev tip a
       
   607   $ cat a
       
   608   expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
       
   609   do not process $Id:
       
   610   xxx $
       
   611   $Xinfo: User Name <user@example.com>: firstline $
       
   612 
       
   613 Clone to test global and local configurations
       
   614 
       
   615   $ cd ..
       
   616 
       
   617 Expansion in destinaton with global configuration
       
   618 
       
   619   $ hg --quiet clone Test globalconf
       
   620   $ cat globalconf/a
       
   621   expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
       
   622   do not process $Id:
       
   623   xxx $
       
   624   $Xinfo: User Name <user@example.com>: firstline $
       
   625 
       
   626 No expansion in destination with local configuration in origin only
       
   627 
       
   628   $ hg --quiet --config 'keyword.**=ignore' clone Test localconf
       
   629   $ cat localconf/a
       
   630   expand $Id$
       
   631   do not process $Id:
       
   632   xxx $
       
   633   $Xinfo$
       
   634 
       
   635 Clone to test incoming
       
   636 
       
   637   $ hg clone -r1 Test Test-a
       
   638   requesting all changes
       
   639   adding changesets
       
   640   adding manifests
       
   641   adding file changes
       
   642   added 2 changesets with 3 changes to 3 files
       
   643   updating to branch default
       
   644   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   645   $ cd Test-a
       
   646   $ cat <<EOF >> .hg/hgrc
       
   647   > [paths]
       
   648   > default = ../Test
       
   649   > EOF
       
   650   $ hg incoming
       
   651   comparing with .*test-keyword.t/Test
       
   652   searching for changes
       
   653   changeset:   2:bb948857c743
       
   654   tag:         tip
       
   655   user:        User Name <user@example.com>
       
   656   date:        Thu Jan 01 00:00:02 1970 +0000
       
   657   summary:     firstline
       
   658   
       
   659 Imported patch should not be rejected
       
   660 
       
   661   $ sed -e 's/Id.*/& rejecttest/' a > a.new
       
   662   $ mv a.new a
       
   663   $ hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
       
   664   a
       
   665   overwriting a expanding keywords
       
   666   committed changeset 2:85e279d709ffc28c9fdd1b868570985fc3d87082
       
   667   $ hg export -o ../rejecttest.diff tip
       
   668   $ cd ../Test
       
   669   $ hg import ../rejecttest.diff
       
   670   applying ../rejecttest.diff
       
   671   $ cat a b
       
   672   expand $Id: a 4e0994474d25 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
       
   673   do not process $Id: rejecttest
       
   674   xxx $
       
   675   $Xinfo: User Name <user@example.com>: rejects? $
       
   676   ignore $Id$
       
   677 
       
   678   $ hg rollback
       
   679   rolling back to revision 2 (undo commit)
       
   680   $ hg update --clean
       
   681   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   682 
       
   683 kwexpand/kwshrink on selected files
       
   684 
       
   685   $ mkdir x
       
   686   $ hg copy a x/a
       
   687   $ hg --verbose kwexpand a
       
   688   overwriting a expanding keywords
       
   689 
       
   690 kwexpand x/a should abort
       
   691 
       
   692   $ hg --verbose kwexpand x/a
       
   693   abort: outstanding uncommitted changes
       
   694   $ cd x
       
   695   $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
       
   696   x/a
       
   697    x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
       
   698   overwriting x/a expanding keywords
       
   699   committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
       
   700   $ cat a
       
   701   expand $Id: x/a b4560182a3f9 Thu, 01 Jan 1970 00:00:03 +0000 user $
       
   702   do not process $Id:
       
   703   xxx $
       
   704   $Xinfo: User Name <user@example.com>: xa $
       
   705 
       
   706 kwshrink a inside directory x
       
   707 
       
   708   $ hg --verbose kwshrink a
       
   709   overwriting x/a shrinking keywords
       
   710   $ cat a
       
   711   expand $Id$
       
   712   do not process $Id:
       
   713   xxx $
       
   714   $Xinfo$
       
   715   $ cd ..
       
   716 
       
   717 kwexpand nonexistent
       
   718 
       
   719   $ hg kwexpand nonexistent
       
   720   nonexistent:.*
       
   721 
       
   722 
       
   723 hg serve
       
   724  - expand with hgweb file
       
   725  - no expansion with hgweb annotate/changeset/filediff
       
   726  - check errors
       
   727 
       
   728   $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
       
   729   $ cat hg.pid >> $DAEMON_PIDS
       
   730   $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/file/tip/a/?style=raw'
       
   731   200 Script output follows
       
   732   
       
   733   expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
       
   734   do not process $Id:
       
   735   xxx $
       
   736   $Xinfo: User Name <user@example.com>: firstline $
       
   737   $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/annotate/tip/a/?style=raw'
       
   738   200 Script output follows
       
   739   
       
   740   
       
   741   user@1: expand $Id$
       
   742   user@1: do not process $Id:
       
   743   user@1: xxx $
       
   744   user@2: $Xinfo$
       
   745   
       
   746   
       
   747   
       
   748   
       
   749   $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/rev/tip/?style=raw'
       
   750   200 Script output follows
       
   751   
       
   752   
       
   753   # HG changeset patch
       
   754   # User User Name <user@example.com>
       
   755   # Date 3 0
       
   756   # Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
       
   757   # Parent  bb948857c743469b22bbf51f7ec8112279ca5d83
       
   758   xa
       
   759   
       
   760   diff -r bb948857c743 -r b4560182a3f9 x/a
       
   761   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   762   +++ b/x/a	Thu Jan 01 00:00:03 1970 +0000
       
   763   @@ -0,0 +1,4 @@
       
   764   +expand $Id$
       
   765   +do not process $Id:
       
   766   +xxx $
       
   767   +$Xinfo$
       
   768   
       
   769   $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/diff/bb948857c743/a?style=raw'
       
   770   200 Script output follows
       
   771   
       
   772   
       
   773   diff -r ef63ca68695b -r bb948857c743 a
       
   774   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   775   +++ b/a	Thu Jan 01 00:00:02 1970 +0000
       
   776   @@ -1,3 +1,4 @@
       
   777    expand $Id$
       
   778    do not process $Id:
       
   779    xxx $
       
   780   +$Xinfo$
       
   781   
       
   782   
       
   783   
       
   784   
       
   785   $ cat errors.log
       
   786 
       
   787 Prepare merge and resolve tests
       
   788 
       
   789   $ echo '$Id$' > m
       
   790   $ hg add m
       
   791   $ hg commit -m 4kw 
       
   792   $ echo foo >> m
       
   793   $ hg commit -m 5foo
       
   794 
       
   795 simplemerge
       
   796 
       
   797   $ hg update 4
       
   798   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   799   $ echo foo >> m
       
   800   $ hg commit -m 6foo
       
   801   created new head
       
   802   $ hg merge
       
   803   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   804   (branch merge, don't forget to commit)
       
   805   $ hg commit -m simplemerge
       
   806   $ cat m
       
   807   $Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
       
   808   foo
       
   809 
       
   810 conflict: keyword should stay outside conflict zone
       
   811 
       
   812   $ hg update 4
       
   813   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   814   $ echo bar >> m
       
   815   $ hg commit -m 8bar
       
   816   created new head
       
   817   $ hg merge
       
   818   merging m
       
   819   warning: conflicts during merge.
       
   820   merging m failed!
       
   821   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
       
   822   use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
       
   823   $ cat m
       
   824   $Id$
       
   825   <<<<<<< local
       
   826   bar
       
   827   =======
       
   828   foo
       
   829   >>>>>>> other
       
   830 
       
   831 resolve to local
       
   832 
       
   833   $ HGMERGE=internal:local hg resolve -a
       
   834   $ hg commit -m localresolve
       
   835   $ cat m
       
   836   $Id: m 41efa6d38e9b Thu, 01 Jan 1970 00:00:00 +0000 test $
       
   837   bar
       
   838 
       
   839 Test restricted mode with transplant -b
       
   840 
       
   841   $ hg update 6
       
   842   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   843   $ hg branch foo
       
   844   marked working directory as branch foo
       
   845   $ mv a a.bak
       
   846   $ echo foobranch > a
       
   847   $ cat a.bak >> a
       
   848   $ rm a.bak
       
   849   $ hg commit -m 9foobranch
       
   850   $ hg update default
       
   851   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   852   $ hg -y transplant -b foo tip
       
   853   applying 4aa30d025d50
       
   854   4aa30d025d50 transplanted to 5a4da427c162
       
   855 
       
   856 Expansion in changeset but not in file
       
   857 
       
   858   $ hg tip -p
       
   859   changeset:   11:5a4da427c162
       
   860   tag:         tip
       
   861   parent:      9:41efa6d38e9b
       
   862   user:        test
       
   863   date:        Thu Jan 01 00:00:00 1970 +0000
       
   864   summary:     9foobranch
       
   865   
       
   866   diff -r 41efa6d38e9b -r 5a4da427c162 a
       
   867   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   868   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   869   @@ -1,3 +1,4 @@
       
   870   +foobranch
       
   871    expand $Id$
       
   872    do not process $Id:
       
   873    xxx $
       
   874   
       
   875   $ head -n 2 a
       
   876   foobranch
       
   877   expand $Id: a 5a4da427c162 Thu, 01 Jan 1970 00:00:00 +0000 test $
       
   878 
       
   879 Switch of expansion
       
   880 
       
   881   $ hg -q rollback
       
   882   $ hg -q update -C
       
   883 
       
   884 kwshrink with unknown file u
       
   885 
       
   886   $ cp a u
       
   887   $ hg --verbose kwshrink
       
   888   overwriting a shrinking keywords
       
   889   overwriting m shrinking keywords
       
   890   overwriting x/a shrinking keywords
       
   891 
       
   892 Keywords shrunk in working directory, but not yet disabled
       
   893  - cat shows unexpanded keywords
       
   894  - hg cat shows expanded keywords
       
   895 
       
   896   $ cat a b
       
   897   expand $Id$
       
   898   do not process $Id:
       
   899   xxx $
       
   900   $Xinfo$
       
   901   ignore $Id$
       
   902   $ hg cat sym a b && echo
       
   903   expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
       
   904   do not process $Id:
       
   905   xxx $
       
   906   $Xinfo: User Name <user@example.com>: firstline $
       
   907   ignore $Id$
       
   908   a.*
       
   909 
       
   910 Now disable keyword expansion
       
   911 
       
   912   $ rm "$HGRCPATH"
       
   913   $ cat a b
       
   914   expand $Id$
       
   915   do not process $Id:
       
   916   xxx $
       
   917   $Xinfo$
       
   918   ignore $Id$
       
   919   $ hg cat sym a b && echo
       
   920   expand $Id$
       
   921   do not process $Id:
       
   922   xxx $
       
   923   $Xinfo$
       
   924   ignore $Id$
       
   925   a.*