##// END OF EJS Templates
tests: invoke hg command indirectly from shell script to run on Windows...
FUJIWARA Katsunori -
r23951:42f3042c stable
parent child Browse files
Show More
@@ -1,612 +1,615 b''
1 $ hg init test
1 $ hg init test
2 $ cd test
2 $ cd test
3
3
4 $ echo a > a
4 $ echo a > a
5 $ hg add a
5 $ hg add a
6 $ hg commit -m "test"
6 $ hg commit -m "test"
7 $ hg history
7 $ hg history
8 changeset: 0:acb14030fe0a
8 changeset: 0:acb14030fe0a
9 tag: tip
9 tag: tip
10 user: test
10 user: test
11 date: Thu Jan 01 00:00:00 1970 +0000
11 date: Thu Jan 01 00:00:00 1970 +0000
12 summary: test
12 summary: test
13
13
14
14
15 $ hg tag ' '
15 $ hg tag ' '
16 abort: tag names cannot consist entirely of whitespace
16 abort: tag names cannot consist entirely of whitespace
17 [255]
17 [255]
18
18
19 (this tests also that editor is not invoked, if '--edit' is not
19 (this tests also that editor is not invoked, if '--edit' is not
20 specified)
20 specified)
21
21
22 $ HGEDITOR=cat hg tag "bleah"
22 $ HGEDITOR=cat hg tag "bleah"
23 $ hg history
23 $ hg history
24 changeset: 1:d4f0d2909abc
24 changeset: 1:d4f0d2909abc
25 tag: tip
25 tag: tip
26 user: test
26 user: test
27 date: Thu Jan 01 00:00:00 1970 +0000
27 date: Thu Jan 01 00:00:00 1970 +0000
28 summary: Added tag bleah for changeset acb14030fe0a
28 summary: Added tag bleah for changeset acb14030fe0a
29
29
30 changeset: 0:acb14030fe0a
30 changeset: 0:acb14030fe0a
31 tag: bleah
31 tag: bleah
32 user: test
32 user: test
33 date: Thu Jan 01 00:00:00 1970 +0000
33 date: Thu Jan 01 00:00:00 1970 +0000
34 summary: test
34 summary: test
35
35
36
36
37 $ echo foo >> .hgtags
37 $ echo foo >> .hgtags
38 $ hg tag "bleah2"
38 $ hg tag "bleah2"
39 abort: working copy of .hgtags is changed
39 abort: working copy of .hgtags is changed
40 (please commit .hgtags manually)
40 (please commit .hgtags manually)
41 [255]
41 [255]
42
42
43 $ hg revert .hgtags
43 $ hg revert .hgtags
44 $ hg tag -r 0 x y z y y z
44 $ hg tag -r 0 x y z y y z
45 abort: tag names must be unique
45 abort: tag names must be unique
46 [255]
46 [255]
47 $ hg tag tap nada dot tip
47 $ hg tag tap nada dot tip
48 abort: the name 'tip' is reserved
48 abort: the name 'tip' is reserved
49 [255]
49 [255]
50 $ hg tag .
50 $ hg tag .
51 abort: the name '.' is reserved
51 abort: the name '.' is reserved
52 [255]
52 [255]
53 $ hg tag null
53 $ hg tag null
54 abort: the name 'null' is reserved
54 abort: the name 'null' is reserved
55 [255]
55 [255]
56 $ hg tag "bleah"
56 $ hg tag "bleah"
57 abort: tag 'bleah' already exists (use -f to force)
57 abort: tag 'bleah' already exists (use -f to force)
58 [255]
58 [255]
59 $ hg tag "blecch" "bleah"
59 $ hg tag "blecch" "bleah"
60 abort: tag 'bleah' already exists (use -f to force)
60 abort: tag 'bleah' already exists (use -f to force)
61 [255]
61 [255]
62
62
63 $ hg tag --remove "blecch"
63 $ hg tag --remove "blecch"
64 abort: tag 'blecch' does not exist
64 abort: tag 'blecch' does not exist
65 [255]
65 [255]
66 $ hg tag --remove "bleah" "blecch" "blough"
66 $ hg tag --remove "bleah" "blecch" "blough"
67 abort: tag 'blecch' does not exist
67 abort: tag 'blecch' does not exist
68 [255]
68 [255]
69
69
70 $ hg tag -r 0 "bleah0"
70 $ hg tag -r 0 "bleah0"
71 $ hg tag -l -r 1 "bleah1"
71 $ hg tag -l -r 1 "bleah1"
72 $ hg tag gack gawk gorp
72 $ hg tag gack gawk gorp
73 $ hg tag -f gack
73 $ hg tag -f gack
74 $ hg tag --remove gack gorp
74 $ hg tag --remove gack gorp
75
75
76 $ hg tag "bleah "
76 $ hg tag "bleah "
77 abort: tag 'bleah' already exists (use -f to force)
77 abort: tag 'bleah' already exists (use -f to force)
78 [255]
78 [255]
79 $ hg tag " bleah"
79 $ hg tag " bleah"
80 abort: tag 'bleah' already exists (use -f to force)
80 abort: tag 'bleah' already exists (use -f to force)
81 [255]
81 [255]
82 $ hg tag " bleah"
82 $ hg tag " bleah"
83 abort: tag 'bleah' already exists (use -f to force)
83 abort: tag 'bleah' already exists (use -f to force)
84 [255]
84 [255]
85 $ hg tag -r 0 " bleahbleah "
85 $ hg tag -r 0 " bleahbleah "
86 $ hg tag -r 0 " bleah bleah "
86 $ hg tag -r 0 " bleah bleah "
87
87
88 $ cat .hgtags
88 $ cat .hgtags
89 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
89 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
90 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0
90 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0
91 336fccc858a4eb69609a291105009e484a6b6b8d gack
91 336fccc858a4eb69609a291105009e484a6b6b8d gack
92 336fccc858a4eb69609a291105009e484a6b6b8d gawk
92 336fccc858a4eb69609a291105009e484a6b6b8d gawk
93 336fccc858a4eb69609a291105009e484a6b6b8d gorp
93 336fccc858a4eb69609a291105009e484a6b6b8d gorp
94 336fccc858a4eb69609a291105009e484a6b6b8d gack
94 336fccc858a4eb69609a291105009e484a6b6b8d gack
95 799667b6f2d9b957f73fa644a918c2df22bab58f gack
95 799667b6f2d9b957f73fa644a918c2df22bab58f gack
96 799667b6f2d9b957f73fa644a918c2df22bab58f gack
96 799667b6f2d9b957f73fa644a918c2df22bab58f gack
97 0000000000000000000000000000000000000000 gack
97 0000000000000000000000000000000000000000 gack
98 336fccc858a4eb69609a291105009e484a6b6b8d gorp
98 336fccc858a4eb69609a291105009e484a6b6b8d gorp
99 0000000000000000000000000000000000000000 gorp
99 0000000000000000000000000000000000000000 gorp
100 acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah
100 acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah
101 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah
101 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah
102
102
103 $ cat .hg/localtags
103 $ cat .hg/localtags
104 d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1
104 d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1
105
105
106 tagging on a non-head revision
106 tagging on a non-head revision
107
107
108 $ hg update 0
108 $ hg update 0
109 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
109 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
110 $ hg tag -l localblah
110 $ hg tag -l localblah
111 $ hg tag "foobar"
111 $ hg tag "foobar"
112 abort: not at a branch head (use -f to force)
112 abort: not at a branch head (use -f to force)
113 [255]
113 [255]
114 $ hg tag -f "foobar"
114 $ hg tag -f "foobar"
115 $ cat .hgtags
115 $ cat .hgtags
116 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
116 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
117 $ cat .hg/localtags
117 $ cat .hg/localtags
118 d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1
118 d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1
119 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
119 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
120
120
121 $ hg tag -l 'xx
121 $ hg tag -l 'xx
122 > newline'
122 > newline'
123 abort: '\n' cannot be used in a name
123 abort: '\n' cannot be used in a name
124 [255]
124 [255]
125 $ hg tag -l 'xx:xx'
125 $ hg tag -l 'xx:xx'
126 abort: ':' cannot be used in a name
126 abort: ':' cannot be used in a name
127 [255]
127 [255]
128
128
129 cloning local tags
129 cloning local tags
130
130
131 $ cd ..
131 $ cd ..
132 $ hg -R test log -r0:5
132 $ hg -R test log -r0:5
133 changeset: 0:acb14030fe0a
133 changeset: 0:acb14030fe0a
134 tag: bleah
134 tag: bleah
135 tag: bleah bleah
135 tag: bleah bleah
136 tag: bleah0
136 tag: bleah0
137 tag: bleahbleah
137 tag: bleahbleah
138 tag: foobar
138 tag: foobar
139 tag: localblah
139 tag: localblah
140 user: test
140 user: test
141 date: Thu Jan 01 00:00:00 1970 +0000
141 date: Thu Jan 01 00:00:00 1970 +0000
142 summary: test
142 summary: test
143
143
144 changeset: 1:d4f0d2909abc
144 changeset: 1:d4f0d2909abc
145 tag: bleah1
145 tag: bleah1
146 user: test
146 user: test
147 date: Thu Jan 01 00:00:00 1970 +0000
147 date: Thu Jan 01 00:00:00 1970 +0000
148 summary: Added tag bleah for changeset acb14030fe0a
148 summary: Added tag bleah for changeset acb14030fe0a
149
149
150 changeset: 2:336fccc858a4
150 changeset: 2:336fccc858a4
151 tag: gawk
151 tag: gawk
152 user: test
152 user: test
153 date: Thu Jan 01 00:00:00 1970 +0000
153 date: Thu Jan 01 00:00:00 1970 +0000
154 summary: Added tag bleah0 for changeset acb14030fe0a
154 summary: Added tag bleah0 for changeset acb14030fe0a
155
155
156 changeset: 3:799667b6f2d9
156 changeset: 3:799667b6f2d9
157 user: test
157 user: test
158 date: Thu Jan 01 00:00:00 1970 +0000
158 date: Thu Jan 01 00:00:00 1970 +0000
159 summary: Added tag gack, gawk, gorp for changeset 336fccc858a4
159 summary: Added tag gack, gawk, gorp for changeset 336fccc858a4
160
160
161 changeset: 4:154eeb7c0138
161 changeset: 4:154eeb7c0138
162 user: test
162 user: test
163 date: Thu Jan 01 00:00:00 1970 +0000
163 date: Thu Jan 01 00:00:00 1970 +0000
164 summary: Added tag gack for changeset 799667b6f2d9
164 summary: Added tag gack for changeset 799667b6f2d9
165
165
166 changeset: 5:b4bb47aaff09
166 changeset: 5:b4bb47aaff09
167 user: test
167 user: test
168 date: Thu Jan 01 00:00:00 1970 +0000
168 date: Thu Jan 01 00:00:00 1970 +0000
169 summary: Removed tag gack, gorp
169 summary: Removed tag gack, gorp
170
170
171 $ hg clone -q -rbleah1 test test1
171 $ hg clone -q -rbleah1 test test1
172 $ hg -R test1 parents --style=compact
172 $ hg -R test1 parents --style=compact
173 1[tip] d4f0d2909abc 1970-01-01 00:00 +0000 test
173 1[tip] d4f0d2909abc 1970-01-01 00:00 +0000 test
174 Added tag bleah for changeset acb14030fe0a
174 Added tag bleah for changeset acb14030fe0a
175
175
176 $ hg clone -q -r5 test#bleah1 test2
176 $ hg clone -q -r5 test#bleah1 test2
177 $ hg -R test2 parents --style=compact
177 $ hg -R test2 parents --style=compact
178 5[tip] b4bb47aaff09 1970-01-01 00:00 +0000 test
178 5[tip] b4bb47aaff09 1970-01-01 00:00 +0000 test
179 Removed tag gack, gorp
179 Removed tag gack, gorp
180
180
181 $ hg clone -q -U test#bleah1 test3
181 $ hg clone -q -U test#bleah1 test3
182 $ hg -R test3 parents --style=compact
182 $ hg -R test3 parents --style=compact
183
183
184 $ cd test
184 $ cd test
185
185
186 Issue601: hg tag doesn't do the right thing if .hgtags or localtags
186 Issue601: hg tag doesn't do the right thing if .hgtags or localtags
187 doesn't end with EOL
187 doesn't end with EOL
188
188
189 $ python << EOF
189 $ python << EOF
190 > f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
190 > f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
191 > f = file('.hg/localtags', 'w'); f.write(last); f.close()
191 > f = file('.hg/localtags', 'w'); f.write(last); f.close()
192 > EOF
192 > EOF
193 $ cat .hg/localtags; echo
193 $ cat .hg/localtags; echo
194 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
194 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
195 $ hg tag -l localnewline
195 $ hg tag -l localnewline
196 $ cat .hg/localtags; echo
196 $ cat .hg/localtags; echo
197 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
197 acb14030fe0a21b60322c440ad2d20cf7685a376 localblah
198 c2899151f4e76890c602a2597a650a72666681bf localnewline
198 c2899151f4e76890c602a2597a650a72666681bf localnewline
199
199
200
200
201 $ python << EOF
201 $ python << EOF
202 > f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
202 > f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
203 > f = file('.hgtags', 'w'); f.write(last); f.close()
203 > f = file('.hgtags', 'w'); f.write(last); f.close()
204 > EOF
204 > EOF
205 $ hg ci -m'broken manual edit of .hgtags'
205 $ hg ci -m'broken manual edit of .hgtags'
206 $ cat .hgtags; echo
206 $ cat .hgtags; echo
207 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
207 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
208 $ hg tag newline
208 $ hg tag newline
209 $ cat .hgtags; echo
209 $ cat .hgtags; echo
210 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
210 acb14030fe0a21b60322c440ad2d20cf7685a376 foobar
211 a0eea09de1eeec777b46f2085260a373b2fbc293 newline
211 a0eea09de1eeec777b46f2085260a373b2fbc293 newline
212
212
213
213
214 tag and branch using same name
214 tag and branch using same name
215
215
216 $ hg branch tag-and-branch-same-name
216 $ hg branch tag-and-branch-same-name
217 marked working directory as branch tag-and-branch-same-name
217 marked working directory as branch tag-and-branch-same-name
218 (branches are permanent and global, did you want a bookmark?)
218 (branches are permanent and global, did you want a bookmark?)
219 $ hg ci -m"discouraged"
219 $ hg ci -m"discouraged"
220 $ hg tag tag-and-branch-same-name
220 $ hg tag tag-and-branch-same-name
221 warning: tag tag-and-branch-same-name conflicts with existing branch name
221 warning: tag tag-and-branch-same-name conflicts with existing branch name
222
222
223 test custom commit messages
223 test custom commit messages
224
224
225 $ cat > editor.sh << '__EOF__'
225 $ cat > editor.sh << '__EOF__'
226 > echo "==== before editing"
226 > echo "==== before editing"
227 > cat "$1"
227 > cat "$1"
228 > echo "===="
228 > echo "===="
229 > echo "custom tag message" > "$1"
229 > echo "custom tag message" > "$1"
230 > echo "second line" >> "$1"
230 > echo "second line" >> "$1"
231 > __EOF__
231 > __EOF__
232
232
233 at first, test saving last-message.txt
233 at first, test saving last-message.txt
234
234
235 (test that editor is not invoked before transaction starting)
235 (test that editor is not invoked before transaction starting)
236
236
237 $ cat > .hg/hgrc << '__EOF__'
237 $ cat > .hg/hgrc << '__EOF__'
238 > [hooks]
238 > [hooks]
239 > # this failure occurs before editor invocation
239 > # this failure occurs before editor invocation
240 > pretag.test-saving-lastmessage = false
240 > pretag.test-saving-lastmessage = false
241 > __EOF__
241 > __EOF__
242 $ rm -f .hg/last-message.txt
242 $ rm -f .hg/last-message.txt
243 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
243 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
244 abort: pretag.test-saving-lastmessage hook exited with status 1
244 abort: pretag.test-saving-lastmessage hook exited with status 1
245 [255]
245 [255]
246 $ test -f .hg/last-message.txt
246 $ test -f .hg/last-message.txt
247 [1]
247 [1]
248
248
249 (test that editor is invoked and commit message is saved into
249 (test that editor is invoked and commit message is saved into
250 "last-message.txt")
250 "last-message.txt")
251
251
252 $ cat >> .hg/hgrc << '__EOF__'
252 $ cat >> .hg/hgrc << '__EOF__'
253 > [hooks]
253 > [hooks]
254 > pretag.test-saving-lastmessage =
254 > pretag.test-saving-lastmessage =
255 > # this failure occurs after editor invocation
255 > # this failure occurs after editor invocation
256 > pretxncommit.unexpectedabort = false
256 > pretxncommit.unexpectedabort = false
257 > __EOF__
257 > __EOF__
258
258
259 (this tests also that editor is invoked, if '--edit' is specified,
259 (this tests also that editor is invoked, if '--edit' is specified,
260 regardless of '--message')
260 regardless of '--message')
261
261
262 $ rm -f .hg/last-message.txt
262 $ rm -f .hg/last-message.txt
263 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e -m "foo bar"
263 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e -m "foo bar"
264 ==== before editing
264 ==== before editing
265 foo bar
265 foo bar
266
266
267
267
268 HG: Enter commit message. Lines beginning with 'HG:' are removed.
268 HG: Enter commit message. Lines beginning with 'HG:' are removed.
269 HG: Leave message empty to abort commit.
269 HG: Leave message empty to abort commit.
270 HG: --
270 HG: --
271 HG: user: test
271 HG: user: test
272 HG: branch 'tag-and-branch-same-name'
272 HG: branch 'tag-and-branch-same-name'
273 HG: changed .hgtags
273 HG: changed .hgtags
274 ====
274 ====
275 transaction abort!
275 transaction abort!
276 rollback completed
276 rollback completed
277 note: commit message saved in .hg/last-message.txt
277 note: commit message saved in .hg/last-message.txt
278 abort: pretxncommit.unexpectedabort hook exited with status 1
278 abort: pretxncommit.unexpectedabort hook exited with status 1
279 [255]
279 [255]
280 $ cat .hg/last-message.txt
280 $ cat .hg/last-message.txt
281 custom tag message
281 custom tag message
282 second line
282 second line
283
283
284 $ cat >> .hg/hgrc << '__EOF__'
284 $ cat >> .hg/hgrc << '__EOF__'
285 > [hooks]
285 > [hooks]
286 > pretxncommit.unexpectedabort =
286 > pretxncommit.unexpectedabort =
287 > __EOF__
287 > __EOF__
288 $ hg status .hgtags
288 $ hg status .hgtags
289 M .hgtags
289 M .hgtags
290 $ hg revert --no-backup -q .hgtags
290 $ hg revert --no-backup -q .hgtags
291
291
292 then, test custom commit message itself
292 then, test custom commit message itself
293
293
294 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
294 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
295 ==== before editing
295 ==== before editing
296 Added tag custom-tag for changeset 75a534207be6
296 Added tag custom-tag for changeset 75a534207be6
297
297
298
298
299 HG: Enter commit message. Lines beginning with 'HG:' are removed.
299 HG: Enter commit message. Lines beginning with 'HG:' are removed.
300 HG: Leave message empty to abort commit.
300 HG: Leave message empty to abort commit.
301 HG: --
301 HG: --
302 HG: user: test
302 HG: user: test
303 HG: branch 'tag-and-branch-same-name'
303 HG: branch 'tag-and-branch-same-name'
304 HG: changed .hgtags
304 HG: changed .hgtags
305 ====
305 ====
306 $ hg log -l1 --template "{desc}\n"
306 $ hg log -l1 --template "{desc}\n"
307 custom tag message
307 custom tag message
308 second line
308 second line
309
309
310
310
311 local tag with .hgtags modified
311 local tag with .hgtags modified
312
312
313 $ hg tag hgtags-modified
313 $ hg tag hgtags-modified
314 $ hg rollback
314 $ hg rollback
315 repository tip rolled back to revision 13 (undo commit)
315 repository tip rolled back to revision 13 (undo commit)
316 working directory now based on revision 13
316 working directory now based on revision 13
317 $ hg st
317 $ hg st
318 M .hgtags
318 M .hgtags
319 ? .hgtags.orig
319 ? .hgtags.orig
320 ? editor.sh
320 ? editor.sh
321 $ hg tag --local baz
321 $ hg tag --local baz
322 $ hg revert --no-backup .hgtags
322 $ hg revert --no-backup .hgtags
323
323
324
324
325 tagging when at named-branch-head that's not a topo-head
325 tagging when at named-branch-head that's not a topo-head
326
326
327 $ hg up default
327 $ hg up default
328 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
328 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
329 $ hg merge -t internal:local
329 $ hg merge -t internal:local
330 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
330 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
331 (branch merge, don't forget to commit)
331 (branch merge, don't forget to commit)
332 $ hg ci -m 'merge named branch'
332 $ hg ci -m 'merge named branch'
333 $ hg up 13
333 $ hg up 13
334 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
334 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
335 $ hg tag new-topo-head
335 $ hg tag new-topo-head
336
336
337 tagging on null rev
337 tagging on null rev
338
338
339 $ hg up null
339 $ hg up null
340 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
340 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
341 $ hg tag nullrev
341 $ hg tag nullrev
342 abort: not at a branch head (use -f to force)
342 abort: not at a branch head (use -f to force)
343 [255]
343 [255]
344
344
345 $ hg init empty
345 $ hg init empty
346 $ hg tag -R empty nullrev
346 $ hg tag -R empty nullrev
347 abort: cannot tag null revision
347 abort: cannot tag null revision
348 [255]
348 [255]
349
349
350 $ hg tag -R empty -r 00000000000 -f nulltag
350 $ hg tag -R empty -r 00000000000 -f nulltag
351 abort: cannot tag null revision
351 abort: cannot tag null revision
352 [255]
352 [255]
353
353
354 $ cd ..
354 $ cd ..
355
355
356 tagging on an uncommitted merge (issue2542)
356 tagging on an uncommitted merge (issue2542)
357
357
358 $ hg init repo-tag-uncommitted-merge
358 $ hg init repo-tag-uncommitted-merge
359 $ cd repo-tag-uncommitted-merge
359 $ cd repo-tag-uncommitted-merge
360 $ echo c1 > f1
360 $ echo c1 > f1
361 $ hg ci -Am0
361 $ hg ci -Am0
362 adding f1
362 adding f1
363 $ echo c2 > f2
363 $ echo c2 > f2
364 $ hg ci -Am1
364 $ hg ci -Am1
365 adding f2
365 adding f2
366 $ hg co -q 0
366 $ hg co -q 0
367 $ hg branch b1
367 $ hg branch b1
368 marked working directory as branch b1
368 marked working directory as branch b1
369 (branches are permanent and global, did you want a bookmark?)
369 (branches are permanent and global, did you want a bookmark?)
370 $ hg ci -m2
370 $ hg ci -m2
371 $ hg up default
371 $ hg up default
372 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
372 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
373 $ hg merge b1
373 $ hg merge b1
374 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
375 (branch merge, don't forget to commit)
375 (branch merge, don't forget to commit)
376
376
377 $ hg tag t1
377 $ hg tag t1
378 abort: uncommitted merge
378 abort: uncommitted merge
379 [255]
379 [255]
380 $ hg status
380 $ hg status
381 $ hg tag --rev 1 t2
381 $ hg tag --rev 1 t2
382 abort: uncommitted merge
382 abort: uncommitted merge
383 [255]
383 [255]
384 $ hg tag --rev 1 --local t3
384 $ hg tag --rev 1 --local t3
385 $ hg tags -v
385 $ hg tags -v
386 tip 2:2a156e8887cc
386 tip 2:2a156e8887cc
387 t3 1:c3adabd1a5f4 local
387 t3 1:c3adabd1a5f4 local
388
388
389 $ cd ..
389 $ cd ..
390
390
391 commit hook on tag used to be run without write lock - issue3344
391 commit hook on tag used to be run without write lock - issue3344
392
392
393 $ hg init repo-tag
393 $ hg init repo-tag
394 $ touch repo-tag/test
394 $ touch repo-tag/test
395 $ hg -R repo-tag commit -A -m "test"
395 $ hg -R repo-tag commit -A -m "test"
396 adding test
396 adding test
397 $ hg init repo-tag-target
397 $ hg init repo-tag-target
398 $ hg -R repo-tag --config hooks.commit="\"hg\" push \"`pwd`/repo-tag-target\"" tag tag
398 $ cat > "$TESTTMP/issue3344.sh" <<EOF
399 > hg push "$TESTTMP/repo-tag-target"
400 > EOF
401 $ hg -R repo-tag --config hooks.commit="sh ../issue3344.sh" tag tag
399 pushing to $TESTTMP/repo-tag-target (glob)
402 pushing to $TESTTMP/repo-tag-target (glob)
400 searching for changes
403 searching for changes
401 adding changesets
404 adding changesets
402 adding manifests
405 adding manifests
403 adding file changes
406 adding file changes
404 added 2 changesets with 2 changes to 2 files
407 added 2 changesets with 2 changes to 2 files
405
408
406 automatically merge resolvable tag conflicts (i.e. tags that differ in rank)
409 automatically merge resolvable tag conflicts (i.e. tags that differ in rank)
407 create two clones with some different tags as well as some common tags
410 create two clones with some different tags as well as some common tags
408 check that we can merge tags that differ in rank
411 check that we can merge tags that differ in rank
409
412
410 $ hg init repo-automatic-tag-merge
413 $ hg init repo-automatic-tag-merge
411 $ cd repo-automatic-tag-merge
414 $ cd repo-automatic-tag-merge
412 $ echo c0 > f0
415 $ echo c0 > f0
413 $ hg ci -A -m0
416 $ hg ci -A -m0
414 adding f0
417 adding f0
415 $ hg tag tbase
418 $ hg tag tbase
416 $ cd ..
419 $ cd ..
417 $ hg clone repo-automatic-tag-merge repo-automatic-tag-merge-clone
420 $ hg clone repo-automatic-tag-merge repo-automatic-tag-merge-clone
418 updating to branch default
421 updating to branch default
419 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
422 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
420 $ cd repo-automatic-tag-merge-clone
423 $ cd repo-automatic-tag-merge-clone
421 $ echo c1 > f1
424 $ echo c1 > f1
422 $ hg ci -A -m1
425 $ hg ci -A -m1
423 adding f1
426 adding f1
424 $ hg tag t1 t2 t3
427 $ hg tag t1 t2 t3
425 $ hg tag --remove t2
428 $ hg tag --remove t2
426 $ hg tag t5
429 $ hg tag t5
427 $ echo c2 > f2
430 $ echo c2 > f2
428 $ hg ci -A -m2
431 $ hg ci -A -m2
429 adding f2
432 adding f2
430 $ hg tag -f t3
433 $ hg tag -f t3
431
434
432 $ cd ../repo-automatic-tag-merge
435 $ cd ../repo-automatic-tag-merge
433 $ echo c3 > f3
436 $ echo c3 > f3
434 $ hg ci -A -m3
437 $ hg ci -A -m3
435 adding f3
438 adding f3
436 $ hg tag -f t4 t5 t6
439 $ hg tag -f t4 t5 t6
437 $ hg tag --remove t5
440 $ hg tag --remove t5
438 $ echo c4 > f4
441 $ echo c4 > f4
439 $ hg ci -A -m4
442 $ hg ci -A -m4
440 adding f4
443 adding f4
441 $ hg tag t2
444 $ hg tag t2
442 $ hg tag -f t6
445 $ hg tag -f t6
443
446
444 $ cd ../repo-automatic-tag-merge-clone
447 $ cd ../repo-automatic-tag-merge-clone
445 $ hg pull
448 $ hg pull
446 pulling from $TESTTMP/repo-automatic-tag-merge (glob)
449 pulling from $TESTTMP/repo-automatic-tag-merge (glob)
447 searching for changes
450 searching for changes
448 adding changesets
451 adding changesets
449 adding manifests
452 adding manifests
450 adding file changes
453 adding file changes
451 added 6 changesets with 6 changes to 3 files (+1 heads)
454 added 6 changesets with 6 changes to 3 files (+1 heads)
452 (run 'hg heads' to see heads, 'hg merge' to merge)
455 (run 'hg heads' to see heads, 'hg merge' to merge)
453 $ hg merge --tool internal:tagmerge
456 $ hg merge --tool internal:tagmerge
454 merging .hgtags
457 merging .hgtags
455 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
458 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
456 (branch merge, don't forget to commit)
459 (branch merge, don't forget to commit)
457 $ hg status
460 $ hg status
458 M .hgtags
461 M .hgtags
459 M f3
462 M f3
460 M f4
463 M f4
461 $ hg resolve -l
464 $ hg resolve -l
462 R .hgtags
465 R .hgtags
463 $ cat .hgtags
466 $ cat .hgtags
464 9aa4e1292a27a248f8d07339bed9931d54907be7 t4
467 9aa4e1292a27a248f8d07339bed9931d54907be7 t4
465 9aa4e1292a27a248f8d07339bed9931d54907be7 t6
468 9aa4e1292a27a248f8d07339bed9931d54907be7 t6
466 9aa4e1292a27a248f8d07339bed9931d54907be7 t6
469 9aa4e1292a27a248f8d07339bed9931d54907be7 t6
467 09af2ce14077a94effef208b49a718f4836d4338 t6
470 09af2ce14077a94effef208b49a718f4836d4338 t6
468 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
471 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
469 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
472 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
470 929bca7b18d067cbf3844c3896319a940059d748 t2
473 929bca7b18d067cbf3844c3896319a940059d748 t2
471 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
474 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
472 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
475 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
473 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
476 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
474 0000000000000000000000000000000000000000 t2
477 0000000000000000000000000000000000000000 t2
475 875517b4806a848f942811a315a5bce30804ae85 t5
478 875517b4806a848f942811a315a5bce30804ae85 t5
476 9aa4e1292a27a248f8d07339bed9931d54907be7 t5
479 9aa4e1292a27a248f8d07339bed9931d54907be7 t5
477 9aa4e1292a27a248f8d07339bed9931d54907be7 t5
480 9aa4e1292a27a248f8d07339bed9931d54907be7 t5
478 0000000000000000000000000000000000000000 t5
481 0000000000000000000000000000000000000000 t5
479 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
482 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
480 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
483 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
481
484
482 check that the merge tried to minimize the diff with the first merge parent
485 check that the merge tried to minimize the diff with the first merge parent
483
486
484 $ hg diff --git -r 'p1()' .hgtags
487 $ hg diff --git -r 'p1()' .hgtags
485 diff --git a/.hgtags b/.hgtags
488 diff --git a/.hgtags b/.hgtags
486 --- a/.hgtags
489 --- a/.hgtags
487 +++ b/.hgtags
490 +++ b/.hgtags
488 @@ -1,9 +1,17 @@
491 @@ -1,9 +1,17 @@
489 +9aa4e1292a27a248f8d07339bed9931d54907be7 t4
492 +9aa4e1292a27a248f8d07339bed9931d54907be7 t4
490 +9aa4e1292a27a248f8d07339bed9931d54907be7 t6
493 +9aa4e1292a27a248f8d07339bed9931d54907be7 t6
491 +9aa4e1292a27a248f8d07339bed9931d54907be7 t6
494 +9aa4e1292a27a248f8d07339bed9931d54907be7 t6
492 +09af2ce14077a94effef208b49a718f4836d4338 t6
495 +09af2ce14077a94effef208b49a718f4836d4338 t6
493 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
496 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
494 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
497 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
495 +929bca7b18d067cbf3844c3896319a940059d748 t2
498 +929bca7b18d067cbf3844c3896319a940059d748 t2
496 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
499 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
497 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
500 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
498 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
501 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
499 0000000000000000000000000000000000000000 t2
502 0000000000000000000000000000000000000000 t2
500 875517b4806a848f942811a315a5bce30804ae85 t5
503 875517b4806a848f942811a315a5bce30804ae85 t5
501 +9aa4e1292a27a248f8d07339bed9931d54907be7 t5
504 +9aa4e1292a27a248f8d07339bed9931d54907be7 t5
502 +9aa4e1292a27a248f8d07339bed9931d54907be7 t5
505 +9aa4e1292a27a248f8d07339bed9931d54907be7 t5
503 +0000000000000000000000000000000000000000 t5
506 +0000000000000000000000000000000000000000 t5
504 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
507 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
505 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
508 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
506
509
507 detect merge tag conflicts
510 detect merge tag conflicts
508
511
509 $ hg update -C -r tip
512 $ hg update -C -r tip
510 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
513 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
511 $ hg tag t7
514 $ hg tag t7
512 $ hg update -C -r 'first(sort(head()))'
515 $ hg update -C -r 'first(sort(head()))'
513 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
516 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
514 $ printf "%s %s\n" `hg log -r . --template "{node} t7"` >> .hgtags
517 $ printf "%s %s\n" `hg log -r . --template "{node} t7"` >> .hgtags
515 $ hg commit -m "manually add conflicting t7 tag"
518 $ hg commit -m "manually add conflicting t7 tag"
516 $ hg merge --tool internal:tagmerge
519 $ hg merge --tool internal:tagmerge
517 merging .hgtags
520 merging .hgtags
518 automatic .hgtags merge failed
521 automatic .hgtags merge failed
519 the following 1 tags are in conflict: t7
522 the following 1 tags are in conflict: t7
520 automatic tag merging of .hgtags failed! (use 'hg resolve --tool :merge' or another merge tool of your choice)
523 automatic tag merging of .hgtags failed! (use 'hg resolve --tool :merge' or another merge tool of your choice)
521 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
524 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
522 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
525 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
523 [1]
526 [1]
524 $ hg resolve -l
527 $ hg resolve -l
525 U .hgtags
528 U .hgtags
526 $ cat .hgtags
529 $ cat .hgtags
527 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
530 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
528 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
531 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
529 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
532 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
530 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
533 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
531 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
534 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
532 0000000000000000000000000000000000000000 t2
535 0000000000000000000000000000000000000000 t2
533 875517b4806a848f942811a315a5bce30804ae85 t5
536 875517b4806a848f942811a315a5bce30804ae85 t5
534 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
537 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
535 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
538 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
536 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
539 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
537
540
538 $ cd ..
541 $ cd ..
539
542
540 handle the loss of tags
543 handle the loss of tags
541
544
542 $ hg clone repo-automatic-tag-merge-clone repo-merge-lost-tags
545 $ hg clone repo-automatic-tag-merge-clone repo-merge-lost-tags
543 updating to branch default
546 updating to branch default
544 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
547 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
545 $ cd repo-merge-lost-tags
548 $ cd repo-merge-lost-tags
546 $ echo c5 > f5
549 $ echo c5 > f5
547 $ hg ci -A -m5
550 $ hg ci -A -m5
548 adding f5
551 adding f5
549 $ hg tag -f t7
552 $ hg tag -f t7
550 $ hg update -r 'p1(t7)'
553 $ hg update -r 'p1(t7)'
551 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
554 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
552 $ printf '' > .hgtags
555 $ printf '' > .hgtags
553 $ hg commit -m 'delete all tags'
556 $ hg commit -m 'delete all tags'
554 created new head
557 created new head
555 $ hg log -r 'max(t7::)'
558 $ hg log -r 'max(t7::)'
556 changeset: 17:ffe462b50880
559 changeset: 17:ffe462b50880
557 user: test
560 user: test
558 date: Thu Jan 01 00:00:00 1970 +0000
561 date: Thu Jan 01 00:00:00 1970 +0000
559 summary: Added tag t7 for changeset fd3a9e394ce3
562 summary: Added tag t7 for changeset fd3a9e394ce3
560
563
561 $ hg update -r 'max(t7::)'
564 $ hg update -r 'max(t7::)'
562 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
565 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
563 $ hg merge -r tip --tool internal:tagmerge
566 $ hg merge -r tip --tool internal:tagmerge
564 merging .hgtags
567 merging .hgtags
565 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
568 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
566 (branch merge, don't forget to commit)
569 (branch merge, don't forget to commit)
567 $ hg resolve -l
570 $ hg resolve -l
568 R .hgtags
571 R .hgtags
569 $ cat .hgtags
572 $ cat .hgtags
570 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
573 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
571 0000000000000000000000000000000000000000 tbase
574 0000000000000000000000000000000000000000 tbase
572 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
575 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
573 0000000000000000000000000000000000000000 t1
576 0000000000000000000000000000000000000000 t1
574 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
577 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
575 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
578 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
576 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
579 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
577 0000000000000000000000000000000000000000 t2
580 0000000000000000000000000000000000000000 t2
578 875517b4806a848f942811a315a5bce30804ae85 t5
581 875517b4806a848f942811a315a5bce30804ae85 t5
579 0000000000000000000000000000000000000000 t5
582 0000000000000000000000000000000000000000 t5
580 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
583 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
581 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
584 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
582 0000000000000000000000000000000000000000 t3
585 0000000000000000000000000000000000000000 t3
583 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
586 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
584 0000000000000000000000000000000000000000 t7
587 0000000000000000000000000000000000000000 t7
585 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
588 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
586 fd3a9e394ce3afb354a496323bf68ac1755a30de t7
589 fd3a9e394ce3afb354a496323bf68ac1755a30de t7
587
590
588 also check that we minimize the diff with the 1st merge parent
591 also check that we minimize the diff with the 1st merge parent
589
592
590 $ hg diff --git -r 'p1()' .hgtags
593 $ hg diff --git -r 'p1()' .hgtags
591 diff --git a/.hgtags b/.hgtags
594 diff --git a/.hgtags b/.hgtags
592 --- a/.hgtags
595 --- a/.hgtags
593 +++ b/.hgtags
596 +++ b/.hgtags
594 @@ -1,12 +1,17 @@
597 @@ -1,12 +1,17 @@
595 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
598 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase
596 +0000000000000000000000000000000000000000 tbase
599 +0000000000000000000000000000000000000000 tbase
597 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
600 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1
598 +0000000000000000000000000000000000000000 t1
601 +0000000000000000000000000000000000000000 t1
599 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
602 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
600 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
603 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
601 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
604 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2
602 0000000000000000000000000000000000000000 t2
605 0000000000000000000000000000000000000000 t2
603 875517b4806a848f942811a315a5bce30804ae85 t5
606 875517b4806a848f942811a315a5bce30804ae85 t5
604 +0000000000000000000000000000000000000000 t5
607 +0000000000000000000000000000000000000000 t5
605 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
608 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3
606 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
609 79505d5360b07e3e79d1052e347e73c02b8afa5b t3
607 +0000000000000000000000000000000000000000 t3
610 +0000000000000000000000000000000000000000 t3
608 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
611 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
609 +0000000000000000000000000000000000000000 t7
612 +0000000000000000000000000000000000000000 t7
610 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
613 ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7
611 fd3a9e394ce3afb354a496323bf68ac1755a30de t7
614 fd3a9e394ce3afb354a496323bf68ac1755a30de t7
612
615
General Comments 0
You need to be logged in to leave comments. Login now