##// END OF EJS Templates
tests: unify test-tag
Nicolas Dumazet -
r11788:b3de1438 default
parent child Browse files
Show More
@@ -1,88 +1,194 b''
1 #!/bin/sh
1 $ hg init test
2 $ cd test
2 3
3 hg init test
4 cd test
4 $ echo a > a
5 $ hg add a
6 $ hg commit -m "test" -d "1000000 0"
7 $ hg history
8 changeset: 0:0acdaf898367
9 tag: tip
10 user: test
11 date: Mon Jan 12 13:46:40 1970 +0000
12 summary: test
13
14
15 $ hg tag ' '
16 abort: tag names cannot consist entirely of whitespace
5 17
6 echo a > a
7 hg add a
8 hg commit -m "test" -d "1000000 0"
9 hg history
18 $ hg tag -d "1000000 0" "bleah"
19 $ hg history
20 changeset: 1:3ecf002a1c57
21 tag: tip
22 user: test
23 date: Mon Jan 12 13:46:40 1970 +0000
24 summary: Added tag bleah for changeset 0acdaf898367
25
26 changeset: 0:0acdaf898367
27 tag: bleah
28 user: test
29 date: Mon Jan 12 13:46:40 1970 +0000
30 summary: test
31
10 32
11 hg tag ' '
12
13 hg tag -d "1000000 0" "bleah"
14 hg history
15
16 echo foo >> .hgtags
17 hg tag -d "1000000 0" "bleah2" || echo "failed"
33 $ echo foo >> .hgtags
34 $ hg tag -d "1000000 0" "bleah2" || echo "failed"
35 abort: working copy of .hgtags is changed (please commit .hgtags manually)
36 failed
18 37
19 hg revert .hgtags
20 hg tag -d "1000000 0" -r 0 x y z y y z || echo "failed"
21 hg tag -d "1000000 0" tap nada dot tip null . || echo "failed"
22 hg tag -d "1000000 0" "bleah" || echo "failed"
23 hg tag -d "1000000 0" "blecch" "bleah" || echo "failed"
38 $ hg revert .hgtags
39 $ hg tag -d "1000000 0" -r 0 x y z y y z || echo "failed"
40 abort: tag names must be unique
41 failed
42 $ hg tag -d "1000000 0" tap nada dot tip null . || echo "failed"
43 abort: the name 'tip' is reserved
44 failed
45 $ hg tag -d "1000000 0" "bleah" || echo "failed"
46 abort: tag 'bleah' already exists (use -f to force)
47 failed
48 $ hg tag -d "1000000 0" "blecch" "bleah" || echo "failed"
49 abort: tag 'bleah' already exists (use -f to force)
50 failed
24 51
25 hg tag -d "1000000 0" --remove "blecch" || echo "failed"
26 hg tag -d "1000000 0" --remove "bleah" "blecch" "blough" || echo "failed"
52 $ hg tag -d "1000000 0" --remove "blecch" || echo "failed"
53 abort: tag 'blecch' does not exist
54 failed
55 $ hg tag -d "1000000 0" --remove "bleah" "blecch" "blough" || echo "failed"
56 abort: tag 'blecch' does not exist
57 failed
58
59 $ hg tag -d "1000000 0" -r 0 "bleah0"
60 $ hg tag -l -d "1000000 0" -r 1 "bleah1"
61 $ hg tag -d "1000000 0" gack gawk gorp
62 $ hg tag -d "1000000 0" -f gack
63 $ hg tag -d "1000000 0" --remove gack gorp
27 64
28 hg tag -d "1000000 0" -r 0 "bleah0"
29 hg tag -l -d "1000000 0" -r 1 "bleah1"
30 hg tag -d "1000000 0" gack gawk gorp
31 hg tag -d "1000000 0" -f gack
32 hg tag -d "1000000 0" --remove gack gorp
65 $ cat .hgtags
66 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 bleah
67 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 bleah0
68 868cc8fbb43b754ad09fa109885d243fc49adae7 gack
69 868cc8fbb43b754ad09fa109885d243fc49adae7 gawk
70 868cc8fbb43b754ad09fa109885d243fc49adae7 gorp
71 868cc8fbb43b754ad09fa109885d243fc49adae7 gack
72 3807bcf62c5614cb6c16436b514d7764ca5f1631 gack
73 3807bcf62c5614cb6c16436b514d7764ca5f1631 gack
74 0000000000000000000000000000000000000000 gack
75 868cc8fbb43b754ad09fa109885d243fc49adae7 gorp
76 0000000000000000000000000000000000000000 gorp
77 $ cat .hg/localtags
78 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1
33 79
34 cat .hgtags
35 cat .hg/localtags
80 $ hg update 0
81 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
82 $ hg tag -d "1000000 0" "foobar"
83 $ cat .hgtags
84 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar
85 $ cat .hg/localtags
86 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1
36 87
37 hg update 0
38 hg tag -d "1000000 0" "foobar"
39 cat .hgtags
40 cat .hg/localtags
88 $ hg tag -l 'xx
89 > newline'
90 abort: '\n' cannot be used in a tag name
91 $ hg tag -l 'xx:xx'
92 abort: ':' cannot be used in a tag name
93
94 cloning local tags
41 95
42 hg tag -l 'xx
43 newline'
44 hg tag -l 'xx:xx'
45
46 echo % cloning local tags
47 cd ..
48 hg -R test log -r0:5
49 hg clone -q -rbleah1 test test1
50 hg -R test1 parents --style=compact
51 hg clone -q -r5 test#bleah1 test2
52 hg -R test2 parents --style=compact
53 hg clone -q -U test#bleah1 test3
54 hg -R test3 parents --style=compact
55
56 cd test
57 echo % issue 601
58 python << EOF
59 f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
60 f = file('.hg/localtags', 'w'); f.write(last); f.close()
61 EOF
62 cat .hg/localtags
63 hg tag -l localnewline
64 cat .hg/localtags
96 $ cd ..
97 $ hg -R test log -r0:5
98 changeset: 0:0acdaf898367
99 tag: bleah
100 tag: bleah0
101 tag: foobar
102 user: test
103 date: Mon Jan 12 13:46:40 1970 +0000
104 summary: test
105
106 changeset: 1:3ecf002a1c57
107 tag: bleah1
108 user: test
109 date: Mon Jan 12 13:46:40 1970 +0000
110 summary: Added tag bleah for changeset 0acdaf898367
111
112 changeset: 2:868cc8fbb43b
113 tag: gawk
114 user: test
115 date: Mon Jan 12 13:46:40 1970 +0000
116 summary: Added tag bleah0 for changeset 0acdaf898367
117
118 changeset: 3:3807bcf62c56
119 user: test
120 date: Mon Jan 12 13:46:40 1970 +0000
121 summary: Added tag gack, gawk, gorp for changeset 868cc8fbb43b
122
123 changeset: 4:140c6e8597b4
124 user: test
125 date: Mon Jan 12 13:46:40 1970 +0000
126 summary: Added tag gack for changeset 3807bcf62c56
127
128 changeset: 5:470a65fa7cc9
129 user: test
130 date: Mon Jan 12 13:46:40 1970 +0000
131 summary: Removed tag gack, gorp
132
133 $ hg clone -q -rbleah1 test test1
134 $ hg -R test1 parents --style=compact
135 1[tip] 3ecf002a1c57 1970-01-12 13:46 +0000 test
136 Added tag bleah for changeset 0acdaf898367
137
138 $ hg clone -q -r5 test#bleah1 test2
139 $ hg -R test2 parents --style=compact
140 5[tip] 470a65fa7cc9 1970-01-12 13:46 +0000 test
141 Removed tag gack, gorp
142
143 $ hg clone -q -U test#bleah1 test3
144 $ hg -R test3 parents --style=compact
65 145
66 python << EOF
67 f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
68 f = file('.hgtags', 'w'); f.write(last); f.close()
69 EOF
70 hg ci -d '1000000 0' -m'broken manual edit of .hgtags'
71 cat .hgtags
72 hg tag -d '1000000 0' newline
73 cat .hgtags
146 $ cd test
147
148 issue 601
149
150 $ python << EOF
151 > f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
152 > f = file('.hg/localtags', 'w'); f.write(last); f.close()
153 > EOF
154 $ cat .hg/localtags; echo
155 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1
156 $ hg tag -l localnewline
157 $ cat .hg/localtags; echo
158 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1
159 f68b039e72eacbb2e68b0543e1f6e50990aa2bb5 localnewline
160
74 161
75 echo % tag and branch using same name
76 hg branch tag-and-branch-same-name
77 hg ci -m"discouraged"
78 hg tag tag-and-branch-same-name
162 $ python << EOF
163 > f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
164 > f = file('.hgtags', 'w'); f.write(last); f.close()
165 > EOF
166 $ hg ci -d '1000000 0' -m'broken manual edit of .hgtags'
167 $ cat .hgtags; echo
168 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar
169 $ hg tag -d '1000000 0' newline
170 $ cat .hgtags; echo
171 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar
172 6ae703d793c8b1f097116869275ecd97b2977a2b newline
173
174
175 tag and branch using same name
79 176
80 echo '% test custom commit messages'
81 cat > $HGTMP/editor <<'__EOF__'
82 #!/bin/sh
83 echo "custom tag message" > "$1"
84 echo "second line" >> "$1"
85 __EOF__
86 chmod +x "$HGTMP"/editor
87 HGEDITOR="'$HGTMP'"/editor hg tag custom-tag -e
88 hg log -l1 --template "{desc}\n"
177 $ hg branch tag-and-branch-same-name
178 marked working directory as branch tag-and-branch-same-name
179 $ hg ci -m"discouraged"
180 $ hg tag tag-and-branch-same-name
181 warning: tag tag-and-branch-same-name conflicts with existing branch name
182
183 test custom commit messages
184
185 $ cat > $HGTMP/editor <<'__EOF__'
186 > #!/bin/sh
187 > echo "custom tag message" > "$1"
188 > echo "second line" >> "$1"
189 > __EOF__
190 $ chmod +x "$HGTMP"/editor
191 $ HGEDITOR="'$HGTMP'"/editor hg tag custom-tag -e
192 $ hg log -l1 --template "{desc}\n"
193 custom tag message
194 second line
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now