[PATCH 3 of 3] Stop erroring out pull -r and clone -r if repository isn't local
Eric Hopper
hopper at omnifarious.org
Tue Sep 5 01:15:31 UTC 2006
# HG changeset patch
# User Eric Hopper <hopper at omnifarious.org>
# Date 1157417088 25200
# Node ID eaff8556f66b1e946c95401650568fd58301171d
# Parent 8adb003beaef30f05085c88786ad03d6ae1f0aca
Stop erroring out pull -r and clone -r if repository isn't local.
diff -r 8adb003beaef -r eaff8556f66b mercurial/commands.py
--- a/mercurial/commands.py Mon Sep 04 17:44:45 2006 -0700
+++ b/mercurial/commands.py Mon Sep 04 17:44:48 2006 -0700
@@ -2095,10 +2095,12 @@ def pull(ui, repo, source="default", **o
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'])
diff -r 8adb003beaef -r eaff8556f66b mercurial/hg.py
--- a/mercurial/hg.py Mon Sep 04 17:44:45 2006 -0700
+++ b/mercurial/hg.py Mon Sep 04 17:44:48 2006 -0700
@@ -176,9 +176,10 @@ def clone(ui, source, dest=None, pull=Fa
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():
diff -r 8adb003beaef -r eaff8556f66b mercurial/localrepo.py
--- a/mercurial/localrepo.py Mon Sep 04 17:44:45 2006 -0700
+++ b/mercurial/localrepo.py Mon Sep 04 17:44:48 2006 -0700
@@ -15,7 +15,7 @@ demandload(globals(), "os revlog time ut
demandload(globals(), "os revlog time util")
class localrepository(repo.repository):
- capabilities = ()
+ capabilities = ('lookup', 'changegroupsubset')
def __del__(self):
self.transhandle = None
@@ -1181,6 +1181,8 @@ class localrepository(repo.repository):
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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20060904/71588a1e/attachment-0001.asc>
More information about the Mercurial
mailing list