changeset 34737:0c06875e7755

transaction-summary: use a revset to filter obsoletes in reportnewcs() Thanks to Yuya Nishihara for suggesting.
author Denis Laxalde <denis@laxalde.org>
date Mon, 16 Oct 2017 15:35:08 +0200
parents 25b5787e8dde
children 1c9128b735cd
files mercurial/scmutil.py
diffstat 1 files changed, 3 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Sun Oct 15 20:32:10 2017 +0530
+++ b/mercurial/scmutil.py	Mon Oct 16 15:35:08 2017 +0200
@@ -1242,20 +1242,11 @@
 
             # Compute the bounds of new revisions' range, excluding obsoletes.
             unfi = repo.unfiltered()
-            minrev, maxrev = None, None
-            newrevs.sort()
-            for r in newrevs:
-                if not unfi[r].obsolete():
-                    minrev = repo[r]
-                    break
-            for r in reversed(newrevs):
-                if not unfi[r].obsolete():
-                    maxrev = repo[r]
-                    break
-
-            if minrev is None or maxrev is None:
+            revs = unfi.revs('%ld and not obsolete()', newrevs)
+            if not revs:
                 # Got only obsoletes.
                 return
+            minrev, maxrev = repo[revs.min()], repo[revs.max()]
 
             if minrev == maxrev:
                 revrange = minrev