comparison mercurial/hg.py @ 14553:d976542986d2

hg: add opts argument to clone for internal remoteui
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Wed, 08 Jun 2011 18:24:33 +0200
parents 3417954c42e9
children 68db17047637
comparison
equal deleted inserted replaced
14552:3417954c42e9 14553:d976542986d2
167 break 167 break
168 except error.RepoLookupError: 168 except error.RepoLookupError:
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
176 Create a copy of an existing repository in a new directory. The 176 Create a copy of an existing repository in a new directory. The
177 source and destination are URLs, as passed to the repository 177 source and destination are URLs, as passed to the repository
207 """ 207 """
208 208
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 [])
216 origsource = source = srcrepo.url() 216 origsource = source = srcrepo.url()
217 rev, checkout = addbranchrevs(srcrepo, srcrepo, branch, rev) 217 rev, checkout = addbranchrevs(srcrepo, srcrepo, branch, rev)
301 else: 301 else:
302 ui.debug("copied %d files\n" % num) 302 ui.debug("copied %d files\n" % num)
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()
315 raise util.Abort(_("destination '%s' already exists") 315 raise util.Abort(_("destination '%s' already exists")
316 % dest) 316 % dest)