Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 19523:f37b5a17e6a0 stable 2.7
bookmarks: pull --update updates to active bookmark if it moved (issue4007)
This makes `hg pull --update` behave the same wrt the active bookmark as
`hg pull && hg update` does as of 2096e025a728. A helper function,
bookmarks.calculateupdate, is added to prevent code duplication between
postincoming and update.
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Thu, 01 Aug 2013 21:43:14 -0500 |
parents | 607191a45f8c |
children | f959b60e3025 |
comparison
equal
deleted
inserted
replaced
19522:3d19b8136641 | 19523:f37b5a17e6a0 |
---|---|
4518 | 4518 |
4519 def postincoming(ui, repo, modheads, optupdate, checkout): | 4519 def postincoming(ui, repo, modheads, optupdate, checkout): |
4520 if modheads == 0: | 4520 if modheads == 0: |
4521 return | 4521 return |
4522 if optupdate: | 4522 if optupdate: |
4523 movemarkfrom = repo['.'].node() | 4523 checkout, movemarkfrom = bookmarks.calculateupdate(ui, repo, checkout) |
4524 try: | 4524 try: |
4525 ret = hg.update(repo, checkout) | 4525 ret = hg.update(repo, checkout) |
4526 except util.Abort, inst: | 4526 except util.Abort, inst: |
4527 ui.warn(_("not updating: %s\n") % str(inst)) | 4527 ui.warn(_("not updating: %s\n") % str(inst)) |
4528 return 0 | 4528 return 0 |
5827 rev = node | 5827 rev = node |
5828 | 5828 |
5829 cmdutil.clearunfinished(repo) | 5829 cmdutil.clearunfinished(repo) |
5830 | 5830 |
5831 # with no argument, we also move the current bookmark, if any | 5831 # with no argument, we also move the current bookmark, if any |
5832 movemarkfrom = None | 5832 rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev) |
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 | |
5840 | 5833 |
5841 # if we defined a bookmark, we have to remember the original bookmark name | 5834 # if we defined a bookmark, we have to remember the original bookmark name |
5842 brev = rev | 5835 brev = rev |
5843 rev = scmutil.revsingle(repo, rev, rev).rev() | 5836 rev = scmutil.revsingle(repo, rev, rev).rev() |
5844 | 5837 |