Mercurial > hg-stable
comparison mercurial/commands.py @ 22626:fb74a5833467
pull: gather all bookmark-pulling code together
Pulling bookmarks is done in two rounds. First we do a simple update, then we use
the content of the `bookmark` argument to possibly overwrite some bookmark
with their remote location.
The second step was not done right after the first one for some obscure reason.
We now perform them one after the other.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 25 Sep 2014 17:53:27 -0700 |
parents | 62ab9ca90b36 |
children | e48a5d3996c2 |
comparison
equal
deleted
inserted
replaced
22625:62ab9ca90b36 | 22626:fb74a5833467 |
---|---|
4959 "so a rev cannot be specified.") | 4959 "so a rev cannot be specified.") |
4960 raise util.Abort(err) | 4960 raise util.Abort(err) |
4961 | 4961 |
4962 modheads = repo.pull(other, heads=revs, force=opts.get('force')) | 4962 modheads = repo.pull(other, heads=revs, force=opts.get('force')) |
4963 bookmarks.updatefromremote(ui, repo, remotebookmarks, source) | 4963 bookmarks.updatefromremote(ui, repo, remotebookmarks, source) |
4964 if checkout: | |
4965 checkout = str(repo.changelog.rev(other.lookup(checkout))) | |
4966 repo._subtoppath = source | |
4967 try: | |
4968 ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) | |
4969 | |
4970 finally: | |
4971 del repo._subtoppath | |
4972 | |
4973 # update specified bookmarks | 4964 # update specified bookmarks |
4974 if opts.get('bookmark'): | 4965 if opts.get('bookmark'): |
4975 marks = repo._bookmarks | 4966 marks = repo._bookmarks |
4976 for b in opts['bookmark']: | 4967 for b in opts['bookmark']: |
4977 # explicit pull overrides local bookmark if any | 4968 # explicit pull overrides local bookmark if any |
4978 ui.status(_("importing bookmark %s\n") % b) | 4969 ui.status(_("importing bookmark %s\n") % b) |
4979 marks[b] = repo[remotebookmarks[b]].node() | 4970 marks[b] = repo[remotebookmarks[b]].node() |
4980 marks.write() | 4971 marks.write() |
4972 if checkout: | |
4973 checkout = str(repo.changelog.rev(other.lookup(checkout))) | |
4974 repo._subtoppath = source | |
4975 try: | |
4976 ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) | |
4977 | |
4978 finally: | |
4979 del repo._subtoppath | |
4980 | |
4981 finally: | 4981 finally: |
4982 other.close() | 4982 other.close() |
4983 return ret | 4983 return ret |
4984 | 4984 |
4985 @command('^push', | 4985 @command('^push', |