Patchwork D3734: scmutil: move construction of instability count message to separate fn

login
register
mail settings
Submitter phabricator
Date June 24, 2018, 7:42 p.m.
Message ID <b052118d1d1ed8d13990fe4e43f0da3e@localhost.localdomain>
Download mbox | patch
Permalink /patch/32402/
State Not Applicable
Headers show

Comments

phabricator - June 24, 2018, 7:42 p.m.
pulkit updated this revision to Diff 9272.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3734?vs=9061&id=9272

REVISION DETAIL
  https://phab.mercurial-scm.org/D3734

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS




To: pulkit, #hg-reviewers, lothiraldan
Cc: lothiraldan, mercurial-devel

Patch

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)