Patchwork [2,of,8] revset: cosmetic changes in spanset range comparison

login
register
mail settings
Submitter Pierre-Yves David
Date May 2, 2014, 1:45 a.m.
Message ID <2772b02df67bb5095efb.1398995123@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4475/
State Accepted
Commit 3e53a64345c17ba998d5f35cfd40e787684ec789
Headers show

Comments

Pierre-Yves David - May 2, 2014, 1:45 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1398723251 25200
#      Mon Apr 28 15:14:11 2014 -0700
# Node ID 2772b02df67bb5095efbb3c8299bc0f9bcec6007
# Parent  5aa714530dac1de26436a5fb2057d39e06ebdb44
revset: cosmetic changes in spanset range comparison

We use the python syntax for range comparison: `a < x < c`. This is shorter,
more readable and less error prone. This comparison escaped the cleanup make in
e2031c8ca4f8

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2819,11 +2819,11 @@  class spanset(_orderedsetmixin):
         else:
             count = 0
             start = self._start
             end = self._end
             for rev in self._hiddenrevs:
-                if (end < rev <= start) or (start <= rev and rev < end):
+                if (end < rev <= start) or (start <= rev < end):
                     count += 1
             return abs(self._end - self._start) - count
 
     def __getitem__(self, x):
         # Basic implementation to be changed in future patches.