Patchwork [1,of,3] changegroup: use 'reorder is None' instead of 'reorder is not True/False'

login
register
mail settings
Submitter Martin von Zweigbergk
Date May 2, 2015, 4:45 a.m.
Message ID <b41d78c05dfa968c14eb.1430541927@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/8843/
State Accepted
Commit 80a711e915070b24fa0fabc4bb065b44871f4e7f
Headers show

Comments

Martin von Zweigbergk - May 2, 2015, 4:45 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1429807462 25200
#      Thu Apr 23 09:44:22 2015 -0700
# Node ID b41d78c05dfa968c14ebff48ce9af5527190ead1
# Parent  e9edd53770fb77a9787a3e6592a3bf0a29c1bd80
changegroup: use 'reorder is None' instead of 'reorder is not True/False'

The config option bundle.reorder can be {on,off,auto}, which gets read
into the 'reorder' variable as {True,False,None}. In two places, we
need to decide how to handle the None/auto case. I personally find it
easier to read those expressions when written to explicitly compare to
None.

Patch

diff -r e9edd53770fb -r b41d78c05dfa mercurial/changegroup.py
--- a/mercurial/changegroup.py	Wed Apr 22 15:03:09 2015 -0700
+++ b/mercurial/changegroup.py	Thu Apr 23 09:44:22 2015 -0700
@@ -325,7 +325,7 @@ 
 
         # for generaldelta revlogs, we linearize the revs; this will both be
         # much quicker and generate a much smaller bundle
-        if (revlog._generaldelta and reorder is not False) or reorder:
+        if (revlog._generaldelta and reorder is None) or reorder:
             dag = dagutil.revlogdag(revlog)
             revs = set(revlog.rev(n) for n in nodelist)
             revs = dag.linearize(revs)
@@ -511,7 +511,7 @@ 
     deltaheader = _CHANGEGROUPV2_DELTA_HEADER
 
     def group(self, nodelist, revlog, lookup, units=None, reorder=None):
-        if (revlog._generaldelta and reorder is not True):
+        if (revlog._generaldelta and reorder is None):
             reorder = False
         return super(cg2packer, self).group(nodelist, revlog, lookup,
                                             units=units, reorder=reorder)