##// END OF EJS Templates
prepush: show details about new remote heads with --verbose...
Adrian Buehlmann -
r14526:4276e320 default
parent child Browse files
Show More
@@ -1,191 +1,191 b''
1 1 # discovery.py - protocol changeset discovery functions
2 2 #
3 3 # Copyright 2010 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from node import nullid, short
9 9 from i18n import _
10 10 import util, setdiscovery, treediscovery
11 11
12 12 def findcommonincoming(repo, remote, heads=None, force=False):
13 13 """Return a tuple (common, anyincoming, heads) used to identify the common
14 14 subset of nodes between repo and remote.
15 15
16 16 "common" is a list of (at least) the heads of the common subset.
17 17 "anyincoming" is testable as a boolean indicating if any nodes are missing
18 18 locally. If remote does not support getbundle, this actually is a list of
19 19 roots of the nodes that would be incoming, to be supplied to
20 20 changegroupsubset. No code except for pull should be relying on this fact
21 21 any longer.
22 22 "heads" is either the supplied heads, or else the remote's heads.
23 23
24 24 If you pass heads and they are all known locally, the reponse lists justs
25 25 these heads in "common" and in "heads".
26 26
27 27 Please use findcommonoutgoing to compute the set of outgoing nodes to give
28 28 extensions a good hook into outgoing.
29 29 """
30 30
31 31 if not remote.capable('getbundle'):
32 32 return treediscovery.findcommonincoming(repo, remote, heads, force)
33 33
34 34 if heads:
35 35 allknown = True
36 36 nm = repo.changelog.nodemap
37 37 for h in heads:
38 38 if nm.get(h) is None:
39 39 allknown = False
40 40 break
41 41 if allknown:
42 42 return (heads, False, heads)
43 43
44 44 res = setdiscovery.findcommonheads(repo.ui, repo, remote,
45 45 abortwhenunrelated=not force)
46 46 common, anyinc, srvheads = res
47 47 return (list(common), anyinc, heads or list(srvheads))
48 48
49 49 def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None):
50 50 '''Return a tuple (common, anyoutgoing, heads) used to identify the set
51 51 of nodes present in repo but not in other.
52 52
53 53 If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive)
54 54 are included. If you already know the local repo's heads, passing them in
55 55 onlyheads is faster than letting them be recomputed here.
56 56
57 57 If commoninc is given, it must the the result of a prior call to
58 58 findcommonincoming(repo, other, force) to avoid recomputing it here.
59 59
60 60 The returned tuple is meant to be passed to changelog.findmissing.'''
61 61 common, _any, _hds = commoninc or findcommonincoming(repo, other, force=force)
62 62 return (common, onlyheads or repo.heads())
63 63
64 64 def prepush(repo, remote, force, revs, newbranch):
65 65 '''Analyze the local and remote repositories and determine which
66 66 changesets need to be pushed to the remote. Return value depends
67 67 on circumstances:
68 68
69 69 If we are not going to push anything, return a tuple (None,
70 70 outgoing) where outgoing is 0 if there are no outgoing
71 71 changesets and 1 if there are, but we refuse to push them
72 72 (e.g. would create new remote heads).
73 73
74 74 Otherwise, return a tuple (changegroup, remoteheads), where
75 75 changegroup is a readable file-like object whose read() returns
76 76 successive changegroup chunks ready to be sent over the wire and
77 77 remoteheads is the list of remote heads.'''
78 78 commoninc = findcommonincoming(repo, remote, force=force)
79 79 common, revs = findcommonoutgoing(repo, remote, onlyheads=revs,
80 80 commoninc=commoninc, force=force)
81 81 _common, inc, remoteheads = commoninc
82 82
83 83 cl = repo.changelog
84 84 outg = cl.findmissing(common, revs)
85 85
86 86 if not outg:
87 87 repo.ui.status(_("no changes found\n"))
88 88 return None, 1
89 89
90 90 if not force and remoteheads != [nullid]:
91 91 if remote.capable('branchmap'):
92 92 # Check for each named branch if we're creating new remote heads.
93 93 # To be a remote head after push, node must be either:
94 94 # - unknown locally
95 95 # - a local outgoing head descended from update
96 96 # - a remote head that's known locally and not
97 97 # ancestral to an outgoing head
98 98
99 99 # 1. Create set of branches involved in the push.
100 100 branches = set(repo[n].branch() for n in outg)
101 101
102 102 # 2. Check for new branches on the remote.
103 103 remotemap = remote.branchmap()
104 104 newbranches = branches - set(remotemap)
105 105 if newbranches and not newbranch: # new branch requires --new-branch
106 106 branchnames = ', '.join(sorted(newbranches))
107 107 raise util.Abort(_("push creates new remote branches: %s!")
108 108 % branchnames,
109 109 hint=_("use 'hg push --new-branch' to create"
110 110 " new remote branches"))
111 111 branches.difference_update(newbranches)
112 112
113 113 # 3. Construct the initial oldmap and newmap dicts.
114 114 # They contain information about the remote heads before and
115 115 # after the push, respectively.
116 116 # Heads not found locally are not included in either dict,
117 117 # since they won't be affected by the push.
118 118 # unsynced contains all branches with incoming changesets.
119 119 oldmap = {}
120 120 newmap = {}
121 121 unsynced = set()
122 122 for branch in branches:
123 123 remotebrheads = remotemap[branch]
124 124 prunedbrheads = [h for h in remotebrheads if h in cl.nodemap]
125 125 oldmap[branch] = prunedbrheads
126 126 newmap[branch] = list(prunedbrheads)
127 127 if len(remotebrheads) > len(prunedbrheads):
128 128 unsynced.add(branch)
129 129
130 130 # 4. Update newmap with outgoing changes.
131 131 # This will possibly add new heads and remove existing ones.
132 132 ctxgen = (repo[n] for n in outg)
133 133 repo._updatebranchcache(newmap, ctxgen)
134 134
135 135 else:
136 136 # 1-4b. old servers: Check for new topological heads.
137 137 # Construct {old,new}map with branch = None (topological branch).
138 138 # (code based on _updatebranchcache)
139 139 oldheads = set(h for h in remoteheads if h in cl.nodemap)
140 140 newheads = oldheads.union(outg)
141 141 if len(newheads) > 1:
142 142 for latest in reversed(outg):
143 143 if latest not in newheads:
144 144 continue
145 145 minhrev = min(cl.rev(h) for h in newheads)
146 146 reachable = cl.reachable(latest, cl.node(minhrev))
147 147 reachable.remove(latest)
148 148 newheads.difference_update(reachable)
149 149 branches = set([None])
150 150 newmap = {None: newheads}
151 151 oldmap = {None: oldheads}
152 152 unsynced = inc and branches or set()
153 153
154 154 # 5. Check for new heads.
155 155 # If there are more heads after the push than before, a suitable
156 156 # error message, depending on unsynced status, is displayed.
157 157 error = None
158 158 for branch in branches:
159 159 newhs = set(newmap[branch])
160 160 oldhs = set(oldmap[branch])
161 161 if len(newhs) > len(oldhs):
162 162 dhs = list(newhs - oldhs)
163 163 if error is None:
164 164 if branch != 'default':
165 165 error = _("push creates new remote head %s "
166 166 "on branch '%s'!") % (short(dhs[0]), branch)
167 167 else:
168 168 error = _("push creates new remote head %s!"
169 169 ) % short(dhs[0])
170 170 if branch in unsynced:
171 171 hint = _("you should pull and merge or "
172 172 "use push -f to force")
173 173 else:
174 174 hint = _("did you forget to merge? "
175 175 "use push -f to force")
176 repo.ui.debug("new remote heads on branch '%s'\n" % branch)
176 repo.ui.note("new remote heads on branch '%s'\n" % branch)
177 177 for h in dhs:
178 repo.ui.debug("new remote head %s\n" % short(h))
178 repo.ui.note("new remote head %s\n" % short(h))
179 179 if error:
180 180 raise util.Abort(error, hint=hint)
181 181
182 182 # 6. Check for unsynced changes on involved branches.
183 183 if unsynced:
184 184 repo.ui.warn(_("note: unsynced remote changes!\n"))
185 185
186 186 if revs is None:
187 187 # use the fast path, no race possible on push
188 188 cg = repo._changegroup(outg, 'push')
189 189 else:
190 190 cg = repo.getbundle('push', heads=revs, common=common)
191 191 return cg, remoteheads
@@ -1,714 +1,720 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "graphlog=" >> $HGRCPATH
3 3
4 4 $ hg init a
5 5 $ cd a
6 6 $ echo foo > t1
7 7 $ hg add t1
8 8 $ hg commit -m "1"
9 9
10 10 $ cd ..
11 11 $ hg clone a b
12 12 updating to branch default
13 13 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
14 14
15 15 $ cd a
16 16 $ echo foo > t2
17 17 $ hg add t2
18 18 $ hg commit -m "2"
19 19
20 20 $ cd ../b
21 21 $ echo foo > t3
22 22 $ hg add t3
23 23 $ hg commit -m "3"
24 24
25 25 $ hg push ../a
26 26 pushing to ../a
27 27 searching for changes
28 28 abort: push creates new remote head 1e108cc5548c!
29 29 (you should pull and merge or use push -f to force)
30 30 [255]
31 31
32 32 $ hg push --debug ../a
33 33 pushing to ../a
34 34 query 1; heads
35 35 searching for changes
36 36 taking quick initial sample
37 37 searching: 2 queries
38 38 query 2; still undecided: 2, sample size is: 2
39 39 2 total queries
40 40 new remote heads on branch 'default'
41 41 new remote head 1e108cc5548c
42 42 abort: push creates new remote head 1e108cc5548c!
43 43 (you should pull and merge or use push -f to force)
44 44 [255]
45 45
46 46 $ hg pull ../a
47 47 pulling from ../a
48 48 searching for changes
49 49 adding changesets
50 50 adding manifests
51 51 adding file changes
52 52 added 1 changesets with 1 changes to 1 files (+1 heads)
53 53 (run 'hg heads' to see heads, 'hg merge' to merge)
54 54
55 55 $ hg push ../a
56 56 pushing to ../a
57 57 searching for changes
58 58 abort: push creates new remote head 1e108cc5548c!
59 59 (did you forget to merge? use push -f to force)
60 60 [255]
61 61
62 62 $ hg merge
63 63 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 64 (branch merge, don't forget to commit)
65 65
66 66 $ hg commit -m "4"
67 67 $ hg push ../a
68 68 pushing to ../a
69 69 searching for changes
70 70 adding changesets
71 71 adding manifests
72 72 adding file changes
73 73 added 2 changesets with 1 changes to 1 files
74 74
75 75 $ cd ..
76 76
77 77 $ hg init c
78 78 $ cd c
79 79 $ for i in 0 1 2; do
80 80 > echo $i >> foo
81 81 > hg ci -Am $i
82 82 > done
83 83 adding foo
84 84 $ cd ..
85 85
86 86 $ hg clone c d
87 87 updating to branch default
88 88 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 89
90 90 $ cd d
91 91 $ for i in 0 1; do
92 92 > hg co -C $i
93 93 > echo d-$i >> foo
94 94 > hg ci -m d-$i
95 95 > done
96 96 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 97 created new head
98 98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 99 created new head
100 100
101 101 $ HGMERGE=true hg merge 3
102 102 merging foo
103 103 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
104 104 (branch merge, don't forget to commit)
105 105
106 106 $ hg ci -m c-d
107 107
108 108 $ hg push ../c
109 109 pushing to ../c
110 110 searching for changes
111 111 abort: push creates new remote head 6346d66eb9f5!
112 112 (did you forget to merge? use push -f to force)
113 113 [255]
114 114
115 115 $ hg push -r 2 ../c
116 116 pushing to ../c
117 117 searching for changes
118 118 no changes found
119 119
120 120 $ hg push -r 3 ../c
121 121 pushing to ../c
122 122 searching for changes
123 123 abort: push creates new remote head a5dda829a167!
124 124 (did you forget to merge? use push -f to force)
125 125 [255]
126 126
127 $ hg push -r 3 -r 4 ../c
127 $ hg push -v -r 3 -r 4 ../c
128 128 pushing to ../c
129 129 searching for changes
130 all remote heads known locally
131 new remote heads on branch 'default'
132 new remote head a5dda829a167
133 new remote head ee8fbc7a0295
130 134 abort: push creates new remote head a5dda829a167!
131 135 (did you forget to merge? use push -f to force)
132 136 [255]
133 137
134 $ hg push -f -r 3 -r 4 ../c
138 $ hg push -v -f -r 3 -r 4 ../c
135 139 pushing to ../c
136 140 searching for changes
141 all remote heads known locally
142 2 changesets found
137 143 adding changesets
138 144 adding manifests
139 145 adding file changes
140 146 added 2 changesets with 2 changes to 1 files (+2 heads)
141 147
142 148 $ hg push -r 5 ../c
143 149 pushing to ../c
144 150 searching for changes
145 151 adding changesets
146 152 adding manifests
147 153 adding file changes
148 154 added 1 changesets with 1 changes to 1 files (-1 heads)
149 155
150 156 $ hg in ../c
151 157 comparing with ../c
152 158 searching for changes
153 159 no changes found
154 160 [1]
155 161
156 162
157 163 Issue450: push -r warns about remote head creation even if no heads
158 164 will be created
159 165
160 166 $ hg init ../e
161 167 $ hg push -r 0 ../e
162 168 pushing to ../e
163 169 searching for changes
164 170 adding changesets
165 171 adding manifests
166 172 adding file changes
167 173 added 1 changesets with 1 changes to 1 files
168 174
169 175 $ hg push -r 1 ../e
170 176 pushing to ../e
171 177 searching for changes
172 178 adding changesets
173 179 adding manifests
174 180 adding file changes
175 181 added 1 changesets with 1 changes to 1 files
176 182
177 183 $ cd ..
178 184
179 185
180 186 Issue736: named branches are not considered for detection of
181 187 unmerged heads in "hg push"
182 188
183 189 $ hg init f
184 190 $ cd f
185 191 $ hg -q branch a
186 192 $ echo 0 > foo
187 193 $ hg -q ci -Am 0
188 194 $ echo 1 > foo
189 195 $ hg -q ci -m 1
190 196 $ hg -q up 0
191 197 $ echo 2 > foo
192 198 $ hg -q ci -m 2
193 199 $ hg -q up 0
194 200 $ hg -q branch b
195 201 $ echo 3 > foo
196 202 $ hg -q ci -m 3
197 203 $ cd ..
198 204
199 205 $ hg -q clone f g
200 206 $ cd g
201 207
202 208 Push on existing branch and new branch:
203 209
204 210 $ hg -q up 1
205 211 $ echo 4 > foo
206 212 $ hg -q ci -m 4
207 213 $ hg -q up 0
208 214 $ echo 5 > foo
209 215 $ hg -q branch c
210 216 $ hg -q ci -m 5
211 217
212 218 $ hg push ../f
213 219 pushing to ../f
214 220 searching for changes
215 221 abort: push creates new remote branches: c!
216 222 (use 'hg push --new-branch' to create new remote branches)
217 223 [255]
218 224
219 225 $ hg push -r 4 -r 5 ../f
220 226 pushing to ../f
221 227 searching for changes
222 228 abort: push creates new remote branches: c!
223 229 (use 'hg push --new-branch' to create new remote branches)
224 230 [255]
225 231
226 232
227 233 Multiple new branches:
228 234
229 235 $ hg -q branch d
230 236 $ echo 6 > foo
231 237 $ hg -q ci -m 6
232 238
233 239 $ hg push ../f
234 240 pushing to ../f
235 241 searching for changes
236 242 abort: push creates new remote branches: c, d!
237 243 (use 'hg push --new-branch' to create new remote branches)
238 244 [255]
239 245
240 246 $ hg push -r 4 -r 6 ../f
241 247 pushing to ../f
242 248 searching for changes
243 249 abort: push creates new remote branches: c, d!
244 250 (use 'hg push --new-branch' to create new remote branches)
245 251 [255]
246 252
247 253 $ cd ../g
248 254
249 255
250 256 Fail on multiple head push:
251 257
252 258 $ hg -q up 1
253 259 $ echo 7 > foo
254 260 $ hg -q ci -m 7
255 261
256 262 $ hg push -r 4 -r 7 ../f
257 263 pushing to ../f
258 264 searching for changes
259 265 abort: push creates new remote head 0b715ef6ff8f on branch 'a'!
260 266 (did you forget to merge? use push -f to force)
261 267 [255]
262 268
263 269 Push replacement head on existing branches:
264 270
265 271 $ hg -q up 3
266 272 $ echo 8 > foo
267 273 $ hg -q ci -m 8
268 274
269 275 $ hg push -r 7 -r 8 ../f
270 276 pushing to ../f
271 277 searching for changes
272 278 adding changesets
273 279 adding manifests
274 280 adding file changes
275 281 added 2 changesets with 2 changes to 1 files
276 282
277 283
278 284 Merge of branch a to other branch b followed by unrelated push
279 285 on branch a:
280 286
281 287 $ hg -q up 7
282 288 $ HGMERGE=true hg -q merge 8
283 289 $ hg -q ci -m 9
284 290 $ hg -q up 8
285 291 $ echo 10 > foo
286 292 $ hg -q ci -m 10
287 293
288 294 $ hg push -r 9 ../f
289 295 pushing to ../f
290 296 searching for changes
291 297 adding changesets
292 298 adding manifests
293 299 adding file changes
294 300 added 1 changesets with 1 changes to 1 files (-1 heads)
295 301
296 302 $ hg push -r 10 ../f
297 303 pushing to ../f
298 304 searching for changes
299 305 adding changesets
300 306 adding manifests
301 307 adding file changes
302 308 added 1 changesets with 1 changes to 1 files (+1 heads)
303 309
304 310
305 311 Cheating the counting algorithm:
306 312
307 313 $ hg -q up 9
308 314 $ HGMERGE=true hg -q merge 2
309 315 $ hg -q ci -m 11
310 316 $ hg -q up 1
311 317 $ echo 12 > foo
312 318 $ hg -q ci -m 12
313 319
314 320 $ hg push -r 11 -r 12 ../f
315 321 pushing to ../f
316 322 searching for changes
317 323 adding changesets
318 324 adding manifests
319 325 adding file changes
320 326 added 2 changesets with 2 changes to 1 files
321 327
322 328
323 329 Failed push of new named branch:
324 330
325 331 $ echo 12 > foo
326 332 $ hg -q ci -m 12a
327 333 [1]
328 334 $ hg -q up 11
329 335 $ echo 13 > foo
330 336 $ hg -q branch e
331 337 $ hg -q ci -m 13d
332 338
333 339 $ hg push -r 12 -r 13 ../f
334 340 pushing to ../f
335 341 searching for changes
336 342 abort: push creates new remote branches: e!
337 343 (use 'hg push --new-branch' to create new remote branches)
338 344 [255]
339 345
340 346
341 347 Using --new-branch to push new named branch:
342 348
343 349 $ hg push --new-branch -r 12 -r 13 ../f
344 350 pushing to ../f
345 351 searching for changes
346 352 adding changesets
347 353 adding manifests
348 354 adding file changes
349 355 added 1 changesets with 1 changes to 1 files
350 356
351 357
352 358 Checking prepush logic does not allow silently pushing
353 359 multiple new heads:
354 360
355 361 $ cd ..
356 362 $ hg init h
357 363 $ echo init > h/init
358 364 $ hg -R h ci -Am init
359 365 adding init
360 366 $ echo a > h/a
361 367 $ hg -R h ci -Am a
362 368 adding a
363 369 $ hg clone h i
364 370 updating to branch default
365 371 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
366 372 $ hg -R h up 0
367 373 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
368 374 $ echo b > h/b
369 375 $ hg -R h ci -Am b
370 376 adding b
371 377 created new head
372 378 $ hg -R i up 0
373 379 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
374 380 $ echo c > i/c
375 381 $ hg -R i ci -Am c
376 382 adding c
377 383 created new head
378 384
379 385 $ hg -R i push h
380 386 pushing to h
381 387 searching for changes
382 388 abort: push creates new remote head 97bd0c84d346!
383 389 (you should pull and merge or use push -f to force)
384 390 [255]
385 391
386 392
387 393 Check prepush logic with merged branches:
388 394
389 395 $ hg init j
390 396 $ hg -R j branch a
391 397 marked working directory as branch a
392 398 $ echo init > j/foo
393 399 $ hg -R j ci -Am init
394 400 adding foo
395 401 $ hg clone j k
396 402 updating to branch a
397 403 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
398 404 $ echo a1 > j/foo
399 405 $ hg -R j ci -m a1
400 406 $ hg -R k branch b
401 407 marked working directory as branch b
402 408 $ echo b > k/foo
403 409 $ hg -R k ci -m b
404 410 $ hg -R k up 0
405 411 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
406 412
407 413 $ hg -R k merge b
408 414 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
409 415 (branch merge, don't forget to commit)
410 416
411 417 $ hg -R k ci -m merge
412 418
413 419 $ hg -R k push -r a j
414 420 pushing to j
415 421 searching for changes
416 422 abort: push creates new remote branches: b!
417 423 (use 'hg push --new-branch' to create new remote branches)
418 424 [255]
419 425
420 426
421 427 Prepush -r should not allow you to sneak in new heads:
422 428
423 429 $ hg init l
424 430 $ cd l
425 431 $ echo a >> foo
426 432 $ hg -q add foo
427 433 $ hg -q branch a
428 434 $ hg -q ci -ma
429 435 $ hg -q up null
430 436 $ echo a >> foo
431 437 $ hg -q add foo
432 438 $ hg -q branch b
433 439 $ hg -q ci -mb
434 440 $ cd ..
435 441 $ hg -q clone l m -u a
436 442 $ cd m
437 443 $ hg -q merge b
438 444 $ hg -q ci -mmb
439 445 $ hg -q up 0
440 446 $ echo a >> foo
441 447 $ hg -q ci -ma2
442 448 $ hg -q up 2
443 449 $ echo a >> foo
444 450 $ hg -q branch -f b
445 451 $ hg -q ci -mb2
446 452 $ hg -q merge 3
447 453 $ hg -q ci -mma
448 454
449 455 $ hg push ../l -b b
450 456 pushing to ../l
451 457 searching for changes
452 458 abort: push creates new remote head e7e31d71180f on branch 'a'!
453 459 (did you forget to merge? use push -f to force)
454 460 [255]
455 461
456 462 $ cd ..
457 463
458 464
459 465 Check prepush with new branch head on former topo non-head:
460 466
461 467 $ hg init n
462 468 $ cd n
463 469 $ hg branch A
464 470 marked working directory as branch A
465 471 $ echo a >a
466 472 $ hg ci -Ama
467 473 adding a
468 474 $ hg branch B
469 475 marked working directory as branch B
470 476 $ echo b >b
471 477 $ hg ci -Amb
472 478 adding b
473 479
474 480 b is now branch head of B, and a topological head
475 481 a is now branch head of A, but not a topological head
476 482
477 483 $ hg clone . inner
478 484 updating to branch B
479 485 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
480 486 $ cd inner
481 487 $ hg up B
482 488 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
483 489 $ echo b1 >b1
484 490 $ hg ci -Amb1
485 491 adding b1
486 492
487 493 in the clone b1 is now the head of B
488 494
489 495 $ cd ..
490 496 $ hg up 0
491 497 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
492 498 $ echo a2 >a2
493 499 $ hg ci -Ama2
494 500 adding a2
495 501
496 502 a2 is now the new branch head of A, and a new topological head
497 503 it replaces a former inner branch head, so it should at most warn about
498 504 A, not B
499 505
500 506 glog of local:
501 507
502 508 $ hg glog --template "{rev}: {branches} {desc}\n"
503 509 @ 2: A a2
504 510 |
505 511 | o 1: B b
506 512 |/
507 513 o 0: A a
508 514
509 515 glog of remote:
510 516
511 517 $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
512 518 @ 2: B b1
513 519 |
514 520 o 1: B b
515 521 |
516 522 o 0: A a
517 523
518 524 outgoing:
519 525
520 526 $ hg out inner --template "{rev}: {branches} {desc}\n"
521 527 comparing with inner
522 528 searching for changes
523 529 2: A a2
524 530
525 531 $ hg push inner
526 532 pushing to inner
527 533 searching for changes
528 534 adding changesets
529 535 adding manifests
530 536 adding file changes
531 537 added 1 changesets with 1 changes to 1 files (+1 heads)
532 538
533 539 $ cd ..
534 540
535 541
536 542 Check prepush with new branch head on former topo head:
537 543
538 544 $ hg init o
539 545 $ cd o
540 546 $ hg branch A
541 547 marked working directory as branch A
542 548 $ echo a >a
543 549 $ hg ci -Ama
544 550 adding a
545 551 $ hg branch B
546 552 marked working directory as branch B
547 553 $ echo b >b
548 554 $ hg ci -Amb
549 555 adding b
550 556
551 557 b is now branch head of B, and a topological head
552 558
553 559 $ hg up 0
554 560 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
555 561 $ echo a1 >a1
556 562 $ hg ci -Ama1
557 563 adding a1
558 564
559 565 a1 is now branch head of A, and a topological head
560 566
561 567 $ hg clone . inner
562 568 updating to branch A
563 569 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
564 570 $ cd inner
565 571 $ hg up B
566 572 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
567 573 $ echo b1 >b1
568 574 $ hg ci -Amb1
569 575 adding b1
570 576
571 577 in the clone b1 is now the head of B
572 578
573 579 $ cd ..
574 580 $ echo a2 >a2
575 581 $ hg ci -Ama2
576 582 adding a2
577 583
578 584 a2 is now the new branch head of A, and a topological head
579 585 it replaces a former topological and branch head, so this should not warn
580 586
581 587 glog of local:
582 588
583 589 $ hg glog --template "{rev}: {branches} {desc}\n"
584 590 @ 3: A a2
585 591 |
586 592 o 2: A a1
587 593 |
588 594 | o 1: B b
589 595 |/
590 596 o 0: A a
591 597
592 598 glog of remote:
593 599
594 600 $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
595 601 @ 3: B b1
596 602 |
597 603 | o 2: A a1
598 604 | |
599 605 o | 1: B b
600 606 |/
601 607 o 0: A a
602 608
603 609 outgoing:
604 610
605 611 $ hg out inner --template "{rev}: {branches} {desc}\n"
606 612 comparing with inner
607 613 searching for changes
608 614 3: A a2
609 615
610 616 $ hg push inner
611 617 pushing to inner
612 618 searching for changes
613 619 adding changesets
614 620 adding manifests
615 621 adding file changes
616 622 added 1 changesets with 1 changes to 1 files
617 623
618 624 $ cd ..
619 625
620 626
621 627 Check prepush with new branch head and new child of former branch head
622 628 but child is on different branch:
623 629
624 630 $ hg init p
625 631 $ cd p
626 632 $ hg branch A
627 633 marked working directory as branch A
628 634 $ echo a0 >a
629 635 $ hg ci -Ama0
630 636 adding a
631 637 $ echo a1 >a
632 638 $ hg ci -ma1
633 639 $ hg up null
634 640 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
635 641 $ hg branch B
636 642 marked working directory as branch B
637 643 $ echo b0 >b
638 644 $ hg ci -Amb0
639 645 adding b
640 646 $ echo b1 >b
641 647 $ hg ci -mb1
642 648
643 649 $ hg clone . inner
644 650 updating to branch B
645 651 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 652
647 653 $ hg up A
648 654 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
649 655 $ hg branch -f B
650 656 marked working directory as branch B
651 657 $ echo a3 >a
652 658 $ hg ci -ma3
653 659 created new head
654 660 $ hg up 3
655 661 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
656 662 $ hg branch -f A
657 663 marked working directory as branch A
658 664 $ echo b3 >b
659 665 $ hg ci -mb3
660 666 created new head
661 667
662 668 glog of local:
663 669
664 670 $ hg glog --template "{rev}: {branches} {desc}\n"
665 671 @ 5: A b3
666 672 |
667 673 | o 4: B a3
668 674 | |
669 675 o | 3: B b1
670 676 | |
671 677 o | 2: B b0
672 678 /
673 679 o 1: A a1
674 680 |
675 681 o 0: A a0
676 682
677 683 glog of remote:
678 684
679 685 $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
680 686 @ 3: B b1
681 687 |
682 688 o 2: B b0
683 689
684 690 o 1: A a1
685 691 |
686 692 o 0: A a0
687 693
688 694 outgoing:
689 695
690 696 $ hg out inner --template "{rev}: {branches} {desc}\n"
691 697 comparing with inner
692 698 searching for changes
693 699 4: B a3
694 700 5: A b3
695 701
696 702 $ hg push inner
697 703 pushing to inner
698 704 searching for changes
699 705 abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'!
700 706 (did you forget to merge? use push -f to force)
701 707 [255]
702 708
703 709 $ hg push inner -r4 -r5
704 710 pushing to inner
705 711 searching for changes
706 712 abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'!
707 713 (did you forget to merge? use push -f to force)
708 714 [255]
709 715
710 716 $ hg in inner
711 717 comparing with inner
712 718 searching for changes
713 719 no changes found
714 720 [1]
General Comments 0
You need to be logged in to leave comments. Login now