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

login
register
mail settings
Submitter phabricator
Date June 14, 2018, 8:28 p.m.
Message ID <4c0e2e8cb70a8761b48331bd2032ea06@localhost.localdomain>
Download mbox | patch
Permalink /patch/32142/
State Not Applicable
Headers show

Comments

phabricator - June 14, 2018, 8:28 p.m.
pulkit updated this revision to Diff 9061.

REPOSITORY
  rHG Mercurial

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

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1456,9 +1456,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
@@ -1500,6 +1500,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 seprate 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)