[PATCH v2] transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Yuya Nishihara
yuya at tcha.org
Sat Oct 14 01:38:36 EDT 2017
On Thu, 12 Oct 2017 10:13:57 +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde at logilab.fr>
> # Date 1507793990 -7200
> # Thu Oct 12 09:39:50 2017 +0200
> # Node ID 48cca33a1b611c82a2bd72a2f72b80f321604f42
> # Parent f1c2552c2de78a2f8a0c0ded099ccb200aad27d0
> # Available At http://hg.logilab.org/users/dlaxalde/hg
> # hg pull http://hg.logilab.org/users/dlaxalde/hg -r 48cca33a1b61
> # EXP-Topic pull-info-transaction
> transaction-summary: show the range of new revisions upon pull/unbundle (BC)
> + if txmatch(_reportnewcssource):
> + @reportsummary
> + def reportnewcs(repo, tr):
> + """Report the range of new revisions pulled/unbundled."""
> + newrevs = list(tr.changes.get('revs', set()))
> + if not newrevs:
> + return
> +
> + # Compute the bounds of new revisions' range, excluding obsoletes.
> + unfi = repo.unfiltered()
> + minrev, maxrev = None, None
> + newrevs.sort()
> + for r in newrevs:
> + if not unfi[r].obsolete():
> + minrev = repo[r]
> + break
> + for r in reversed(newrevs):
> + if not unfi[r].obsolete():
> + maxrev = repo[r]
> + break
> +
> + if minrev is None or maxrev is None:
> + # Got only obsoletes.
> + return
Perhpas revset can be used here.
revs = unfi.revs('%ld and not obsolete()', newrevs)
revs.min(), revs.max()
More information about the Mercurial-devel
mailing list