tests/test-hgignore
author Thomas Arendsen Hein <thomas@intevation.de>
Fri, 12 Feb 2010 15:46:48 +0100
changeset 10421 452b6195e94c
parent 6479 31abcae33b4f
permissions -rwxr-xr-x
ui: look before you leap on sys.stderr.closed (and look nicer) f83291e5643e introduced a fix if sys.stdout.closed does not exist. This change uses a getattr with default instead of hasattr (which just calls getattr) and accessing the attribute. Additionally it applies the same fix for sys.stderr.closed as this is not available in the bpython shell (reported by Roger Gammans).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     1
#!/bin/sh
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     2
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     3
hg init
4439
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
     4
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
     5
# Test issue 562: .hgignore requires newline at end
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
     6
touch foo
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
     7
touch bar
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
     8
touch baz
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
     9
cat > makeignore.py <<EOF
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    10
f = open(".hgignore", "w")
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    11
f.write("ignore\n")
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    12
f.write("foo\n")
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    13
# No EOL here
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    14
f.write("bar")
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    15
f.close()
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    16
EOF
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    17
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    18
python makeignore.py
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    19
echo % should display baz only
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    20
hg status
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    21
rm foo bar baz .hgignore makeignore.py
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
    22
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    23
touch a.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    24
touch a.c
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    25
touch syntax
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    26
mkdir dir
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    27
touch dir/a.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    28
touch dir/b.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    29
touch dir/c.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    30
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    31
hg add dir/a.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    32
hg commit -m 0
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    33
hg add dir/b.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    34
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    35
echo "--" ; hg status
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    36
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    37
echo "*.o" > .hgignore
2009
182f500805db Fix broken hgignore tests due to full path showing up in output.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1568
diff changeset
    38
echo "--" ; hg status 2>&1 | sed -e 's/abort: .*\.hgignore:/abort: .hgignore:/'
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    39
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    40
echo ".*\.o" > .hgignore
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    41
echo "--" ; hg status
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    42
6479
31abcae33b4f dirstate: do not ignore current directory '.' (issue 1078)
Patrick Mezard <pmezard@gmail.com>
parents: 5029
diff changeset
    43
# Check it does not ignore the current directory '.'
31abcae33b4f dirstate: do not ignore current directory '.' (issue 1078)
Patrick Mezard <pmezard@gmail.com>
parents: 5029
diff changeset
    44
echo "^\." > .hgignore
31abcae33b4f dirstate: do not ignore current directory '.' (issue 1078)
Patrick Mezard <pmezard@gmail.com>
parents: 5029
diff changeset
    45
echo "--" ; hg status
31abcae33b4f dirstate: do not ignore current directory '.' (issue 1078)
Patrick Mezard <pmezard@gmail.com>
parents: 5029
diff changeset
    46
5029
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
    47
echo "glob:**.o" > .hgignore
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
    48
echo "--" ; hg status
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
    49
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
    50
echo "glob:*.o" > .hgignore
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
    51
echo "--" ; hg status
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
    52
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
    53
echo "syntax: glob" > .hgignore
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
    54
echo "re:.*\.o" >> .hgignore
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
    55
echo "--" ; hg status
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    56
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    57
echo "syntax: invalid" > .hgignore
2009
182f500805db Fix broken hgignore tests due to full path showing up in output.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1568
diff changeset
    58
echo "--" ; hg status 2>&1 | sed -e 's/.*\.hgignore:/.hgignore:/'
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    59
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    60
echo "syntax: glob" > .hgignore
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    61
echo "*.o" >> .hgignore
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    62
echo "--" ; hg status
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    63
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    64
echo "relglob:syntax*" > .hgignore
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    65
echo "--" ; hg status
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    66
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    67
echo "relglob:*" > .hgignore
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    68
echo "--" ; hg status
1491
91c0e8d7ddcf fix a bug in dirstate.changes when cwd != repo.root
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1478
diff changeset
    69
91c0e8d7ddcf fix a bug in dirstate.changes when cwd != repo.root
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1478
diff changeset
    70
cd dir
1568
1d7d0c07e8f3 make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1491
diff changeset
    71
echo "--" ; hg status .