mercurial/treediscovery.py
branchstable
changeset 49402 236702592ff0
parent 49401 362c0026a977
child 49405 f64f66167afc
equal deleted inserted replaced
49401:362c0026a977 49402:236702592ff0
    36         with remote.commandexecutor() as e:
    36         with remote.commandexecutor() as e:
    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-roundtrips-heads'] = 1
       
    42         audit[b'total-roundtrips-branches'] = 0
       
    43         audit[b'total-roundtrips-between'] = 0
    41         audit[b'total-queries'] = 0
    44         audit[b'total-queries'] = 0
    42         audit[b'total-queries-branches'] = 0
    45         audit[b'total-queries-branches'] = 0
    43         audit[b'total-queries-between'] = 0
    46         audit[b'total-queries-between'] = 0
    44 
    47 
    45     if repo.changelog.tip() == repo.nullid:
    48     if repo.changelog.tip() == repo.nullid:
    72     # (a branch always has two parents (or none) by definition)
    75     # (a branch always has two parents (or none) by definition)
    73     with remote.commandexecutor() as e:
    76     with remote.commandexecutor() as e:
    74         if audit is not None:
    77         if audit is not None:
    75             audit[b'total-queries'] += len(unknown)
    78             audit[b'total-queries'] += len(unknown)
    76             audit[b'total-queries-branches'] += len(unknown)
    79             audit[b'total-queries-branches'] += len(unknown)
       
    80             audit[b'total-roundtrips'] += 1
       
    81             audit[b'total-roundtrips-branches'] += 1
    77         branches = e.callcommand(b'branches', {b'nodes': unknown}).result()
    82         branches = e.callcommand(b'branches', {b'nodes': unknown}).result()
    78 
    83 
    79     unknown = collections.deque(branches)
    84     unknown = collections.deque(branches)
    80     while unknown:
    85     while unknown:
    81         r = []
    86         r = []
   122                 with remote.commandexecutor() as e:
   127                 with remote.commandexecutor() as e:
   123                     subset = r[p : p + 10]
   128                     subset = r[p : p + 10]
   124                     if audit is not None:
   129                     if audit is not None:
   125                         audit[b'total-queries'] += len(subset)
   130                         audit[b'total-queries'] += len(subset)
   126                         audit[b'total-queries-branches'] += len(subset)
   131                         audit[b'total-queries-branches'] += len(subset)
       
   132                         audit[b'total-roundtrips'] += 1
       
   133                         audit[b'total-roundtrips-branches'] += 1
   127                     branches = e.callcommand(
   134                     branches = e.callcommand(
   128                         b'branches',
   135                         b'branches',
   129                         {
   136                         {
   130                             b'nodes': subset,
   137                             b'nodes': subset,
   131                         },
   138                         },
   145 
   152 
   146         with remote.commandexecutor() as e:
   153         with remote.commandexecutor() as e:
   147             if audit is not None:
   154             if audit is not None:
   148                 audit[b'total-queries'] += len(search)
   155                 audit[b'total-queries'] += len(search)
   149                 audit[b'total-queries-between'] += len(search)
   156                 audit[b'total-queries-between'] += len(search)
       
   157                 audit[b'total-roundtrips'] += 1
       
   158                 audit[b'total-roundtrips-between'] += 1
   150             between = e.callcommand(b'between', {b'pairs': search}).result()
   159             between = e.callcommand(b'between', {b'pairs': search}).result()
   151 
   160 
   152         for n, l in zip(search, between):
   161         for n, l in zip(search, between):
   153             l.append(n[1])
   162             l.append(n[1])
   154             p = n[0]
   163             p = n[0]
   190         + b"\n"
   199         + b"\n"
   191     )
   200     )
   192 
   201 
   193     progress.complete()
   202     progress.complete()
   194     repo.ui.debug(b"%d total queries\n" % reqcnt)
   203     repo.ui.debug(b"%d total queries\n" % reqcnt)
   195     if audit is not None:
       
   196         audit[b'total-roundtrips'] = reqcnt
       
   197 
   204 
   198     return base, list(fetch), heads
   205     return base, list(fetch), heads