[PATCH] extensions: add revset support to most extensions

Will Maier willmaier at ml1.net
Thu Nov 11 11:59:37 CST 2010


Hi all-

The patch below adds revset support to all of the extensions that a) seemed to
need it and b) I could test. Test suite passes here, as do various manual sanity
checks.

# HG changeset patch
# User Will Maier <willmaier at ml1.net>
# Date 1289478964 21600
# Node ID 2541c7ba133dbfb04dc86fd4759b5c98d57a6652
# Parent  e80128e40c044ea6619c3dc160df69ad36a8e5ff
extensions: add revset support to most extensions

diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
--- a/hgext/bookmarks.py
+++ b/hgext/bookmarks.py
@@ -31,7 +31,7 @@ branching.
 from mercurial.i18n import _
 from mercurial.node import nullid, nullrev, bin, hex, short
 from mercurial import util, commands, repair, extensions, pushkey, hg, url
-from mercurial import revset
+from mercurial import cmdutil, revset
 import os
 
 def write(repo):
@@ -151,7 +151,7 @@ def bookmark(ui, repo, mark=None, rev=No
             raise util.Abort(
                 _("a bookmark cannot have the name of an existing branch"))
         if rev:
-            marks[mark] = repo.lookup(rev)
+            marks[mark] = cmdutil.revsingle(repo, rev).node()
         else:
             marks[mark] = repo.changectx('.').node()
         setcurrent(repo, mark)
diff --git a/hgext/children.py b/hgext/children.py
--- a/hgext/children.py
+++ b/hgext/children.py
@@ -28,7 +28,7 @@ def children(ui, repo, file_=None, **opt
     if file_:
         ctx = repo.filectx(file_, changeid=rev)
     else:
-        ctx = repo[rev]
+        ctx = cmdutil.revsingle(repo, rev)
 
     displayer = cmdutil.show_changeset(ui, repo, opts)
     for cctx in ctx.children():
diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -121,7 +121,7 @@ def dodiff(ui, repo, diffcmd, diffopts, 
         msg = _('cannot specify --rev and --change at the same time')
         raise util.Abort(msg)
     elif change:
-        node2 = repo.lookup(change)
+        node2 = cmdutil.revsingle(repo, change).node()
         node1a, node1b = repo.changelog.parents(node2)
     else:
         node1a, node2 = cmdutil.revpair(repo, revs)
diff --git a/hgext/fetch.py b/hgext/fetch.py
--- a/hgext/fetch.py
+++ b/hgext/fetch.py
@@ -70,7 +70,7 @@ def fetch(ui, repo, source='default', **
         revs = None
         if opts['rev']:
             try:
-                revs = [other.lookup(rev) for rev in opts['rev']]
+                revs = [cmdutil.revsingle(other, rev).node() for rev in opts['rev']]
             except error.CapabilityError:
                 err = _("Other repository doesn't support revision lookup, "
                         "so a rev cannot be specified.")
diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -6,7 +6,7 @@
 '''commands to sign and verify changesets'''
 
 import os, tempfile, binascii
-from mercurial import util, commands, match
+from mercurial import cmdutil, util, commands, match
 from mercurial import node as hgnode
 from mercurial.i18n import _
 
@@ -162,7 +162,7 @@ def sigs(ui, repo):
 def check(ui, repo, rev):
     """verify all the signatures there may be for a particular revision"""
     mygpg = newgpg(ui)
-    rev = repo.lookup(rev)
+    rev = cmdutil.revsingle(repo, rev).node()
     hexrev = hgnode.hex(rev)
     keys = []
 
@@ -209,7 +209,7 @@ def sign(ui, repo, *revs, **opts):
         opts['date'] = util.parsedate(date)
 
     if revs:
-        nodes = [repo.lookup(n) for n in revs]
+        nodes = [cmdutil.revsingle(repo, n).node() for n in revs]
     else:
         nodes = [node for node in repo.dirstate.parents()
                  if node != hgnode.nullid]
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2432,7 +2432,7 @@ def restore(ui, repo, rev, **opts):
     """restore the queue state saved by a revision (DEPRECATED)
 
     This command is deprecated, use :hg:`rebase` instead."""
-    rev = repo.lookup(rev)
+    rev = cmdutil.revsingle(repo, rev).node()
     q = repo.mq
     q.restore(repo, rev, delete=opts.get('delete'),
               qupdate=opts.get('update'))
diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -236,7 +236,7 @@ def patchbomb(ui, repo, *revs, **opts):
         dest, branches = hg.parseurl(dest)
         revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
         if revs:
-            revs = [repo.lookup(rev) for rev in revs]
+            revs = [cmdutil.revsingle(repo, rev).node() for rev in revs]
         other = hg.repository(hg.remoteui(repo, opts), dest)
         ui.status(_('comparing with %s\n') % url.hidepassword(dest))
         o = discovery.findoutgoing(repo, other)


More information about the Mercurial-devel mailing list