# HG changeset patch # User Pierre-Yves David # Date 1396398501 25200 # Node ID d62319f91cb7a751f0d2eebe4a404f9ac7efab89 # Parent f295b2ac357906c6c45c7abdc2f2f5b6159a804a 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 -r f295b2ac3579 -r d62319f91cb7 mercurial/exchange.py --- a/mercurial/exchange.py Tue Apr 01 17:21:52 2014 -0700 +++ b/mercurial/exchange.py Tue Apr 01 17:28:21 2014 -0700 @@ -455,12 +455,7 @@ 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() @@ -475,6 +470,10 @@ # 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")) @@ -494,7 +493,8 @@ "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