Skip to content
Snippets Groups Projects
test-keyword.t 31.6 KiB
Newer Older
Run kwdemo outside a repo
  $ hg -q --config extensions.keyword= --config keywordmaps.Foo="{author|user}" kwdemo
  [extensions]
  keyword =
  [keyword]
  demo.txt = 
  [keywordset]
  svn = False
  [keywordmaps]
  Foo = {author|user}
  $Foo: test $

  $ cat <<EOF >> $HGRCPATH
  > [extensions]
  > keyword =
  > mq =
  > notify =
  > record =
  > transplant =
  > [ui]
  > interactive = true
  > EOF

hide outer repo
  $ hg init

Run kwdemo before [keyword] files are set up
as it would succeed without uisetup otherwise

  $ hg --quiet kwdemo
  [extensions]
  keyword =
  [keyword]
  demo.txt = 
  [keywordmaps]
  Author = {author|user}
  Date = {date|utcdate}
  Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
  Id = {file|basename},v {node|short} {date|utcdate} {author|user}
  RCSFile = {file|basename},v
  RCSfile = {file|basename},v
  Revision = {node|short}
  Source = {root}/{file},v
  $Author: test $
  $Date: ????/??/?? ??:??:?? $ (glob)
  $Header: */demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
  $Id: demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
  $RCSFile: demo.txt,v $
  $RCSfile: demo.txt,v $
  $Revision: ???????????? $ (glob)
  $Source: */demo.txt,v $ (glob)

  $ hg --quiet kwdemo "Branch = {branches}"
  [extensions]
  keyword =
  [keyword]
  demo.txt = 
  [keywordmaps]
  Branch = {branches}
  $Branch: demobranch $

(test template filter svnisodate and svnutcdate)

  $ hg --quiet kwdemo --config keywordset.svn=True
  [extensions]
  keyword =
  [keyword]
  demo.txt = 
  [keywordset]
  svn = True
  [keywordmaps]
  Author = {author|user}
  Date = {date|svnisodate}
  Id = {file|basename},v {node|short} {date|svnutcdate} {author|user}
  LastChangedBy = {author|user}
  LastChangedDate = {date|svnisodate}
  LastChangedRevision = {node|short}
  Revision = {node|short}
  $Author: test $
  $Date: ????-??-?? ??:??:?? ????? (???, ?? ??? ????) $ (glob)
  $Id: demo.txt,v ???????????? ????-??-?? ??:??:??Z test $ (glob)
  $LastChangedBy: test $
  $LastChangedDate: ????-??-?? ??:??:?? ????? (???, ?? ??? ????) $ (glob)
  $LastChangedRevision: ???????????? $ (glob)
  $Revision: ???????????? $ (glob)

  $ cat <<EOF >> $HGRCPATH
  > [keyword]
  > ** =
  > b = ignore
  > i = ignore
  > EOF
  $ cp $HGRCPATH $HGRCPATH.nohooks
  > cat <<EOF >> $HGRCPATH
  > commit=
  > commit.test=cp a hooktest
  > EOF

  $ hg init Test-bndl
  $ cd Test-bndl

kwshrink should exit silently in empty/invalid repo

  $ hg kwshrink

Symlinks cannot be created on Windows.
A bundle to test this was made with:
 hg init t
 cd t
 echo a > a
 ln -s a sym
 hg add sym
 hg ci -m addsym -u mercurial
 hg bundle --base null ../test-keyword.hg

  $ hg unbundle "$TESTDIR"/bundles/test-keyword.hg
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files
  new changesets a2392c293916 (1 drafts)
  (run 'hg update' to get a working copy)
  $ hg up a2392c293916
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ echo 'expand $Id$' > a
  $ echo 'do not process $Id:' >> a
  $ echo 'xxx $' >> a
  $ echo 'ignore $Id$' > b

Output files as they were created

  $ cat a b
  expand $Id$
  do not process $Id:
  xxx $
  ignore $Id$

no kwfiles

  $ hg kwfiles

untracked candidates

  $ hg -v kwfiles --unknown
  k a

Add files and check status

  $ hg addremove
  adding a
  adding b
  $ hg status
  A a
  A b


Default keyword expansion including commit hook
Interrupted commit should not change state or run commit hook

  $ hg --debug commit
  abort: empty commit message
  $ hg status
  A a
  A b

Commit with several checks

  $ hg --debug commit -mabsym -u 'User Name <user@example.com>'
  committing manifest
  committing changelog
  overwriting a expanding keywords
  committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
  running hook commit.test: cp a hooktest
  $ hg status
  ? hooktest
  $ hg debugrebuildstate
  $ hg --quiet identify
  ef63ca68695b

cat files in working directory with keywords expanded

  $ cat a b
  expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
  do not process $Id:
  xxx $
  ignore $Id$

hg cat files and symlink, no expansion

Loading
Loading full blame...