##// 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
5 $ touch foo
6 touch foo
6 $ touch bar
7 touch bar
7 $ touch baz
8 touch baz
8 $ cat > makeignore.py <<EOF
9 cat > makeignore.py <<EOF
9 > f = open(".hgignore", "w")
10 f = open(".hgignore", "w")
10 > f.write("ignore\n")
11 f.write("ignore\n")
11 > f.write("foo\n")
12 f.write("foo\n")
12 > # No EOL here
13 # No EOL here
13 > f.write("bar")
14 f.write("bar")
14 > f.close()
15 f.close()
15 > EOF
16 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
26 $ touch a.o
19 echo % should display baz only
27 $ touch a.c
20 hg status
28 $ touch syntax
21 rm foo bar baz .hgignore makeignore.py
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
38 $ hg status
24 touch a.c
39 A dir/b.o
25 touch syntax
40 ? a.c
26 mkdir dir
41 ? a.o
27 touch dir/a.o
42 ? dir/c.o
28 touch dir/b.o
43 ? syntax
29 touch dir/c.o
30
44
31 hg add dir/a.o
45 $ echo "*.o" > .hgignore
32 hg commit -m 0
46 $ hg status 2>&1 | sed -e 's/abort: .*\.hgignore:/abort: .hgignore:/'
33 hg add dir/b.o
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
58 $ echo "^\." > .hgignore
38 echo "--" ; hg status 2>&1 | sed -e 's/abort: .*\.hgignore:/abort: .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
66 $ echo "glob:**.o" > .hgignore
41 echo "--" ; hg status
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 '.'
73 $ echo "glob:*.o" > .hgignore
44 echo "^\." > .hgignore
74 $ hg status
45 echo "--" ; hg status
75 A dir/b.o
76 ? .hgignore
77 ? a.c
78 ? syntax
46
79
47 echo "glob:**.o" > .hgignore
80 $ echo "syntax: glob" > .hgignore
48 echo "--" ; hg status
81 $ echo "re:.*\.o" >> .hgignore
49
82 $ hg status
50 echo "glob:*.o" > .hgignore
83 A dir/b.o
51 echo "--" ; hg status
84 ? .hgignore
85 ? a.c
86 ? syntax
52
87
53 echo "syntax: glob" > .hgignore
88 $ echo "syntax: invalid" > .hgignore
54 echo "re:.*\.o" >> .hgignore
89 $ hg status 2>&1 | sed -e 's/.*\.hgignore:/.hgignore:/'
55 echo "--" ; hg status
90 .hgignore: ignoring invalid syntax 'invalid'
56
91 A dir/b.o
57 echo "syntax: invalid" > .hgignore
92 ? .hgignore
58 echo "--" ; hg status 2>&1 | sed -e 's/.*\.hgignore:/.hgignore:/'
93 ? a.c
94 ? a.o
95 ? dir/c.o
96 ? syntax
59
97
60 echo "syntax: glob" > .hgignore
98 $ echo "syntax: glob" > .hgignore
61 echo "*.o" >> .hgignore
99 $ echo "*.o" >> .hgignore
62 echo "--" ; hg status
100 $ hg status
101 A dir/b.o
102 ? .hgignore
103 ? a.c
104 ? syntax
63
105
64 echo "relglob:syntax*" > .hgignore
106 $ echo "relglob:syntax*" > .hgignore
65 echo "--" ; hg status
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
114 $ echo "relglob:*" > .hgignore
68 echo "--" ; hg status
115 $ hg status
116 A dir/b.o
69
117
70 cd dir
118 $ cd dir
71 echo "--" ; hg status .
119 $ hg status .
120 A b.o
121
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now