##// END OF EJS Templates
Stop erroring out pull -r and clone -r if repository isn't local.
Eric Hopper -
r3448:6ca49c5f default
parent child Browse files
Show More
@@ -2105,10 +2105,12 b' def pull(ui, repo, source="default", **o'
2105 other = hg.repository(ui, source)
2105 other = hg.repository(ui, source)
2106 ui.status(_('pulling from %s\n') % (source))
2106 ui.status(_('pulling from %s\n') % (source))
2107 revs = None
2107 revs = None
2108 if opts['rev'] and not other.local():
2108 if opts['rev']:
2109 raise util.Abort(_("pull -r doesn't work for remote repositories yet"))
2109 if 'lookup' in other.capabilities:
2110 elif opts['rev']:
2110 revs = [other.lookup(rev) for rev in opts['rev']]
2111 revs = [other.lookup(rev) for rev in opts['rev']]
2111 else:
2112 error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
2113 raise util.Abort(error)
2112 modheads = repo.pull(other, heads=revs, force=opts['force'])
2114 modheads = repo.pull(other, heads=revs, force=opts['force'])
2113 return postincoming(ui, repo, modheads, opts['update'])
2115 return postincoming(ui, repo, modheads, opts['update'])
2114
2116
@@ -176,9 +176,10 b' def clone(ui, source, dest=None, pull=Fa'
176 else:
176 else:
177 revs = None
177 revs = None
178 if rev:
178 if rev:
179 if not src_repo.local():
179 if 'lookup' not in src_repo.capabilities:
180 raise util.Abort(_("clone by revision not supported yet "
180 raise util.Abort(_("src repository does not support revision "
181 "for remote repositories"))
181 "lookup and so doesn't support clone by "
182 "revision"))
182 revs = [src_repo.lookup(r) for r in rev]
183 revs = [src_repo.lookup(r) for r in rev]
183
184
184 if dest_repo.local():
185 if dest_repo.local():
@@ -15,7 +15,7 b' demandload(globals(), "re lock transacti'
15 demandload(globals(), "os revlog time util")
15 demandload(globals(), "os revlog time util")
16
16
17 class localrepository(repo.repository):
17 class localrepository(repo.repository):
18 capabilities = ()
18 capabilities = ('lookup', 'changegroupsubset')
19
19
20 def __del__(self):
20 def __del__(self):
21 self.transhandle = None
21 self.transhandle = None
@@ -1241,6 +1241,8 b' class localrepository(repo.repository):'
1241 if heads is None:
1241 if heads is None:
1242 cg = remote.changegroup(fetch, 'pull')
1242 cg = remote.changegroup(fetch, 'pull')
1243 else:
1243 else:
1244 if 'changegroupsubset' not in remote.capabilities:
1245 raise util.Abort(_("Partial pull cannot be done because other repository doesn't support changegroupsubset."))
1244 cg = remote.changegroupsubset(fetch, heads, 'pull')
1246 cg = remote.changegroupsubset(fetch, heads, 'pull')
1245 return self.addchangegroup(cg, 'pull', remote.url())
1247 return self.addchangegroup(cg, 'pull', remote.url())
1246 finally:
1248 finally:
General Comments 0
You need to be logged in to leave comments. Login now