Closed by commit rHGf4c01f43132a: scmutil: add option to register summary callbacks as transaction validators (authored by pulkit). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8199?vs=20405&id=20738 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8199/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8199 AFFECTED FILES mercurial/scmutil.py CHANGE DETAILS diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1900,8 +1900,11 @@ _reportstroubledchangesets = True -def registersummarycallback(repo, otr, txnname=b''): +def registersummarycallback(repo, otr, txnname=b'', as_validator=False): """register a callback to issue a summary after the transaction is closed + + If as_validator is true, then the callbacks are registered as transaction + validators instead """ def txmatch(sources): @@ -1927,7 +1930,10 @@ func(repo, tr) newcat = b'%02i-txnreport' % len(categories) - otr.addpostclose(newcat, wrapped) + if as_validator: + otr.addvalidator(newcat, wrapped) + else: + otr.addpostclose(newcat, wrapped) categories.append(newcat) return wrapped @@ -1942,6 +1948,8 @@ if cgheads: htext = _(b" (%+d heads)") % cgheads msg = _(b"added %d changesets with %d changes to %d files%s\n") + if as_validator: + msg = _(b"adding %d changesets with %d changes to %d files%s\n") assert repo is not None # help pytype repo.ui.status(msg % (cgchangesets, cgrevisions, cgfiles, htext)) @@ -1954,7 +1962,10 @@ if newmarkers: repo.ui.status(_(b'%i new obsolescence markers\n') % newmarkers) if obsoleted: - repo.ui.status(_(b'obsoleted %i changesets\n') % len(obsoleted)) + msg = _(b'obsoleted %i changesets\n') + if as_validator: + msg = _(b'obsoleting %i changesets\n') + repo.ui.status(msg % len(obsoleted)) if obsolete.isenabled( repo, obsolete.createmarkersopt @@ -2057,9 +2068,10 @@ ] if not published: return - repo.ui.status( - _(b'%d local changesets published\n') % len(published) - ) + msg = _(b'%d local changesets published\n') + if as_validator: + msg = _(b'%d local changesets will be published\n') + repo.ui.status(msg % len(published)) def getinstabilitymessage(delta, instability): To: pulkit, #hg-reviewers Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel