Patchwork [2,of,2,STABLE] revset: unindent "if True" block in sort()

login
register
mail settings
Submitter Yuya Nishihara
Date April 23, 2016, noon
Message ID <7e65a3bb8b4c2416e200.1461412816@mimosa>
Download mbox | patch
Permalink /patch/14768/
State Accepted
Commit ea794f2eb19dbffa7da3f1e4557b9687d0878831
Headers show

Comments

Yuya Nishihara - April 23, 2016, noon
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1461395465 -32400
#      Sat Apr 23 16:11:05 2016 +0900
# Branch stable
# Node ID 7e65a3bb8b4c2416e20056b3fdbcd6576802ae30
# Parent  0c66025c95e7e11ce7fea2be633d995fd67b6033
revset: unindent "if True" block in sort()

It was there to make the previous patch readable.
Matt Mackall - April 23, 2016, 3:44 p.m.
On Sat, 2016-04-23 at 21:00 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1461395465 -32400
> #      Sat Apr 23 16:11:05 2016 +0900
> # Branch stable
> # Node ID 7e65a3bb8b4c2416e20056b3fdbcd6576802ae30
> # Parent  0c66025c95e7e11ce7fea2be633d995fd67b6033
> revset: unindent "if True" block in sort()

These are queued for stable, thanks.

-- 
Mathematics is the supreme nostalgia of our time.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1868,30 +1868,29 @@  def sort(repo, subset, x):
         return revs
     # sort() is guaranteed to be stable
     ctxs = [repo[r] for r in revs]
-    if True:
-        for k in reversed(keys):
-            if k == 'rev':
-                ctxs.sort(key=lambda c: c.rev())
-            elif k == '-rev':
-                ctxs.sort(key=lambda c: c.rev(), reverse=True)
-            elif k == 'branch':
-                ctxs.sort(key=lambda c: c.branch())
-            elif k == '-branch':
-                ctxs.sort(key=lambda c: c.branch(), reverse=True)
-            elif k == 'desc':
-                ctxs.sort(key=lambda c: c.description())
-            elif k == '-desc':
-                ctxs.sort(key=lambda c: c.description(), reverse=True)
-            elif k in 'user author':
-                ctxs.sort(key=lambda c: c.user())
-            elif k in '-user -author':
-                ctxs.sort(key=lambda c: c.user(), reverse=True)
-            elif k == 'date':
-                ctxs.sort(key=lambda c: c.date()[0])
-            elif k == '-date':
-                ctxs.sort(key=lambda c: c.date()[0], reverse=True)
-            else:
-                raise error.ParseError(_("unknown sort key %r") % k)
+    for k in reversed(keys):
+        if k == 'rev':
+            ctxs.sort(key=lambda c: c.rev())
+        elif k == '-rev':
+            ctxs.sort(key=lambda c: c.rev(), reverse=True)
+        elif k == 'branch':
+            ctxs.sort(key=lambda c: c.branch())
+        elif k == '-branch':
+            ctxs.sort(key=lambda c: c.branch(), reverse=True)
+        elif k == 'desc':
+            ctxs.sort(key=lambda c: c.description())
+        elif k == '-desc':
+            ctxs.sort(key=lambda c: c.description(), reverse=True)
+        elif k in 'user author':
+            ctxs.sort(key=lambda c: c.user())
+        elif k in '-user -author':
+            ctxs.sort(key=lambda c: c.user(), reverse=True)
+        elif k == 'date':
+            ctxs.sort(key=lambda c: c.date()[0])
+        elif k == '-date':
+            ctxs.sort(key=lambda c: c.date()[0], reverse=True)
+        else:
+            raise error.ParseError(_("unknown sort key %r") % k)
     return baseset([c.rev() for c in ctxs])
 
 @predicate('subrepo([pattern])')