changeset 3448:6ca49c5fe268

Stop erroring out pull -r and clone -r if repository isn't local.
author Eric Hopper <hopper@omnifarious.org>
date Sat, 09 Sep 2006 18:25:07 -0700
parents ef1032c223e7
children c8686e3f0291
files mercurial/commands.py mercurial/hg.py mercurial/localrepo.py
diffstat 3 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Sep 09 18:25:06 2006 -0700
+++ b/mercurial/commands.py	Sat Sep 09 18:25:07 2006 -0700
@@ -2105,10 +2105,12 @@
     other = hg.repository(ui, source)
     ui.status(_('pulling from %s\n') % (source))
     revs = None
-    if opts['rev'] and not other.local():
-        raise util.Abort(_("pull -r doesn't work for remote repositories yet"))
-    elif opts['rev']:
-        revs = [other.lookup(rev) for rev in opts['rev']]
+    if opts['rev']:
+        if 'lookup' in other.capabilities:
+            revs = [other.lookup(rev) for rev in opts['rev']]
+        else:
+            error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
+            raise util.Abort(error)
     modheads = repo.pull(other, heads=revs, force=opts['force'])
     return postincoming(ui, repo, modheads, opts['update'])
 
--- a/mercurial/hg.py	Sat Sep 09 18:25:06 2006 -0700
+++ b/mercurial/hg.py	Sat Sep 09 18:25:07 2006 -0700
@@ -176,9 +176,10 @@
     else:
         revs = None
         if rev:
-            if not src_repo.local():
-                raise util.Abort(_("clone by revision not supported yet "
-                                   "for remote repositories"))
+            if 'lookup' not in src_repo.capabilities:
+                raise util.Abort(_("src repository does not support revision "
+                                   "lookup and so doesn't support clone by "
+                                   "revision"))
             revs = [src_repo.lookup(r) for r in rev]
 
         if dest_repo.local():
--- a/mercurial/localrepo.py	Sat Sep 09 18:25:06 2006 -0700
+++ b/mercurial/localrepo.py	Sat Sep 09 18:25:07 2006 -0700
@@ -15,7 +15,7 @@
 demandload(globals(), "os revlog time util")
 
 class localrepository(repo.repository):
-    capabilities = ()
+    capabilities = ('lookup', 'changegroupsubset')
 
     def __del__(self):
         self.transhandle = None
@@ -1241,6 +1241,8 @@
             if heads is None:
                 cg = remote.changegroup(fetch, 'pull')
             else:
+                if 'changegroupsubset' not in remote.capabilities:
+                    raise util.Abort(_("Partial pull cannot be done because other repository doesn't support changegroupsubset."))
                 cg = remote.changegroupsubset(fetch, heads, 'pull')
             return self.addchangegroup(cg, 'pull', remote.url())
         finally: