comparison mercurial/scmutil.py @ 38204:eb9835014d20

transaction-summary: show phase changes statistics in pull/unbundle Upon pull or unbundle, we display a message with the number of changesets which phase became public. Noticeably, this new message would appear even if no new changeset were added (below the "no changes found" message), thus indicating that something actually happened to the local repository.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Thu, 24 May 2018 12:19:50 +0200
parents 46c2b19a1263
children 1e9c357d3ddf
comparison
equal deleted inserted replaced
38203:dfb888aae17a 38204:eb9835014d20
1480 revrange = minrev 1480 revrange = minrev
1481 else: 1481 else:
1482 revrange = '%s:%s' % (minrev, maxrev) 1482 revrange = '%s:%s' % (minrev, maxrev)
1483 repo.ui.status(_('new changesets %s\n') % revrange) 1483 repo.ui.status(_('new changesets %s\n') % revrange)
1484 1484
1485 @reportsummary
1486 def reportphasechanges(repo, tr):
1487 """Report statistics of phase changes for changesets pre-existing
1488 pull/unbundle.
1489 """
1490 newrevs = tr.changes.get('revs', xrange(0, 0))
1491 phasetracking = tr.changes.get('phases', {})
1492 if not phasetracking:
1493 return
1494 published = [
1495 rev for rev, (old, new) in phasetracking.iteritems()
1496 if new == phases.public and rev not in newrevs
1497 ]
1498 if not published:
1499 return
1500 repo.ui.status(_('%d changesets became public\n')
1501 % len(published))
1502
1485 def nodesummaries(repo, nodes, maxnumnodes=4): 1503 def nodesummaries(repo, nodes, maxnumnodes=4):
1486 if len(nodes) <= maxnumnodes or repo.ui.verbose: 1504 if len(nodes) <= maxnumnodes or repo.ui.verbose:
1487 return ' '.join(short(h) for h in nodes) 1505 return ' '.join(short(h) for h in nodes)
1488 first = ' '.join(short(h) for h in nodes[:maxnumnodes]) 1506 first = ' '.join(short(h) for h in nodes[:maxnumnodes])
1489 return _("%s and %d others") % (first, len(nodes) - maxnumnodes) 1507 return _("%s and %d others") % (first, len(nodes) - maxnumnodes)