mercurial/treediscovery.py
changeset 46110 d90f439ff19f
parent 45942 89a2afe31e82
child 46819 d4ba4d51f85f
equal deleted inserted replaced
46109:2f357d053df2 46110:d90f439ff19f
    18     error,
    18     error,
    19     pycompat,
    19     pycompat,
    20 )
    20 )
    21 
    21 
    22 
    22 
    23 def findcommonincoming(repo, remote, heads=None, force=False):
    23 def findcommonincoming(repo, remote, heads=None, force=False, audit=None):
    24     """Return a tuple (common, fetch, heads) used to identify the common
    24     """Return a tuple (common, fetch, heads) used to identify the common
    25     subset of nodes between repo and remote.
    25     subset of nodes between repo and remote.
    26 
    26 
    27     "common" is a list of (at least) the heads of the common subset.
    27     "common" is a list of (at least) the heads of the common subset.
    28     "fetch" is a list of roots of the nodes that would be incoming, to be
    28     "fetch" is a list of roots of the nodes that would be incoming, to be
    38     base = set()
    38     base = set()
    39 
    39 
    40     if not heads:
    40     if not heads:
    41         with remote.commandexecutor() as e:
    41         with remote.commandexecutor() as e:
    42             heads = e.callcommand(b'heads', {}).result()
    42             heads = e.callcommand(b'heads', {}).result()
       
    43 
       
    44     if audit is not None:
       
    45         audit[b'total-roundtrips'] = 1
    43 
    46 
    44     if repo.changelog.tip() == nullid:
    47     if repo.changelog.tip() == nullid:
    45         base.add(nullid)
    48         base.add(nullid)
    46         if heads != [nullid]:
    49         if heads != [nullid]:
    47             return [nullid], [nullid], list(heads)
    50             return [nullid], [nullid], list(heads)
   179         + b"\n"
   182         + b"\n"
   180     )
   183     )
   181 
   184 
   182     progress.complete()
   185     progress.complete()
   183     repo.ui.debug(b"%d total queries\n" % reqcnt)
   186     repo.ui.debug(b"%d total queries\n" % reqcnt)
       
   187     if audit is not None:
       
   188         audit[b'total-roundtrips'] = reqcnt
   184 
   189 
   185     return base, list(fetch), heads
   190     return base, list(fetch), heads