##// 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 $ echo a > a
4 cd test
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
18 $ hg tag -d "1000000 0" "bleah"
7 hg add a
19 $ hg history
8 hg commit -m "test" -d "1000000 0"
20 changeset: 1:3ecf002a1c57
9 hg history
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 ' '
33 $ echo foo >> .hgtags
12
34 $ hg tag -d "1000000 0" "bleah2" || echo "failed"
13 hg tag -d "1000000 0" "bleah"
35 abort: working copy of .hgtags is changed (please commit .hgtags manually)
14 hg history
36 failed
15
16 echo foo >> .hgtags
17 hg tag -d "1000000 0" "bleah2" || echo "failed"
18
37
19 hg revert .hgtags
38 $ hg revert .hgtags
20 hg tag -d "1000000 0" -r 0 x y z y y z || echo "failed"
39 $ 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"
40 abort: tag names must be unique
22 hg tag -d "1000000 0" "bleah" || echo "failed"
41 failed
23 hg tag -d "1000000 0" "blecch" "bleah" || echo "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"
52 $ hg tag -d "1000000 0" --remove "blecch" || echo "failed"
26 hg tag -d "1000000 0" --remove "bleah" "blecch" "blough" || 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"
65 $ cat .hgtags
29 hg tag -l -d "1000000 0" -r 1 "bleah1"
66 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 bleah
30 hg tag -d "1000000 0" gack gawk gorp
67 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 bleah0
31 hg tag -d "1000000 0" -f gack
68 868cc8fbb43b754ad09fa109885d243fc49adae7 gack
32 hg tag -d "1000000 0" --remove gack gorp
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
80 $ hg update 0
35 cat .hg/localtags
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
88 $ hg tag -l 'xx
38 hg tag -d "1000000 0" "foobar"
89 > newline'
39 cat .hgtags
90 abort: '\n' cannot be used in a tag name
40 cat .hg/localtags
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
96 $ cd ..
43 newline'
97 $ hg -R test log -r0:5
44 hg tag -l 'xx:xx'
98 changeset: 0:0acdaf898367
45
99 tag: bleah
46 echo % cloning local tags
100 tag: bleah0
47 cd ..
101 tag: foobar
48 hg -R test log -r0:5
102 user: test
49 hg clone -q -rbleah1 test test1
103 date: Mon Jan 12 13:46:40 1970 +0000
50 hg -R test1 parents --style=compact
104 summary: test
51 hg clone -q -r5 test#bleah1 test2
105
52 hg -R test2 parents --style=compact
106 changeset: 1:3ecf002a1c57
53 hg clone -q -U test#bleah1 test3
107 tag: bleah1
54 hg -R test3 parents --style=compact
108 user: test
55
109 date: Mon Jan 12 13:46:40 1970 +0000
56 cd test
110 summary: Added tag bleah for changeset 0acdaf898367
57 echo % issue 601
111
58 python << EOF
112 changeset: 2:868cc8fbb43b
59 f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
113 tag: gawk
60 f = file('.hg/localtags', 'w'); f.write(last); f.close()
114 user: test
61 EOF
115 date: Mon Jan 12 13:46:40 1970 +0000
62 cat .hg/localtags
116 summary: Added tag bleah0 for changeset 0acdaf898367
63 hg tag -l localnewline
117
64 cat .hg/localtags
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
146 $ cd test
67 f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
147
68 f = file('.hgtags', 'w'); f.write(last); f.close()
148 issue 601
69 EOF
149
70 hg ci -d '1000000 0' -m'broken manual edit of .hgtags'
150 $ python << EOF
71 cat .hgtags
151 > f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
72 hg tag -d '1000000 0' newline
152 > f = file('.hg/localtags', 'w'); f.write(last); f.close()
73 cat .hgtags
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
162 $ python << EOF
76 hg branch tag-and-branch-same-name
163 > f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
77 hg ci -m"discouraged"
164 > f = file('.hgtags', 'w'); f.write(last); f.close()
78 hg tag tag-and-branch-same-name
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'
177 $ hg branch tag-and-branch-same-name
81 cat > $HGTMP/editor <<'__EOF__'
178 marked working directory as branch tag-and-branch-same-name
82 #!/bin/sh
179 $ hg ci -m"discouraged"
83 echo "custom tag message" > "$1"
180 $ hg tag tag-and-branch-same-name
84 echo "second line" >> "$1"
181 warning: tag tag-and-branch-same-name conflicts with existing branch name
85 __EOF__
182
86 chmod +x "$HGTMP"/editor
183 test custom commit messages
87 HGEDITOR="'$HGTMP'"/editor hg tag custom-tag -e
184
88 hg log -l1 --template "{desc}\n"
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
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now