From patchwork Mon Jun 25 15:20:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D3734: scmutil: move construction of instability count message to separate fn From: phabricator X-Patchwork-Id: 32416 Message-Id: <008b5cafbe2fab407e56afd6d6b7901b@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Mon, 25 Jun 2018 15:20:39 +0000 This revision was automatically updated to reflect the committed changes. Closed by commit rHG1cac2e8c7624: scmutil: move construction of instability count message to separate fn (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3734?vs=9272&id=9283 REVISION DETAIL https://phab.mercurial-scm.org/D3734 AFFECTED FILES mercurial/scmutil.py CHANGE DETAILS To: pulkit, #hg-reviewers, lothiraldan, durin42 Cc: lothiraldan, mercurial-devel diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1522,9 +1522,9 @@ for instability, revset in instabilitytypes: delta = (newinstabilitycounts[instability] - oldinstabilitycounts[instability]) - if delta > 0: - repo.ui.warn(_('%i new %s changesets\n') % - (delta, instability)) + msg = getinstabilitymessage(delta, instability) + if msg: + repo.ui.warn(msg) if txmatch(_reportnewcssource): @reportsummary @@ -1566,6 +1566,14 @@ repo.ui.status(_('%d local changesets published\n') % len(published)) +def getinstabilitymessage(delta, instability): + """function to return the message to show warning about new instabilities + + exists as a separate function so that extension can wrap to show more + information like how to fix instabilities""" + if delta > 0: + return _('%i new %s changesets\n') % (delta, instability) + def nodesummaries(repo, nodes, maxnumnodes=4): if len(nodes) <= maxnumnodes or repo.ui.verbose: return ' '.join(short(h) for h in nodes)