##// END OF EJS Templates
update: warn about other topological heads on bare update...
Pierre-Yves David -
r28029:72072cfc default
parent child Browse files
Show More
@@ -6955,6 +6955,8 b' def update(ui, repo, node=None, rev=None'
6955 6955 if rev is None or rev == '':
6956 6956 rev = node
6957 6957
6958 warndest = False
6959
6958 6960 with repo.wlock():
6959 6961 cmdutil.clearunfinished(repo)
6960 6962
@@ -6976,6 +6978,7 b' def update(ui, repo, node=None, rev=None'
6976 6978 if rev is None:
6977 6979 updata = destutil.destupdate(repo, clean=clean, check=check)
6978 6980 rev, movemarkfrom, brev = updata
6981 warndest = True
6979 6982
6980 6983 repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
6981 6984
@@ -7002,7 +7005,8 b' def update(ui, repo, node=None, rev=None'
7002 7005 ui.status(_("(leaving bookmark %s)\n") %
7003 7006 repo._activebookmark)
7004 7007 bookmarks.deactivate(repo)
7005
7008 if warndest:
7009 destutil.statusotherdests(ui, repo)
7006 7010 return ret
7007 7011
7008 7012 @command('verify', [])
@@ -218,3 +218,34 b' def desthistedit(ui, repo):'
218 218 return revs.first()
219 219
220 220 return None
221
222 def _statusotherbook(ui, repo):
223 bmheads = repo.bookmarkheads(repo._activebookmark)
224 curhead = repo[repo._activebookmark].node()
225 if repo.revs('%n and parents()', curhead):
226 # we are on the active bookmark
227 bmheads = [b for b in bmheads if curhead != b]
228 if bmheads:
229 msg = _('%i other divergent bookmarks for "%s"\n')
230 ui.status(msg % (len(bmheads), repo._activebookmark))
231
232 def _statusotherbranchheads(ui, repo):
233 currentbranch = repo.dirstate.branch()
234 heads = repo.branchheads(currentbranch)
235 l = len(heads)
236 if repo.revs('%ln and parents()', heads):
237 # we are on a head
238 heads = repo.revs('%ln - parents()', heads)
239 if heads and l != len(heads):
240 ui.status(_('%i other heads for branch "%s"\n') %
241 (len(heads), currentbranch))
242
243 def statusotherdests(ui, repo):
244 """Print message about other head"""
245 # XXX we should probably include a hint:
246 # - about what to do
247 # - how to see such heads
248 if repo._activebookmark:
249 _statusotherbook(ui, repo)
250 else:
251 _statusotherbranchheads(ui, repo)
@@ -244,6 +244,7 b' hg up -C'
244 244
245 245 $ hg up -C
246 246 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
247 3 other heads for branch "default"
247 248
248 249 complex bisect test 1 # first bad rev is 9
249 250
@@ -123,6 +123,7 b' extension and python hooks - use the eol'
123 123 $ hg update
124 124 hooked
125 125 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 1 other heads for branch "default"
126 127 $ hg blackbox -l 6
127 128 1970/01/01 00:00:00 bob (*)> update (glob)
128 129 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 0 tags (glob)
@@ -573,6 +573,7 b' pull --update works the same as pull && '
573 573 $ hg bookmark -r3 Y
574 574 moving bookmark 'Y' forward from db815d6d32e6
575 575 $ cp -r ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
576 $ cp -r ../cloned-bookmarks-update ../cloned-bookmarks-manual-update-with-divergence
576 577
577 578 (manual version)
578 579
@@ -617,6 +618,34 b' pull --update works the same as pull && '
617 618 updating to active bookmark Y
618 619 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
619 620
621 We warn about divergent during bare update to the active bookmark
622
623 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update Y
624 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
625 (activating bookmark Y)
626 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks -r X2 Y@1
627 $ hg -R ../cloned-bookmarks-manual-update-with-divergence bookmarks
628 X2 1:925d80f479bb
629 * Y 2:db815d6d32e6
630 Y@1 1:925d80f479bb
631 Z 2:db815d6d32e6
632 x y 2:db815d6d32e6
633 $ hg -R ../cloned-bookmarks-manual-update-with-divergence pull
634 pulling from $TESTTMP
635 searching for changes
636 adding changesets
637 adding manifests
638 adding file changes
639 added 2 changesets with 2 changes to 2 files (+1 heads)
640 updating bookmark Y
641 updating bookmark Z
642 (run 'hg heads' to see heads, 'hg merge' to merge)
643 $ hg -R ../cloned-bookmarks-manual-update-with-divergence update
644 updating to active bookmark Y
645 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 (activating bookmark Y)
647 1 other divergent bookmarks for "Y"
648
620 649 test wrongly formated bookmark
621 650
622 651 $ echo '' >> .hg/bookmarks
@@ -715,6 +744,7 b' test non-linear update not clearing acti'
715 744 $ hg up -C
716 745 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
717 746 (leaving bookmark drop)
747 1 other heads for branch "default"
718 748 $ hg sum
719 749 parent: 2:db815d6d32e6
720 750 2
@@ -232,6 +232,7 b' are merging, unlike :local and :other'
232 232
233 233 $ hg up -C
234 234 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
235 1 other heads for branch "default"
235 236 $ printf "\n\nEnd of file\n" >> a
236 237 $ hg ci -m "Add some stuff at the end"
237 238 $ hg up -r 1
@@ -269,6 +270,7 b' Now test :merge-other and :merge-local'
269 270
270 271 $ hg up -C
271 272 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
273 1 other heads for branch "default"
272 274 $ hg merge --tool :merge-local
273 275 merging a
274 276 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -202,6 +202,7 b' Inject corruption into the largefiles st'
202 202 large: data corruption in $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 with hash 6a7bb2556144babe3899b25e5428123735bb1e27 (glob)
203 203 0 largefiles updated, 0 removed
204 204 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 2 other heads for branch "default"
205 206 $ hg st
206 207 ! large
207 208 ? z
@@ -68,6 +68,7 b" we don't have to hash them again next ti"
68 68
69 69 $ hg up
70 70 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 1 other heads for branch "default"
71 72 $ hg debugdirstate --large --nodate
72 73 n 644 7 set large1
73 74 n 644 13 set large2
@@ -82,6 +83,7 b' prevents unnecessary hashing of content '
82 83 n 644 13 set large2
83 84 $ hg up
84 85 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 1 other heads for branch "default"
85 87 $ hg debugdirstate --large --nodate
86 88 n 644 7 set large1
87 89 n 644 13 set large2
@@ -111,6 +111,7 b' Interactive merge:'
111 111
112 112 $ hg co -C
113 113 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
114 1 other heads for branch "default"
114 115
115 116 $ hg merge --config ui.interactive=true <<EOF
116 117 > c
@@ -171,6 +172,7 b' Interactive merge with bad input:'
171 172
172 173 $ hg co -C
173 174 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 1 other heads for branch "default"
174 176
175 177 $ hg merge --config ui.interactive=true <<EOF
176 178 > foo
@@ -243,6 +245,7 b' Interactive merge with not enough input:'
243 245
244 246 $ hg co -C
245 247 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
248 1 other heads for branch "default"
246 249
247 250 $ hg merge --config ui.interactive=true <<EOF
248 251 > d
@@ -301,6 +304,7 b' Choose local versions of files'
301 304
302 305 $ hg co -C
303 306 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
307 1 other heads for branch "default"
304 308
305 309 $ hg merge --tool :local
306 310 0 files updated, 3 files merged, 0 files removed, 0 files unresolved
@@ -345,6 +349,7 b' Choose other versions of files'
345 349
346 350 $ hg co -C
347 351 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
352 1 other heads for branch "default"
348 353
349 354 $ hg merge --tool :other
350 355 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
@@ -389,6 +394,7 b' Fail'
389 394
390 395 $ hg co -C
391 396 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
397 1 other heads for branch "default"
392 398
393 399 $ hg merge --tool :fail
394 400 0 files updated, 0 files merged, 0 files removed, 3 files unresolved
@@ -436,6 +442,7 b' Force prompts with no input (should be s'
436 442
437 443 $ hg co -C
438 444 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
445 1 other heads for branch "default"
439 446
440 447 $ hg merge --config ui.interactive=True --tool :prompt
441 448 local changed file1 which remote deleted
@@ -491,6 +498,7 b' Force prompts'
491 498
492 499 $ hg co -C
493 500 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
501 1 other heads for branch "default"
494 502
495 503 $ hg merge --tool :prompt
496 504 local changed file1 which remote deleted
@@ -544,6 +552,7 b' Choose to merge all files'
544 552
545 553 $ hg co -C
546 554 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
555 1 other heads for branch "default"
547 556
548 557 $ hg merge --tool :merge3
549 558 local changed file1 which remote deleted
@@ -33,6 +33,7 b' Should fail because not at a head:'
33 33
34 34 $ hg up
35 35 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 2 other heads for branch "default"
36 37
37 38 Should fail because > 2 heads:
38 39
@@ -155,6 +155,7 b' Update to link without local change shou'
155 155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 156 $ hg up
157 157 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
158 1 other heads for branch "default"
158 159 $ hg st
159 160 ? a.orig
160 161
@@ -175,6 +176,7 b' Update to link with local change should '
175 176 keep (l)ocal, take (o)ther, or leave (u)nresolved? u
176 177 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
177 178 use 'hg resolve' to retry unresolved file merges
179 1 other heads for branch "default"
178 180 [1]
179 181 $ hg diff --git
180 182 diff --git a/a b/a
@@ -24,6 +24,7 b''
24 24 $ hg revert b
25 25 $ hg update -c
26 26 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
27 1 other heads for branch "default"
27 28 $ mv a c
28 29
29 30 Should abort:
@@ -287,6 +287,7 b' after strip of merge parent'
287 287
288 288 $ hg up
289 289 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
290 1 other heads for branch "default"
290 291 $ hg log -G
291 292 @ changeset: 4:264128213d29
292 293 | tag: tip
@@ -664,6 +664,7 b' update'
664 664 $ cd ../t
665 665 $ hg up -C # discard our earlier merge
666 666 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
667 2 other heads for branch "default"
667 668 $ echo blah > t/t
668 669 $ hg ci -m13
669 670 committing subrepository t
@@ -677,6 +678,7 b' KeyError'
677 678
678 679 $ hg up -C # discard changes
679 680 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
681 2 other heads for branch "default"
680 682
681 683 pull
682 684
@@ -718,6 +720,7 b' should pull t'
718 720 adding file changes
719 721 added 1 changesets with 1 changes to 1 files
720 722 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
723 2 other heads for branch "default"
721 724 $ cat t/t
722 725 blah
723 726
@@ -1185,6 +1188,7 b' Check hg update --clean'
1185 1188 ? s/c
1186 1189 $ hg update -C
1187 1190 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1191 2 other heads for branch "default"
1188 1192 $ hg status -S
1189 1193 ? s/b
1190 1194 ? s/c
@@ -409,6 +409,7 b" transplant -c shouldn't use an old chang"
409 409
410 410 $ hg up -C
411 411 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
412 1 other heads for branch "default"
412 413 $ rm added
413 414 $ hg transplant --continue
414 415 abort: no transplant to continue
@@ -167,6 +167,7 b' Cases are run as shown in that table, ro'
167 167
168 168 $ norevtest '-c clean same' clean 2 -c
169 169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 1 other heads for branch "default"
170 171 parent=3
171 172
172 173 $ revtest '-cC dirty linear' dirty 1 2 -cC
General Comments 0
You need to be logged in to leave comments. Login now