mercurial/exchange.py
changeset 23848 c5456b64eb07
parent 23591 414374cfb531
child 23890 7817059917d0
equal deleted inserted replaced
23847:71402bb8d8b2 23848:c5456b64eb07
   269         step(pushop)
   269         step(pushop)
   270 
   270 
   271 @pushdiscovery('changeset')
   271 @pushdiscovery('changeset')
   272 def _pushdiscoverychangeset(pushop):
   272 def _pushdiscoverychangeset(pushop):
   273     """discover the changeset that need to be pushed"""
   273     """discover the changeset that need to be pushed"""
   274     unfi = pushop.repo.unfiltered()
       
   275     fci = discovery.findcommonincoming
   274     fci = discovery.findcommonincoming
   276     commoninc = fci(unfi, pushop.remote, force=pushop.force)
   275     commoninc = fci(pushop.repo, pushop.remote, force=pushop.force)
   277     common, inc, remoteheads = commoninc
   276     common, inc, remoteheads = commoninc
   278     fco = discovery.findcommonoutgoing
   277     fco = discovery.findcommonoutgoing
   279     outgoing = fco(unfi, pushop.remote, onlyheads=pushop.revs,
   278     outgoing = fco(pushop.repo, pushop.remote, onlyheads=pushop.revs,
   280                    commoninc=commoninc, force=pushop.force)
   279                    commoninc=commoninc, force=pushop.force)
   281     pushop.outgoing = outgoing
   280     pushop.outgoing = outgoing
   282     pushop.remoteheads = remoteheads
   281     pushop.remoteheads = remoteheads
   283     pushop.incoming = inc
   282     pushop.incoming = inc
   284 
   283 
   925 def _pulldiscoverychangegroup(pullop):
   924 def _pulldiscoverychangegroup(pullop):
   926     """discovery phase for the pull
   925     """discovery phase for the pull
   927 
   926 
   928     Current handle changeset discovery only, will change handle all discovery
   927     Current handle changeset discovery only, will change handle all discovery
   929     at some point."""
   928     at some point."""
   930     tmp = discovery.findcommonincoming(pullop.repo.unfiltered(),
   929     tmp = discovery.findcommonincoming(pullop.repo,
   931                                        pullop.remote,
   930                                        pullop.remote,
   932                                        heads=pullop.heads,
   931                                        heads=pullop.heads,
   933                                        force=pullop.force)
   932                                        force=pullop.force)
   934     pullop.common, pullop.fetch, pullop.rheads = tmp
   933     common, fetch, rheads = tmp
       
   934     nm = pullop.repo.unfiltered().changelog.nodemap
       
   935     if fetch and rheads:
       
   936         # If a remote heads in filtered locally, lets drop it from the unknown
       
   937         # remote heads and put in back in common.
       
   938         #
       
   939         # This is a hackish solution to catch most of "common but locally
       
   940         # hidden situation".  We do not performs discovery on unfiltered
       
   941         # repository because it end up doing a pathological amount of round
       
   942         # trip for w huge amount of changeset we do not care about.
       
   943         #
       
   944         # If a set of such "common but filtered" changeset exist on the server
       
   945         # but are not including a remote heads, we'll not be able to detect it,
       
   946         scommon = set(common)
       
   947         filteredrheads = []
       
   948         for n in rheads:
       
   949             if n in nm and n not in scommon:
       
   950                 common.append(n)
       
   951             else:
       
   952                 filteredrheads.append(n)
       
   953         if not filteredrheads:
       
   954             fetch = []
       
   955         rheads = filteredrheads
       
   956     pullop.common = common
       
   957     pullop.fetch = fetch
       
   958     pullop.rheads = rheads
   935 
   959 
   936 def _pullbundle2(pullop):
   960 def _pullbundle2(pullop):
   937     """pull data using bundle2
   961     """pull data using bundle2
   938 
   962 
   939     For now, the only supported data are changegroup."""
   963     For now, the only supported data are changegroup."""