changeset 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
files hgext/mq.py mercurial/commands.py mercurial/hg.py mercurial/subrepo.py tests/test-clone.t tests/test-symlink-os-yes-fs-no.py
diffstat 6 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Mon Jun 06 21:18:35 2011 +0200
+++ b/hgext/mq.py	Wed Jun 08 18:24:33 2011 +0200
@@ -2084,13 +2084,13 @@
         except error.RepoError:
             pass
     ui.note(_('cloning main repository\n'))
-    sr, dr = hg.clone(ui, sr.url(), dest,
+    sr, dr = hg.clone(ui, opts, sr.url(), dest,
                       pull=opts.get('pull'),
                       rev=destrev,
                       update=False,
                       stream=opts.get('uncompressed'))
     ui.note(_('cloning patch repository\n'))
-    hg.clone(ui, opts.get('patches') or patchdir(sr), patchdir(dr),
+    hg.clone(ui, opts, opts.get('patches') or patchdir(sr), patchdir(dr),
              pull=opts.get('pull'), update=not opts.get('noupdate'),
              stream=opts.get('uncompressed'))
     if dr.local():
--- a/mercurial/commands.py	Mon Jun 06 21:18:35 2011 +0200
+++ b/mercurial/commands.py	Wed Jun 08 18:24:33 2011 +0200
@@ -1026,7 +1026,7 @@
     if opts.get('noupdate') and opts.get('updaterev'):
         raise util.Abort(_("cannot specify both --noupdate and --updaterev"))
 
-    r = hg.clone(hg.remoteui(ui, opts), source, dest,
+    r = hg.clone(ui, opts, source, dest,
                  pull=opts.get('pull'),
                  stream=opts.get('uncompressed'),
                  rev=opts.get('rev'),
--- a/mercurial/hg.py	Mon Jun 06 21:18:35 2011 +0200
+++ b/mercurial/hg.py	Wed Jun 08 18:24:33 2011 +0200
@@ -169,7 +169,7 @@
                 continue
         _update(r, uprev)
 
-def clone(ui, source, dest=None, pull=False, rev=None, update=True,
+def clone(ui, opts, source, dest=None, pull=False, rev=None, update=True,
           stream=False, branch=None):
     """Make a copy of an existing repository.
 
@@ -209,7 +209,7 @@
     if isinstance(source, str):
         origsource = ui.expandpath(source)
         source, branch = parseurl(origsource, branch)
-        srcrepo = repository(ui, source)
+        srcrepo = repository(remoteui(ui, opts), source)
     else:
         srcrepo = source
         branch = (None, branch or [])
@@ -303,12 +303,12 @@
 
             # we need to re-init the repo after manually copying the data
             # into it
-            destrepo = repository(ui, dest)
+            destrepo = repository(remoteui(ui, opts), dest)
             srcrepo.hook('outgoing', source='clone',
                           node=node.hex(node.nullid))
         else:
             try:
-                destrepo = repository(ui, dest, create=True)
+                destrepo = repository(remoteui(ui, opts), dest, create=True)
             except OSError, inst:
                 if inst.errno == errno.EEXIST:
                     dircleanup.close()
--- a/mercurial/subrepo.py	Mon Jun 06 21:18:35 2011 +0200
+++ b/mercurial/subrepo.py	Wed Jun 08 18:24:33 2011 +0200
@@ -443,8 +443,8 @@
                                      % (subrelpath(self), srcurl))
                 parentrepo = self._repo._subparent
                 shutil.rmtree(self._repo.root)
-                other, self._repo = hg.clone(self._repo._subparent.ui, other,
-                                             self._repo.root, update=False)
+                other, self._repo = hg.clone(self._repo._subparent.ui, {}, other,
+                                         self._repo.root, update=False)
                 self._initrepo(parentrepo, source, create=True)
             else:
                 self._repo.ui.status(_('pulling subrepo %s from %s\n')
--- a/tests/test-clone.t	Mon Jun 06 21:18:35 2011 +0200
+++ b/tests/test-clone.t	Wed Jun 08 18:24:33 2011 +0200
@@ -433,7 +433,7 @@
   > from mercurial import ui, hg
   > myui = ui.ui()
   > repo = hg.repository(myui, 'a')
-  > hg.clone(myui, repo, dest="ua")
+  > hg.clone(myui, {}, repo, dest="ua")
   > EOF
 
   $ python simpleclone.py
@@ -446,7 +446,7 @@
   > from mercurial import ui, hg
   > myui = ui.ui()
   > repo = hg.repository(myui, 'a')
-  > hg.clone(myui, repo, dest="ua", branch=["stable",])
+  > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
   > EOF
 
   $ python branchclone.py
--- a/tests/test-symlink-os-yes-fs-no.py	Mon Jun 06 21:18:35 2011 +0200
+++ b/tests/test-symlink-os-yes-fs-no.py	Wed Jun 08 18:24:33 2011 +0200
@@ -10,7 +10,7 @@
 
 # clone with symlink support
 u = ui.ui()
-hg.clone(u, BUNDLEPATH, 'test0')
+hg.clone(u, {}, BUNDLEPATH, 'test0')
 
 repo = hg.repository(u, 'test0')
 
@@ -39,4 +39,4 @@
 
 # try cloning a repo which contains symlinks
 u = ui.ui()
-hg.clone(u, BUNDLEPATH, 'test1')
+hg.clone(u, {}, BUNDLEPATH, 'test1')