contrib/perf.py
changeset 43080 86e4daa2d54c
parent 43076 2372284d9457
child 43117 8ff1ecfadcd1
equal deleted inserted replaced
43079:5209fc94b982 43080:86e4daa2d54c
  1305         raise error.Abort(
  1305         raise error.Abort(
  1306             b'default repository not configured!',
  1306             b'default repository not configured!',
  1307             hint=b"see 'hg help config.paths'",
  1307             hint=b"see 'hg help config.paths'",
  1308         )
  1308         )
  1309     dest = path.pushloc or path.loc
  1309     dest = path.pushloc or path.loc
  1310     ui.status(b'analysing phase of %s\n' % util.hidepassword(dest))
  1310     ui.statusnoi18n(b'analysing phase of %s\n' % util.hidepassword(dest))
  1311     other = hg.peer(repo, opts, dest)
  1311     other = hg.peer(repo, opts, dest)
  1312 
  1312 
  1313     # easier to perform discovery through the operation
  1313     # easier to perform discovery through the operation
  1314     op = exchange.pushoperation(repo, other)
  1314     op = exchange.pushoperation(repo, other)
  1315     exchange._pushdiscoverychangeset(op)
  1315     exchange._pushdiscoverychangeset(op)
  1321             b'listkeys', {b'namespace': b'phases'}
  1321             b'listkeys', {b'namespace': b'phases'}
  1322         ).result()
  1322         ).result()
  1323     del other
  1323     del other
  1324     publishing = remotephases.get(b'publishing', False)
  1324     publishing = remotephases.get(b'publishing', False)
  1325     if publishing:
  1325     if publishing:
  1326         ui.status(b'publishing: yes\n')
  1326         ui.statusnoi18n(b'publishing: yes\n')
  1327     else:
  1327     else:
  1328         ui.status(b'publishing: no\n')
  1328         ui.statusnoi18n(b'publishing: no\n')
  1329 
  1329 
  1330     nodemap = repo.changelog.nodemap
  1330     nodemap = repo.changelog.nodemap
  1331     nonpublishroots = 0
  1331     nonpublishroots = 0
  1332     for nhex, phase in remotephases.iteritems():
  1332     for nhex, phase in remotephases.iteritems():
  1333         if nhex == b'publishing':  # ignore data related to publish option
  1333         if nhex == b'publishing':  # ignore data related to publish option
  1334             continue
  1334             continue
  1335         node = bin(nhex)
  1335         node = bin(nhex)
  1336         if node in nodemap and int(phase):
  1336         if node in nodemap and int(phase):
  1337             nonpublishroots += 1
  1337             nonpublishroots += 1
  1338     ui.status(b'number of roots: %d\n' % len(remotephases))
  1338     ui.statusnoi18n(b'number of roots: %d\n' % len(remotephases))
  1339     ui.status(b'number of known non public roots: %d\n' % nonpublishroots)
  1339     ui.statusnoi18n(b'number of known non public roots: %d\n' % nonpublishroots)
  1340 
  1340 
  1341     def d():
  1341     def d():
  1342         phases.remotephasessummary(repo, remotesubset, remotephases)
  1342         phases.remotephasessummary(repo, remotesubset, remotephases)
  1343 
  1343 
  1344     timer(d)
  1344     timer(d)
  3692 
  3692 
  3693     timer, fm = gettimer(ui, opts)
  3693     timer, fm = gettimer(ui, opts)
  3694 
  3694 
  3695     def write():
  3695     def write():
  3696         for i in range(100000):
  3696         for i in range(100000):
  3697             ui.write(b'Testing write performance\n')
  3697             ui.writenoi18n(b'Testing write performance\n')
  3698 
  3698 
  3699     timer(write)
  3699     timer(write)
  3700     fm.end()
  3700     fm.end()
  3701 
  3701 
  3702 
  3702