mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
localrepo: remove clone method by hoisting into hg.py
hg.py was the only remaining caller of localrepo.clone(), so it's time to move some more behavior out of localrepo.
This commit is contained in:
parent
106adbe75b
commit
4e03270f68
@ -546,13 +546,22 @@ def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
|
|||||||
"support clone by revision"))
|
"support clone by revision"))
|
||||||
revs = [srcpeer.lookup(r) for r in rev]
|
revs = [srcpeer.lookup(r) for r in rev]
|
||||||
checkout = revs[0]
|
checkout = revs[0]
|
||||||
if destpeer.local():
|
local = destpeer.local()
|
||||||
|
if local:
|
||||||
if not stream:
|
if not stream:
|
||||||
if pull:
|
if pull:
|
||||||
stream = False
|
stream = False
|
||||||
else:
|
else:
|
||||||
stream = None
|
stream = None
|
||||||
destpeer.local().clone(srcpeer, heads=revs, stream=stream)
|
# internal config: ui.quietbookmarkmove
|
||||||
|
quiet = local.ui.backupconfig('ui', 'quietbookmarkmove')
|
||||||
|
try:
|
||||||
|
local.ui.setconfig(
|
||||||
|
'ui', 'quietbookmarkmove', True, 'clone')
|
||||||
|
exchange.pull(local, srcpeer, revs,
|
||||||
|
streamclonerequested=stream)
|
||||||
|
finally:
|
||||||
|
local.ui.restoreconfig(quiet)
|
||||||
elif srcrepo:
|
elif srcrepo:
|
||||||
exchange.push(srcrepo, destpeer, revs=revs,
|
exchange.push(srcrepo, destpeer, revs=revs,
|
||||||
bookmarks=srcrepo._bookmarks.keys())
|
bookmarks=srcrepo._bookmarks.keys())
|
||||||
|
@ -1856,22 +1856,6 @@ class localrepository(object):
|
|||||||
"""
|
"""
|
||||||
return util.hooks()
|
return util.hooks()
|
||||||
|
|
||||||
def clone(self, remote, heads=[], stream=None):
|
|
||||||
'''clone remote repository.
|
|
||||||
|
|
||||||
keyword arguments:
|
|
||||||
heads: list of revs to clone (forces use of pull)
|
|
||||||
stream: use streaming clone if possible'''
|
|
||||||
# internal config: ui.quietbookmarkmove
|
|
||||||
quiet = self.ui.backupconfig('ui', 'quietbookmarkmove')
|
|
||||||
try:
|
|
||||||
self.ui.setconfig('ui', 'quietbookmarkmove', True, 'clone')
|
|
||||||
pullop = exchange.pull(self, remote, heads,
|
|
||||||
streamclonerequested=stream)
|
|
||||||
return pullop.cgresult
|
|
||||||
finally:
|
|
||||||
self.ui.restoreconfig(quiet)
|
|
||||||
|
|
||||||
def pushkey(self, namespace, key, old, new):
|
def pushkey(self, namespace, key, old, new):
|
||||||
try:
|
try:
|
||||||
tr = self.currenttransaction()
|
tr = self.currenttransaction()
|
||||||
|
Loading…
Reference in New Issue
Block a user