[PATCH 2 of 6] hg: add opts argument to clone for internal remoteui

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Wed Jun 8 11:45:29 CDT 2011


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1307550273 -7200
hg: add opts argument to clone for internal remoteui

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -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():
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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'),
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -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()
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -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')
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -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
diff --git a/tests/test-symlink-os-yes-fs-no.py b/tests/test-symlink-os-yes-fs-no.py
--- a/tests/test-symlink-os-yes-fs-no.py
+++ b/tests/test-symlink-os-yes-fs-no.py
@@ -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')


More information about the Mercurial-devel mailing list