localrepo: convert various repo.set() users to repo.revs()
authorMatt Mackall <mpm@selenic.com>
Wed, 02 Nov 2011 13:51:16 -0500
changeset 15404 c1eb8398fe82
parent 15403 e27561eb4a76
child 15405 e4a17bb8472f
child 15426 dc9d0189f60e
localrepo: convert various repo.set() users to repo.revs()
hgext/rebase.py
mercurial/commands.py
mercurial/hbisect.py
--- a/hgext/rebase.py	Wed Nov 02 13:37:34 2011 -0500
+++ b/hgext/rebase.py	Wed Nov 02 13:51:16 2011 -0500
@@ -185,21 +185,19 @@
                 dest = repo[destf]
 
             if revf:
-                revgen = repo.set('%lr', revf)
+                rebaseset = repo.revs('%lr', revf)
             elif srcf:
-                revgen = repo.set('(%r)::', srcf)
+                rebaseset = repo.revs('(%r)::', srcf)
             else:
                 base = basef or '.'
-                revgen = repo.set('(children(ancestor(%r, %d)) and ::(%r))::',
-                                  base, dest, base)
-
-            rebaseset = [c.rev() for c in revgen]
+                rebaseset = repo.revs('(children(ancestor(%r, %d)) & ::%r)::',
+                    base, dest, base)
 
             if not rebaseset:
                 repo.ui.debug('base is ancestor of destination')
                 result = None
-            elif not keepf and list(repo.set('first(children(%ld) - %ld)',
-                                            rebaseset, rebaseset)):
+            elif not keepf and list(repo.revs('first(children(%ld) - %ld)',
+                                              rebaseset, rebaseset)):
                 raise util.Abort(
                     _("can't remove original changesets with"
                       " unrebased descendants"),
@@ -582,8 +580,7 @@
         # rebase on ancestor, force detach
         detach = True
     if detach:
-        detachset = [c.rev() for c in repo.set('::%d - ::%d - %d',
-                                                root, commonbase, root)]
+        detachset = repo.revs('::%d - ::%d - %d', root, commonbase, root)
 
     repo.ui.debug('rebase onto %d starting from %d\n' % (dest, root))
     state = dict.fromkeys(rebaseset, nullrev)
--- a/mercurial/commands.py	Wed Nov 02 13:37:34 2011 -0500
+++ b/mercurial/commands.py	Wed Nov 02 13:51:16 2011 -0500
@@ -2534,16 +2534,16 @@
         revs = scmutil.revrange(repo, revs)
 
     # check for merges
-    for ctx in repo.set('%ld and merge()', revs):
-        ui.warn(_('skipping ungraftable merge revision %s\n') % ctx.rev())
-        revs.remove(ctx.rev())
+    for rev in repo.revs('%ld and merge()', revs):
+        ui.warn(_('skipping ungraftable merge revision %s\n') % rev)
+        revs.remove(rev)
     if not revs:
         return -1
 
     # check for ancestors of dest branch
-    for ctx in repo.set('::. and %ld', revs):
-        ui.warn(_('skipping ancestor revision %s\n') % ctx.rev())
-        revs.remove(ctx.rev())
+    for rev in repo.revs('::. and %ld', revs):
+        ui.warn(_('skipping ancestor revision %s\n') % rev)
+        revs.remove(rev)
     if not revs:
         return -1
 
--- a/mercurial/hbisect.py	Wed Nov 02 13:37:34 2011 -0500
+++ b/mercurial/hbisect.py	Wed Nov 02 13:51:16 2011 -0500
@@ -179,7 +179,7 @@
         # that's because the bisection can go either way
         range = '( bisect(bad)::bisect(good) | bisect(good)::bisect(bad) )'
 
-        _t = [c.rev() for c in repo.set('bisect(good)::bisect(bad)')]
+        _t = repo.revs('bisect(good)::bisect(bad)')
         # The sets of topologically good or bad csets
         if len(_t) == 0:
             # Goods are topologically after bads
@@ -206,18 +206,17 @@
         ignored = '( ( (%s) | (%s) ) - (%s) )' % (iba, iga, range)
 
         if status == 'range':
-            return [c.rev() for c in repo.set(range)]
+            return repo.revs(range)
         elif status == 'pruned':
-            return [c.rev() for c in repo.set(pruned)]
+            return repo.revs(pruned)
         elif status == 'untested':
-            return [c.rev() for c in repo.set(untested)]
+            return repo.revs(untested)
         elif status == 'ignored':
-            return [c.rev() for c in repo.set(ignored)]
+            return repo.revs(ignored)
         elif status == "goods":
-            return [c.rev() for c in repo.set(goods)]
+            return repo.revs(goods)
         elif status == "bads":
-            return [c.rev() for c in repo.set(bads)]
-
+            return repo.revs(bads)
         else:
             raise error.ParseError(_('invalid bisect state'))