tests/test-hgignore.t
author Brodie Rao <brodie@bitheap.org>
Wed, 22 Sep 2010 16:06:00 -0500
changeset 12375 02990e22150b
parent 12372 5163e3c8aa52
child 12376 97ffc68f71d3
permissions -rw-r--r--
tests: require regexes in unified tests to be marked with " (re)" Consider this test: $ hg glog --template '{rev}:{node|short} "{desc}"\n' @ 2:20c4f79fd7ac "3" | | o 1:38f24201dcab "2" |/ o 0:2a18120dc1c9 "1" Because each line beginning with "|" can be compiled as a regular expression (equivalent to ".*|"), they will match any output. Similarly: $ echo foo The blank output line can be compiled as a regular expression and will also match any output. With this patch, none of the above output lines will be matched as regular expressions. A line must end in " (re)" in order to be matched as one. Lines are still matched literally first, so the following will pass: $ echo 'foo (re)' foo (re)

  $ hg init

Test issue 562: .hgignore requires newline at end:

  $ touch foo
  $ touch bar
  $ touch baz
  $ cat > makeignore.py <<EOF
  > f = open(".hgignore", "w")
  > f.write("ignore\n")
  > f.write("foo\n")
  > # No EOL here
  > f.write("bar")
  > f.close()
  > EOF

  $ python makeignore.py

Should display baz only:

  $ hg status
  ? baz

  $ rm foo bar baz .hgignore makeignore.py

  $ touch a.o
  $ touch a.c
  $ touch syntax
  $ mkdir dir
  $ touch dir/a.o
  $ touch dir/b.o
  $ touch dir/c.o

  $ hg add dir/a.o
  $ hg commit -m 0
  $ hg add dir/b.o

  $ hg status
  A dir/b.o
  ? a.c
  ? a.o
  ? dir/c.o
  ? syntax

  $ echo "*.o" > .hgignore
  $ hg status
  abort: .*/\.hgignore: invalid pattern \(relre\): \*\.o (re)
  [255]

  $ echo ".*\.o" > .hgignore
  $  hg status
  A dir/b.o
  ? .hgignore
  ? a.c
  ? syntax

Check it does not ignore the current directory '.':

  $ echo "^\." > .hgignore
  $ hg status
  A dir/b.o
  ? a.c
  ? a.o
  ? dir/c.o
  ? syntax

  $ echo "glob:**.o" > .hgignore
  $ hg status
  A dir/b.o
  ? .hgignore
  ? a.c
  ? syntax

  $ echo "glob:*.o" > .hgignore
  $ hg status
  A dir/b.o
  ? .hgignore
  ? a.c
  ? syntax

  $ echo "syntax: glob" > .hgignore
  $ echo "re:.*\.o" >> .hgignore
  $ hg status
  A dir/b.o
  ? .hgignore
  ? a.c
  ? syntax

  $ echo "syntax: invalid" > .hgignore
  $ hg status
  .*/\.hgignore: ignoring invalid syntax 'invalid' (re)
  A dir/b.o
  ? .hgignore
  ? a.c
  ? a.o
  ? dir/c.o
  ? syntax

  $ echo "syntax: glob" > .hgignore
  $ echo "*.o" >> .hgignore
  $ hg status
  A dir/b.o
  ? .hgignore
  ? a.c
  ? syntax

  $ echo "relglob:syntax*" > .hgignore
  $ hg status
  A dir/b.o
  ? .hgignore
  ? a.c
  ? a.o
  ? dir/c.o

  $ echo "relglob:*" > .hgignore
  $ hg status
  A dir/b.o

  $ cd dir
  $ hg status .
  A b.o