##// END OF EJS Templates
bookmarks: pull --update updates to active bookmark if it moved (issue4007)...
Kevin Bullock -
r19523:f37b5a17 2.7 stable
parent child Browse files
Show More
@@ -170,6 +170,19 b' def deletedivergent(repo, deletefrom, bm'
170 170 deleted = True
171 171 return deleted
172 172
173 def calculateupdate(ui, repo, checkout):
174 '''Return a tuple (targetrev, movemarkfrom) indicating the rev to
175 check out and where to move the active bookmark from, if needed.'''
176 movemarkfrom = None
177 if checkout is None:
178 curmark = repo._bookmarkcurrent
179 if iscurrent(repo):
180 movemarkfrom = repo['.'].node()
181 elif curmark:
182 ui.status(_("updating to active bookmark %s\n") % curmark)
183 checkout = curmark
184 return (checkout, movemarkfrom)
185
173 186 def update(repo, parents, node):
174 187 deletefrom = parents
175 188 marks = repo._bookmarks
@@ -4520,7 +4520,7 b' def postincoming(ui, repo, modheads, opt'
4520 4520 if modheads == 0:
4521 4521 return
4522 4522 if optupdate:
4523 movemarkfrom = repo['.'].node()
4523 checkout, movemarkfrom = bookmarks.calculateupdate(ui, repo, checkout)
4524 4524 try:
4525 4525 ret = hg.update(repo, checkout)
4526 4526 except util.Abort, inst:
@@ -5829,14 +5829,7 b' def update(ui, repo, node=None, rev=None'
5829 5829 cmdutil.clearunfinished(repo)
5830 5830
5831 5831 # with no argument, we also move the current bookmark, if any
5832 movemarkfrom = None
5833 if rev is None:
5834 curmark = repo._bookmarkcurrent
5835 if bookmarks.iscurrent(repo):
5836 movemarkfrom = repo['.'].node()
5837 elif curmark:
5838 ui.status(_("updating to active bookmark %s\n") % curmark)
5839 rev = curmark
5832 rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev)
5840 5833
5841 5834 # if we defined a bookmark, we have to remember the original bookmark name
5842 5835 brev = rev
@@ -507,19 +507,37 b" update to current bookmark if it's not t"
507 507 * Z 3:125c9a1d6df6
508 508 x y 2:db815d6d32e6
509 509
510 pull --update works the same as pull && update
511
512 $ hg bookmark -r3 Y
513 moving bookmark 'Y' forward from db815d6d32e6
514 $ hg -R cloned-bookmarks-update update Y
515 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
516 $ hg -R cloned-bookmarks-update pull --update .
517 pulling from .
518 searching for changes
519 adding changesets
520 adding manifests
521 adding file changes
522 added 2 changesets with 2 changes to 2 files (+1 heads)
523 updating bookmark Y
524 updating bookmark Z
525 updating to active bookmark Y
526 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
527
510 528 test wrongly formated bookmark
511 529
512 530 $ echo '' >> .hg/bookmarks
513 531 $ hg bookmarks
514 532 X2 1:925d80f479bb
515 Y 2:db815d6d32e6
533 Y 3:125c9a1d6df6
516 534 * Z 3:125c9a1d6df6
517 535 x y 2:db815d6d32e6
518 536 $ echo "Ican'thasformatedlines" >> .hg/bookmarks
519 537 $ hg bookmarks
520 538 malformed line in .hg/bookmarks: "Ican'thasformatedlines"
521 539 X2 1:925d80f479bb
522 Y 2:db815d6d32e6
540 Y 3:125c9a1d6df6
523 541 * Z 3:125c9a1d6df6
524 542 x y 2:db815d6d32e6
525 543
General Comments 0
You need to be logged in to leave comments. Login now