[PATCH 1 of 3 V2] commands: add postincoming explicit brev argument (API)
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Fri Feb 26 11:25:26 UTC 2016
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1456485725 -32400
# Fri Feb 26 20:22:05 2016 +0900
# Node ID da6d9ca7f33b1f27c36b9cc6165eac6358f0aee9
# Parent 824ccfaf08a238b50f179b39ceebf303c798031a
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.
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5543,13 +5543,12 @@ def phase(ui, repo, *revs, **opts):
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 @@ def pull(ui, repo, source="default", **o
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 @@ def unbundle(ui, repo, fname1, *fnames,
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)')),
More information about the Mercurial-devel
mailing list