Patchwork [6,of,6,py3,progress,v2] repoview: use repo.revs() instead of a private revset method

login
register
mail settings
Submitter Augie Fackler
Date Feb. 4, 2014, 10:24 p.m.
Message ID <ef92408103c0ce249f86.1391552680@augie-macbookair>
Download mbox | patch
Permalink /patch/3476/
State Accepted
Commit cb63aa14aaf7518001214742764bfc5030c6f57e
Headers show

Comments

Augie Fackler - Feb. 4, 2014, 10:24 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1391552025 18000
#      Tue Feb 04 17:13:45 2014 -0500
# Node ID ef92408103c0ce249f862e5d7a30a715e5e7b622
# Parent  f5feb6d0ebf4e9230b3f0de91c0ae76dbe1ba408
repoview: use repo.revs() instead of a private revset method

Breaks an import cycle.
Matt Mackall - Feb. 10, 2014, 2:01 a.m.
On Tue, 2014-02-04 at 17:24 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf@durin42.com>
> # Date 1391552025 18000
> #      Tue Feb 04 17:13:45 2014 -0500
> # Node ID ef92408103c0ce249f862e5d7a30a715e5e7b622
> # Parent  f5feb6d0ebf4e9230b3f0de91c0ae76dbe1ba408
> repoview: use repo.revs() instead of a private revset method

I think I've queued all but 2. Will give more thought to 2 shortly.
Augie Fackler - Feb. 10, 2014, 2:18 a.m.
On Feb 9, 2014, at 9:01 PM, Matt Mackall <mpm@selenic.com> wrote:

> On Tue, 2014-02-04 at 17:24 -0500, Augie Fackler wrote:
>> # HG changeset patch
>> # User Augie Fackler <raf@durin42.com>
>> # Date 1391552025 18000
>> #      Tue Feb 04 17:13:45 2014 -0500
>> # Node ID ef92408103c0ce249f862e5d7a30a715e5e7b622
>> # Parent  f5feb6d0ebf4e9230b3f0de91c0ae76dbe1ba408
>> repoview: use repo.revs() instead of a private revset method
> 
> I think I've queued all but 2. Will give more thought to 2 shortly.

Sweet. Happy to chat in IRC sometime this week if you want to talk that out.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -9,7 +9,7 @@ 
 import copy
 import phases
 import util
-import obsolete, revset
+import obsolete
 
 
 def hideablerevs(repo):
@@ -28,8 +28,9 @@ 
         cl = repo.changelog
         firsthideable = min(hideable)
         revs = cl.revs(start=firsthideable)
-        blockers = [r for r in revset._children(repo, revs, hideable)
-                      if r not in hideable]
+        tofilter = repo.revs(
+            '(%ld) and children(%ld)', list(revs), list(hideable))
+        blockers = [r for r in tofilter if r not in hideable]
         for par in repo[None].parents():
             blockers.append(par.rev())
         for bm in repo._bookmarks.values():
diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
--- a/tests/test-module-imports.t
+++ b/tests/test-module-imports.t
@@ -33,4 +33,3 @@ 
      config, error, parser, templatefilters, util
   mercurial/ui.py mixed stdlib and relative imports:
      config, error, formatter, scmutil, util
-  Import cycle: mercurial.repoview -> mercurial.revset -> mercurial.repoview