mercurial/exchange.py
changeset 20899 d62319f91cb7
parent 20898 f295b2ac3579
child 20900 cb37fb91bc5a
equal deleted inserted replaced
20898:f295b2ac3579 20899:d62319f91cb7
   453         tmp = discovery.findcommonincoming(pullop.repo.unfiltered(),
   453         tmp = discovery.findcommonincoming(pullop.repo.unfiltered(),
   454                                            pullop.remote,
   454                                            pullop.remote,
   455                                            heads=pullop.heads,
   455                                            heads=pullop.heads,
   456                                            force=force)
   456                                            force=force)
   457         pullop.common, pullop.fetch, pullop.rheads = tmp
   457         pullop.common, pullop.fetch, pullop.rheads = tmp
   458         if not pullop.fetch:
   458         _pullchangeset(pullop)
   459             pullop.repo.ui.status(_("no changes found\n"))
       
   460             pullop.cgresult = 0
       
   461         else:
       
   462             pullop.cgresult = _pullchangeset(pullop)
       
   463 
       
   464         _pullphase(pullop)
   459         _pullphase(pullop)
   465         _pullobsolete(pullop)
   460         _pullobsolete(pullop)
   466         pullop.closetransaction()
   461         pullop.closetransaction()
   467     finally:
   462     finally:
   468         pullop.releasetransaction()
   463         pullop.releasetransaction()
   473 def _pullchangeset(pullop):
   468 def _pullchangeset(pullop):
   474     """pull changeset from unbundle into the local repo"""
   469     """pull changeset from unbundle into the local repo"""
   475     # We delay the open of the transaction as late as possible so we
   470     # We delay the open of the transaction as late as possible so we
   476     # don't open transaction for nothing or you break future useful
   471     # don't open transaction for nothing or you break future useful
   477     # rollback call
   472     # rollback call
       
   473     if not pullop.fetch:
       
   474             pullop.repo.ui.status(_("no changes found\n"))
       
   475             pullop.cgresult = 0
       
   476             return
   478     pullop.gettransaction()
   477     pullop.gettransaction()
   479     if pullop.heads is None and list(pullop.common) == [nullid]:
   478     if pullop.heads is None and list(pullop.common) == [nullid]:
   480         pullop.repo.ui.status(_("requesting all changes\n"))
   479         pullop.repo.ui.status(_("requesting all changes\n"))
   481     elif pullop.heads is None and pullop.remote.capable('changegroupsubset'):
   480     elif pullop.heads is None and pullop.remote.capable('changegroupsubset'):
   482         # issue1320, avoid a race if remote changed after discovery
   481         # issue1320, avoid a race if remote changed after discovery
   492         raise util.Abort(_("partial pull cannot be done because "
   491         raise util.Abort(_("partial pull cannot be done because "
   493                                    "other repository doesn't support "
   492                                    "other repository doesn't support "
   494                                    "changegroupsubset."))
   493                                    "changegroupsubset."))
   495     else:
   494     else:
   496         cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
   495         cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
   497     return pullop.repo.addchangegroup(cg, 'pull', pullop.remote.url())
   496     pullop.cgresult = pullop.repo.addchangegroup(cg, 'pull',
       
   497                                                  pullop.remote.url())
   498 
   498 
   499 def _pullphase(pullop):
   499 def _pullphase(pullop):
   500     # Get remote phases data from remote
   500     # Get remote phases data from remote
   501     remotephases = pullop.remote.listkeys('phases')
   501     remotephases = pullop.remote.listkeys('phases')
   502     publishing = bool(remotephases.get('publishing', False))
   502     publishing = bool(remotephases.get('publishing', False))