Patchwork [3,of,5,V2] pullreport: skip or rework some early return

login
register
mail settings
Submitter Boris Feld
Date Sept. 28, 2018, 5:49 p.m.
Message ID <ee865e674f55e4434a07.1538156949@localhost.localdomain>
Download mbox | patch
Permalink /patch/35174/
State Accepted
Headers show

Comments

Boris Feld - Sept. 28, 2018, 5:49 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1538060400 -7200
#      Thu Sep 27 17:00:00 2018 +0200
# Node ID ee865e674f55e4434a0796810872235999c8d438
# Parent  c2ac56afe1e26620a0c38a0f006902102dae9f19
# EXP-Topic obsolete-duplicates
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r ee865e674f55
pullreport: skip or rework some early return

We are about to add more logic in this report. Before that, we need it to not
quit so early.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1603,35 +1603,36 @@  def registersummarycallback(repo, otr, t
         def reportnewcs(repo, tr):
             """Report the range of new revisions pulled/unbundled."""
             origrepolen = tr.changes.get('origrepolen', len(repo))
-            if origrepolen >= len(repo):
+            unfi = repo.unfiltered()
+            if origrepolen >= len(unfi):
                 return
 
             # Compute the bounds of new visible revisions' range.
             revs = smartset.spanset(repo, start=origrepolen)
-            if not revs:
-                return
-            minrev, maxrev = repo[revs.min()], repo[revs.max()]
+            if revs:
+                minrev, maxrev = repo[revs.min()], repo[revs.max()]
 
-            if minrev == maxrev:
-                revrange = minrev
-            else:
-                revrange = '%s:%s' % (minrev, maxrev)
-            draft = len(repo.revs('%ld and draft()', revs))
-            secret = len(repo.revs('%ld and secret()', revs))
-            if not (draft or secret):
-                msg = _('new changesets %s\n') % revrange
-            elif draft and secret:
-                msg = _('new changesets %s (%d drafts, %d secrets)\n')
-                msg %= (revrange, draft, secret)
-            elif draft:
-                msg = _('new changesets %s (%d drafts)\n')
-                msg %= (revrange, draft)
-            elif secret:
-                msg = _('new changesets %s (%d secrets)\n')
-                msg %= (revrange, secret)
-            else:
-                raise error.ProgrammingError('entered unreachable condition')
-            repo.ui.status(msg)
+                if minrev == maxrev:
+                    revrange = minrev
+                else:
+                    revrange = '%s:%s' % (minrev, maxrev)
+                draft = len(repo.revs('%ld and draft()', revs))
+                secret = len(repo.revs('%ld and secret()', revs))
+                if not (draft or secret):
+                    msg = _('new changesets %s\n') % revrange
+                elif draft and secret:
+                    msg = _('new changesets %s (%d drafts, %d secrets)\n')
+                    msg %= (revrange, draft, secret)
+                elif draft:
+                    msg = _('new changesets %s (%d drafts)\n')
+                    msg %= (revrange, draft)
+                elif secret:
+                    msg = _('new changesets %s (%d secrets)\n')
+                    msg %= (revrange, secret)
+                else:
+                    errormsg = 'entered unreachable condition'
+                    raise error.ProgrammingError(errormsg)
+                repo.ui.status(msg)
 
         @reportsummary
         def reportphasechanges(repo, tr):