fetch: allow -r for remote repos
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Wed, 20 May 2009 19:37:25 +0200
changeset 8532 b97e2417ae53
parent 8531 810387f59696
child 8533 6062c6362b2e
fetch: allow -r for remote repos
hgext/fetch.py
--- a/hgext/fetch.py	Wed May 20 18:35:47 2009 +0200
+++ b/hgext/fetch.py	Wed May 20 19:37:25 2009 +0200
@@ -9,7 +9,7 @@
 
 from mercurial.i18n import _
 from mercurial.node import nullid, short
-from mercurial import commands, cmdutil, hg, util, url
+from mercurial import commands, cmdutil, hg, util, url, error
 from mercurial.lock import release
 
 def fetch(ui, repo, source='default', **opts):
@@ -67,11 +67,12 @@
                   url.hidepassword(ui.expandpath(source)))
         revs = None
         if opts['rev']:
-            if not other.local():
-                raise util.Abort(_("fetch -r doesn't work for remote "
-                                   "repositories yet"))
-            else:
+            try:
                 revs = [other.lookup(rev) for rev in opts['rev']]
+            except error.CapabilityError:
+                err = _("Other repository doesn't support revision lookup, "
+                        "so a rev cannot be specified.")
+                raise util.Abort(err)
 
         # Are there any changes at all?
         modheads = repo.pull(other, heads=revs)