Patchwork D1497: hbisect: pass repo into hbisect.bisect

login
register
mail settings
Submitter phabricator
Date Nov. 23, 2017, 10:24 p.m.
Message ID <differential-rev-PHID-DREV-vzslyfz36wfq4yv5tlmj-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25732/
State Superseded
Headers show

Comments

phabricator - Nov. 23, 2017, 10:24 p.m.
dsp created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Pass repo into the bisect function to get more flexibility in what we can call.
  This will allow us to use revsets to rewrite parts of the ancestor and children
  calculation in later patches.

TEST PLAN
    python run-tests.py test-bisect*

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1497

AFFECTED FILES
  mercurial/commands.py
  mercurial/hbisect.py

CHANGE DETAILS




To: dsp, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/hbisect.py b/mercurial/hbisect.py
--- a/mercurial/hbisect.py
+++ b/mercurial/hbisect.py
@@ -21,7 +21,7 @@ 
     error,
 )
 
-def bisect(changelog, state):
+def bisect(repo, state):
     """find the next node (if any) for testing during a bisect search.
     returns a (nodes, number, good) tuple.
 
@@ -32,6 +32,7 @@ 
     if searching for a first bad one.
     """
 
+    changelog = repo.changelog
     clparents = changelog.parentrevs
     skip = set([changelog.rev(n) for n in state['skip']])
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -853,7 +853,7 @@ 
                 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
                 hbisect.checkstate(state)
                 # bisect
-                nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
+                nodes, changesets, bgood = hbisect.bisect(repo, state)
                 # update to next check
                 node = nodes[0]
                 mayupdate(repo, node, show_stats=False)
@@ -866,7 +866,7 @@ 
     hbisect.checkstate(state)
 
     # actually bisect
-    nodes, changesets, good = hbisect.bisect(repo.changelog, state)
+    nodes, changesets, good = hbisect.bisect(repo, state)
     if extend:
         if not changesets:
             extendnode = hbisect.extendrange(repo, state, nodes, good)