mercurial/changegroup.py
changeset 34097 f7d41b85bbf6
parent 34096 f85dfde1731a
child 34098 d8245139e720
equal deleted inserted replaced
34096:f85dfde1731a 34097:f7d41b85bbf6
   938 
   938 
   939     repo.hook('preoutgoing', throw=True, source=source)
   939     repo.hook('preoutgoing', throw=True, source=source)
   940     _changegroupinfo(repo, csets, source)
   940     _changegroupinfo(repo, csets, source)
   941     return bundler.generate(commonrevs, csets, fastpathlinkrev, source)
   941     return bundler.generate(commonrevs, csets, fastpathlinkrev, source)
   942 
   942 
   943 def changegroupsubset(repo, roots, heads, source, version='01'):
       
   944     """Compute a changegroup consisting of all the nodes that are
       
   945     descendants of any of the roots and ancestors of any of the heads.
       
   946     Return a chunkbuffer object whose read() method will return
       
   947     successive changegroup chunks.
       
   948 
       
   949     It is fairly complex as determining which filenodes and which
       
   950     manifest nodes need to be included for the changeset to be complete
       
   951     is non-trivial.
       
   952 
       
   953     Another wrinkle is doing the reverse, figuring out which changeset in
       
   954     the changegroup a particular filenode or manifestnode belongs to.
       
   955     """
       
   956     outgoing = discovery.outgoing(repo, missingroots=roots, missingheads=heads)
       
   957     return makechangegroup(repo, outgoing, version, source)
       
   958 
       
   959 def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None,
   943 def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None,
   960                            version='01'):
   944                            version='01'):
   961     """Like getbundle, but taking a discovery.outgoing as an argument.
   945     """Like getbundle, but taking a discovery.outgoing as an argument.
   962 
   946 
   963     This is only implemented for local repos and reuses potentially
   947     This is only implemented for local repos and reuses potentially
   983                        '4.3')
   967                        '4.3')
   984     return getchangegroup(repo, *args, **kwargs)
   968     return getchangegroup(repo, *args, **kwargs)
   985 
   969 
   986 def changegroup(repo, basenodes, source):
   970 def changegroup(repo, basenodes, source):
   987     # to avoid a race we use changegroupsubset() (issue1320)
   971     # to avoid a race we use changegroupsubset() (issue1320)
   988     return changegroupsubset(repo, basenodes, repo.heads(), source)
   972     outgoing = discovery.outgoing(repo, missingroots=basenodes,
       
   973                                   missingheads=repo.heads())
       
   974     return makechangegroup(repo, outgoing, '01', source)
   989 
   975 
   990 def _addchangegroupfiles(repo, source, revmap, trp, expectedfiles, needfiles):
   976 def _addchangegroupfiles(repo, source, revmap, trp, expectedfiles, needfiles):
   991     revisions = 0
   977     revisions = 0
   992     files = 0
   978     files = 0
   993     for chunkdata in iter(source.filelogheader, {}):
   979     for chunkdata in iter(source.filelogheader, {}):