##// END OF EJS Templates
tests: unify test-hgignore
Adrian Buehlmann -
r12312:83a310f2 default
parent child Browse files
Show More
@@ -1,71 +1,121 b''
1 #!/bin/sh
1 $ hg init
2 2
3 hg init
3 Test issue 562: .hgignore requires newline at end:
4 4
5 # Test issue 562: .hgignore requires newline at end
6 touch foo
7 touch bar
8 touch baz
9 cat > makeignore.py <<EOF
10 f = open(".hgignore", "w")
11 f.write("ignore\n")
12 f.write("foo\n")
13 # No EOL here
14 f.write("bar")
15 f.close()
16 EOF
5 $ touch foo
6 $ touch bar
7 $ touch baz
8 $ cat > makeignore.py <<EOF
9 > f = open(".hgignore", "w")
10 > f.write("ignore\n")
11 > f.write("foo\n")
12 > # No EOL here
13 > f.write("bar")
14 > f.close()
15 > EOF
16
17 $ python makeignore.py
18
19 Should display baz only:
20
21 $ hg status
22 ? baz
23
24 $ rm foo bar baz .hgignore makeignore.py
17 25
18 python makeignore.py
19 echo % should display baz only
20 hg status
21 rm foo bar baz .hgignore makeignore.py
26 $ touch a.o
27 $ touch a.c
28 $ touch syntax
29 $ mkdir dir
30 $ touch dir/a.o
31 $ touch dir/b.o
32 $ touch dir/c.o
33
34 $ hg add dir/a.o
35 $ hg commit -m 0
36 $ hg add dir/b.o
22 37
23 touch a.o
24 touch a.c
25 touch syntax
26 mkdir dir
27 touch dir/a.o
28 touch dir/b.o
29 touch dir/c.o
38 $ hg status
39 A dir/b.o
40 ? a.c
41 ? a.o
42 ? dir/c.o
43 ? syntax
30 44
31 hg add dir/a.o
32 hg commit -m 0
33 hg add dir/b.o
45 $ echo "*.o" > .hgignore
46 $ hg status 2>&1 | sed -e 's/abort: .*\.hgignore:/abort: .hgignore:/'
47 abort: .hgignore: invalid pattern (relre): *.o
34 48
35 echo "--" ; hg status
49 $ echo ".*\.o" > .hgignore
50 $ hg status
51 A dir/b.o
52 ? .hgignore
53 ? a.c
54 ? syntax
55
56 Check it does not ignore the current directory '.':
36 57
37 echo "*.o" > .hgignore
38 echo "--" ; hg status 2>&1 | sed -e 's/abort: .*\.hgignore:/abort: .hgignore:/'
58 $ echo "^\." > .hgignore
59 $ hg status
60 A dir/b.o
61 ? a.c
62 ? a.o
63 ? dir/c.o
64 ? syntax
39 65
40 echo ".*\.o" > .hgignore
41 echo "--" ; hg status
66 $ echo "glob:**.o" > .hgignore
67 $ hg status
68 A dir/b.o
69 ? .hgignore
70 ? a.c
71 ? syntax
42 72
43 # Check it does not ignore the current directory '.'
44 echo "^\." > .hgignore
45 echo "--" ; hg status
73 $ echo "glob:*.o" > .hgignore
74 $ hg status
75 A dir/b.o
76 ? .hgignore
77 ? a.c
78 ? syntax
46 79
47 echo "glob:**.o" > .hgignore
48 echo "--" ; hg status
49
50 echo "glob:*.o" > .hgignore
51 echo "--" ; hg status
80 $ echo "syntax: glob" > .hgignore
81 $ echo "re:.*\.o" >> .hgignore
82 $ hg status
83 A dir/b.o
84 ? .hgignore
85 ? a.c
86 ? syntax
52 87
53 echo "syntax: glob" > .hgignore
54 echo "re:.*\.o" >> .hgignore
55 echo "--" ; hg status
56
57 echo "syntax: invalid" > .hgignore
58 echo "--" ; hg status 2>&1 | sed -e 's/.*\.hgignore:/.hgignore:/'
88 $ echo "syntax: invalid" > .hgignore
89 $ hg status 2>&1 | sed -e 's/.*\.hgignore:/.hgignore:/'
90 .hgignore: ignoring invalid syntax 'invalid'
91 A dir/b.o
92 ? .hgignore
93 ? a.c
94 ? a.o
95 ? dir/c.o
96 ? syntax
59 97
60 echo "syntax: glob" > .hgignore
61 echo "*.o" >> .hgignore
62 echo "--" ; hg status
98 $ echo "syntax: glob" > .hgignore
99 $ echo "*.o" >> .hgignore
100 $ hg status
101 A dir/b.o
102 ? .hgignore
103 ? a.c
104 ? syntax
63 105
64 echo "relglob:syntax*" > .hgignore
65 echo "--" ; hg status
106 $ echo "relglob:syntax*" > .hgignore
107 $ hg status
108 A dir/b.o
109 ? .hgignore
110 ? a.c
111 ? a.o
112 ? dir/c.o
66 113
67 echo "relglob:*" > .hgignore
68 echo "--" ; hg status
114 $ echo "relglob:*" > .hgignore
115 $ hg status
116 A dir/b.o
69 117
70 cd dir
71 echo "--" ; hg status .
118 $ cd dir
119 $ hg status .
120 A b.o
121
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now