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

login
register
mail settings
Submitter Boris Feld
Date Sept. 28, 2018, 10:22 a.m.
Message ID <e91cce6bdd293a7c498b.1538130140@Laptop-Boris.lan>
Download mbox | patch
Permalink /patch/35161/
State Superseded
Headers show

Comments

Boris Feld - Sept. 28, 2018, 10:22 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1538060400 -7200
#      Thu Sep 27 17:00:00 2018 +0200
# Node ID e91cce6bdd293a7c498bac3925b47a9f94dd22e9
# Parent  4bd42e72e7ba8c0ee9dc4e153127882e6961602a
# EXP-Topic obsolete-duplicates
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r e91cce6bdd29
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
@@ -1600,35 +1600,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 = list(repo.changelog.revs(start=origrepolen))
-            if not revs:
-                return
-            minrev, maxrev = repo[revs[0]], repo[revs[-1]]
+            if revs:
+                minrev, maxrev = repo[revs[0]], repo[revs[-1]]
 
-            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):