mercurial/scmutil.py
changeset 35709 1a09dad8b85a
parent 35499 b55a142f00c5
child 35710 5cd60b0587a8
--- a/mercurial/scmutil.py	Wed Jan 10 14:00:23 2018 -0800
+++ b/mercurial/scmutil.py	Sun Jan 14 23:59:17 2018 -0800
@@ -1222,6 +1222,9 @@
     'unbundle',
 ]
 
+# A marker that tells the evolve extension to suppress its own reporting
+_reportstroubledchangesets = True
+
 def registersummarycallback(repo, otr, txnname=''):
     """register a callback to issue a summary after the transaction is closed
     """
@@ -1257,6 +1260,32 @@
                 repo.ui.status(_('obsoleted %i changesets\n')
                                % len(obsoleted))
 
+    if obsolete.isenabled(repo, obsolete.createmarkersopt):
+        instabilitytypes = [
+            ('orphan', 'orphan'),
+            ('phase-divergent', 'phasedivergent'),
+            ('content-divergent', 'contentdivergent'),
+        ]
+
+        def getinstabilitycounts(repo):
+            filtered = repo.changelog.filteredrevs
+            counts = {}
+            for instability, revset in instabilitytypes:
+                counts[instability] = len(set(obsolete.getrevs(repo, revset)) -
+                                          filtered)
+            return counts
+
+        oldinstabilitycounts = getinstabilitycounts(repo)
+        @reportsummary
+        def reportnewinstabilities(repo, tr):
+            newinstabilitycounts = getinstabilitycounts(repo)
+            for instability, revset in instabilitytypes:
+                delta = (newinstabilitycounts[instability] -
+                         oldinstabilitycounts[instability])
+                if delta > 0:
+                    repo.ui.warn(_('%i new %s changesets\n') %
+                                 (delta, instability))
+
     if txmatch(_reportnewcssource):
         @reportsummary
         def reportnewcs(repo, tr):