##// END OF EJS Templates
hg: add opts argument to clone for internal remoteui
Peter Arrenbrecht -
r14553:d9765429 default
parent child Browse files
Show More
@@ -2084,13 +2084,13 b' def clone(ui, source, dest=None, **opts)'
2084 except error.RepoError:
2084 except error.RepoError:
2085 pass
2085 pass
2086 ui.note(_('cloning main repository\n'))
2086 ui.note(_('cloning main repository\n'))
2087 sr, dr = hg.clone(ui, sr.url(), dest,
2087 sr, dr = hg.clone(ui, opts, sr.url(), dest,
2088 pull=opts.get('pull'),
2088 pull=opts.get('pull'),
2089 rev=destrev,
2089 rev=destrev,
2090 update=False,
2090 update=False,
2091 stream=opts.get('uncompressed'))
2091 stream=opts.get('uncompressed'))
2092 ui.note(_('cloning patch repository\n'))
2092 ui.note(_('cloning patch repository\n'))
2093 hg.clone(ui, opts.get('patches') or patchdir(sr), patchdir(dr),
2093 hg.clone(ui, opts, opts.get('patches') or patchdir(sr), patchdir(dr),
2094 pull=opts.get('pull'), update=not opts.get('noupdate'),
2094 pull=opts.get('pull'), update=not opts.get('noupdate'),
2095 stream=opts.get('uncompressed'))
2095 stream=opts.get('uncompressed'))
2096 if dr.local():
2096 if dr.local():
@@ -1026,7 +1026,7 b' def clone(ui, source, dest=None, **opts)'
1026 if opts.get('noupdate') and opts.get('updaterev'):
1026 if opts.get('noupdate') and opts.get('updaterev'):
1027 raise util.Abort(_("cannot specify both --noupdate and --updaterev"))
1027 raise util.Abort(_("cannot specify both --noupdate and --updaterev"))
1028
1028
1029 r = hg.clone(hg.remoteui(ui, opts), source, dest,
1029 r = hg.clone(ui, opts, source, dest,
1030 pull=opts.get('pull'),
1030 pull=opts.get('pull'),
1031 stream=opts.get('uncompressed'),
1031 stream=opts.get('uncompressed'),
1032 rev=opts.get('rev'),
1032 rev=opts.get('rev'),
@@ -169,7 +169,7 b' def share(ui, source, dest=None, update='
169 continue
169 continue
170 _update(r, uprev)
170 _update(r, uprev)
171
171
172 def clone(ui, source, dest=None, pull=False, rev=None, update=True,
172 def clone(ui, opts, source, dest=None, pull=False, rev=None, update=True,
173 stream=False, branch=None):
173 stream=False, branch=None):
174 """Make a copy of an existing repository.
174 """Make a copy of an existing repository.
175
175
@@ -209,7 +209,7 b' def clone(ui, source, dest=None, pull=Fa'
209 if isinstance(source, str):
209 if isinstance(source, str):
210 origsource = ui.expandpath(source)
210 origsource = ui.expandpath(source)
211 source, branch = parseurl(origsource, branch)
211 source, branch = parseurl(origsource, branch)
212 srcrepo = repository(ui, source)
212 srcrepo = repository(remoteui(ui, opts), source)
213 else:
213 else:
214 srcrepo = source
214 srcrepo = source
215 branch = (None, branch or [])
215 branch = (None, branch or [])
@@ -303,12 +303,12 b' def clone(ui, source, dest=None, pull=Fa'
303
303
304 # we need to re-init the repo after manually copying the data
304 # we need to re-init the repo after manually copying the data
305 # into it
305 # into it
306 destrepo = repository(ui, dest)
306 destrepo = repository(remoteui(ui, opts), dest)
307 srcrepo.hook('outgoing', source='clone',
307 srcrepo.hook('outgoing', source='clone',
308 node=node.hex(node.nullid))
308 node=node.hex(node.nullid))
309 else:
309 else:
310 try:
310 try:
311 destrepo = repository(ui, dest, create=True)
311 destrepo = repository(remoteui(ui, opts), dest, create=True)
312 except OSError, inst:
312 except OSError, inst:
313 if inst.errno == errno.EEXIST:
313 if inst.errno == errno.EEXIST:
314 dircleanup.close()
314 dircleanup.close()
@@ -443,7 +443,7 b' class hgsubrepo(abstractsubrepo):'
443 % (subrelpath(self), srcurl))
443 % (subrelpath(self), srcurl))
444 parentrepo = self._repo._subparent
444 parentrepo = self._repo._subparent
445 shutil.rmtree(self._repo.root)
445 shutil.rmtree(self._repo.root)
446 other, self._repo = hg.clone(self._repo._subparent.ui, other,
446 other, self._repo = hg.clone(self._repo._subparent.ui, {}, other,
447 self._repo.root, update=False)
447 self._repo.root, update=False)
448 self._initrepo(parentrepo, source, create=True)
448 self._initrepo(parentrepo, source, create=True)
449 else:
449 else:
@@ -433,7 +433,7 b' iterable in addbranchrevs()'
433 > from mercurial import ui, hg
433 > from mercurial import ui, hg
434 > myui = ui.ui()
434 > myui = ui.ui()
435 > repo = hg.repository(myui, 'a')
435 > repo = hg.repository(myui, 'a')
436 > hg.clone(myui, repo, dest="ua")
436 > hg.clone(myui, {}, repo, dest="ua")
437 > EOF
437 > EOF
438
438
439 $ python simpleclone.py
439 $ python simpleclone.py
@@ -446,7 +446,7 b' iterable in addbranchrevs()'
446 > from mercurial import ui, hg
446 > from mercurial import ui, hg
447 > myui = ui.ui()
447 > myui = ui.ui()
448 > repo = hg.repository(myui, 'a')
448 > repo = hg.repository(myui, 'a')
449 > hg.clone(myui, repo, dest="ua", branch=["stable",])
449 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
450 > EOF
450 > EOF
451
451
452 $ python branchclone.py
452 $ python branchclone.py
General Comments 0
You need to be logged in to leave comments. Login now