mercurial/treediscovery.py
branchstable
changeset 49401 362c0026a977
parent 49284 d44e3c45f0e4
child 49402 236702592ff0
equal deleted inserted replaced
49400:a1bb21542ab0 49401:362c0026a977
    37             heads = e.callcommand(b'heads', {}).result()
    37             heads = e.callcommand(b'heads', {}).result()
    38 
    38 
    39     if audit is not None:
    39     if audit is not None:
    40         audit[b'total-roundtrips'] = 1
    40         audit[b'total-roundtrips'] = 1
    41         audit[b'total-queries'] = 0
    41         audit[b'total-queries'] = 0
       
    42         audit[b'total-queries-branches'] = 0
       
    43         audit[b'total-queries-between'] = 0
    42 
    44 
    43     if repo.changelog.tip() == repo.nullid:
    45     if repo.changelog.tip() == repo.nullid:
    44         base.add(repo.nullid)
    46         base.add(repo.nullid)
    45         if heads != [repo.nullid]:
    47         if heads != [repo.nullid]:
    46             return [repo.nullid], [repo.nullid], list(heads)
    48             return [repo.nullid], [repo.nullid], list(heads)
    69     # head, root, first parent, second parent
    71     # head, root, first parent, second parent
    70     # (a branch always has two parents (or none) by definition)
    72     # (a branch always has two parents (or none) by definition)
    71     with remote.commandexecutor() as e:
    73     with remote.commandexecutor() as e:
    72         if audit is not None:
    74         if audit is not None:
    73             audit[b'total-queries'] += len(unknown)
    75             audit[b'total-queries'] += len(unknown)
       
    76             audit[b'total-queries-branches'] += len(unknown)
    74         branches = e.callcommand(b'branches', {b'nodes': unknown}).result()
    77         branches = e.callcommand(b'branches', {b'nodes': unknown}).result()
    75 
    78 
    76     unknown = collections.deque(branches)
    79     unknown = collections.deque(branches)
    77     while unknown:
    80     while unknown:
    78         r = []
    81         r = []
   118             for p in range(0, len(r), 10):
   121             for p in range(0, len(r), 10):
   119                 with remote.commandexecutor() as e:
   122                 with remote.commandexecutor() as e:
   120                     subset = r[p : p + 10]
   123                     subset = r[p : p + 10]
   121                     if audit is not None:
   124                     if audit is not None:
   122                         audit[b'total-queries'] += len(subset)
   125                         audit[b'total-queries'] += len(subset)
       
   126                         audit[b'total-queries-branches'] += len(subset)
   123                     branches = e.callcommand(
   127                     branches = e.callcommand(
   124                         b'branches',
   128                         b'branches',
   125                         {
   129                         {
   126                             b'nodes': subset,
   130                             b'nodes': subset,
   127                         },
   131                         },
   140         progress.increment()
   144         progress.increment()
   141 
   145 
   142         with remote.commandexecutor() as e:
   146         with remote.commandexecutor() as e:
   143             if audit is not None:
   147             if audit is not None:
   144                 audit[b'total-queries'] += len(search)
   148                 audit[b'total-queries'] += len(search)
       
   149                 audit[b'total-queries-between'] += len(search)
   145             between = e.callcommand(b'between', {b'pairs': search}).result()
   150             between = e.callcommand(b'between', {b'pairs': search}).result()
   146 
   151 
   147         for n, l in zip(search, between):
   152         for n, l in zip(search, between):
   148             l.append(n[1])
   153             l.append(n[1])
   149             p = n[0]
   154             p = n[0]