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

login
register
mail settings
Submitter phabricator
Date June 25, 2018, 3:20 p.m.
Message ID <008b5cafbe2fab407e56afd6d6b7901b@localhost.localdomain>
Download mbox | patch
Permalink /patch/32416/
State Not Applicable
Headers show

Comments

phabricator - June 25, 2018, 3:20 p.m.
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

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)