changeset 8532:b97e2417ae53

fetch: allow -r for remote repos
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Wed, 20 May 2009 19:37:25 +0200
parents 810387f59696
children 6062c6362b2e
files hgext/fetch.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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)