[PATCH 2 of 5 V2] graphmod: avoid sorting when already sorted

Martijn Pieters mj at zopatista.com
Tue May 24 05:11:59 UTC 2016


# HG changeset patch
# User Martijn Pieters <mjpieters at fb.com>
# Date 1464035751 25200
#      Mon May 23 13:35:51 2016 -0700
# Node ID eae833e8ed17f2da948155849daa2959ce535c38
# Parent  03cd59ee6b5cd205968abcf9a63eeaa23dfc9f6e
graphmod: avoid sorting when already sorted

This is somewhat redundant now, but allows us to add a toposort that should not
be re-sorted either.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2147,7 +2147,8 @@
     if opts.get('rev'):
         # User-specified revs might be unsorted, but don't sort before
         # _makelogrevset because it might depend on the order of revs
-        revs.sort(reverse=True)
+        if revs.sortorder != ('-rev',):
+            revs.sort(reverse=True)
     if expr:
         # Revset matchers often operate faster on revisions in changelog
         # order, because most filters deal with the changelog.



More information about the Mercurial-devel mailing list