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

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Mon Jun 25 11:20:39 EDT 2018


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

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)



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


More information about the Mercurial-devel mailing list