[PATCH 2 of 4] pull: move the cgresult logic in _pullchangeset
pierre-yves.david at ens-lyon.org
pierre-yves.david at ens-lyon.org
Wed Apr 2 15:21:45 CDT 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1396398501 25200
# Tue Apr 01 17:28:21 2014 -0700
# Node ID 5666cf55a987cd4df9919ced3f48ed16e1381590
# Parent ba28a84234c1bfbe6a926c4b69507f5a65864eb3
pull: move the cgresult logic in _pullchangeset
Logical follow up of the previous changeset. The `_pullchangeset` is now
responsible of setting the `pullop.cgresult`.
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -448,16 +448,11 @@ def pull(repo, remote, heads=None, force
tmp = discovery.findcommonincoming(pullop.repo.unfiltered(),
pullop.remote,
heads=pullop.heads,
force=force)
pullop.common, pullop.fetch, pullop.rheads = tmp
- if not pullop.fetch:
- pullop.repo.ui.status(_("no changes found\n"))
- pullop.cgresult = 0
- else:
- pullop.cgresult = _pullchangeset(pullop)
-
+ _pullchangeset(pullop)
_pullphase(pullop)
_pullobsolete(pullop)
pullop.closetransaction()
finally:
pullop.releasetransaction()
@@ -468,10 +463,14 @@ def pull(repo, remote, heads=None, force
def _pullchangeset(pullop):
"""pull changeset from unbundle into the local repo"""
# We delay the open of the transaction as late as possible so we
# don't open transaction for nothing or you break future useful
# rollback call
+ if not pullop.fetch:
+ pullop.repo.ui.status(_("no changes found\n"))
+ pullop.cgresult = 0
+ return
pullop.gettransaction()
if pullop.heads is None and list(pullop.common) == [nullid]:
pullop.repo.ui.status(_("requesting all changes\n"))
elif pullop.heads is None and pullop.remote.capable('changegroupsubset'):
# issue1320, avoid a race if remote changed after discovery
@@ -487,11 +486,12 @@ def _pullchangeset(pullop):
raise util.Abort(_("partial pull cannot be done because "
"other repository doesn't support "
"changegroupsubset."))
else:
cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
- return pullop.repo.addchangegroup(cg, 'pull', pullop.remote.url())
+ pullop.cgresult = pullop.repo.addchangegroup(cg, 'pull',
+ pullop.remote.url())
def _pullphase(pullop):
# Get remote phases data from remote
remotephases = pullop.remote.listkeys('phases')
publishing = bool(remotephases.get('publishing', False))
More information about the Mercurial-devel
mailing list