Mercurial > hg-stable
changeset 28269:6e3fdd98b277
commands: add postincoming explicit brev argument (API)
Before this patch, postincoming() initializes 'brev' with 'checkout',
but this isn't useful to activate/deactivate bookmark after updating,
because 'checkout' is not a string actually specified at command line,
but an already node-nized byte sequence.
This patch adds postincoming() explicit 'brev' argument, and makes
'pull()' pass appropriate value.
This patch adds 'brev' argument instead of 'brev=None', because
'brev=None' isn't reasonable value if checkout is not None.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 26 Feb 2016 20:22:05 +0900 |
parents | 3643b66d7f71 |
children | 650c9f69a744 |
files | mercurial/commands.py |
diffstat | 1 files changed, 20 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Feb 27 19:53:18 2016 +0800 +++ b/mercurial/commands.py Fri Feb 26 20:22:05 2016 +0900 @@ -5543,13 +5543,12 @@ ui.warn(_('no phases changed\n')) return ret -def postincoming(ui, repo, modheads, optupdate, checkout): +def postincoming(ui, repo, modheads, optupdate, checkout, brev): if modheads == 0: return if optupdate: warndest = False try: - brev = checkout movemarkfrom = None if not checkout: warndest = True @@ -5655,11 +5654,28 @@ force=opts.get('force'), bookmarks=opts.get('bookmark', ()), opargs=pullopargs).cgresult + + # brev is a name, which might be a bookmark to be activated at + # the end of the update. In other words, it is an explicit + # destination of the update + brev = None + if checkout: checkout = str(repo.changelog.rev(checkout)) + + # order below depends on implementation of + # hg.addbranchrevs(). opts['bookmark'] is ignored, + # because 'checkout' is determined without it. + if opts.get('rev'): + brev = opts['rev'][0] + elif opts.get('branch'): + brev = opts['branch'][0] + else: + brev = branches[0] repo._subtoppath = source try: - ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) + ret = postincoming(ui, repo, modheads, opts.get('update'), + checkout, brev) finally: del repo._subtoppath @@ -6898,7 +6914,7 @@ else: modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname) - return postincoming(ui, repo, modheads, opts.get('update'), None) + return postincoming(ui, repo, modheads, opts.get('update'), None, None) @command('^update|up|checkout|co', [('C', 'clean', None, _('discard uncommitted changes (no backup)')),