[PATCH 5 of 8] more subrepo isolation, pass repo instead of repo.ui to hg.peer

Simon Heimberg simohe at besonet.ch
Mon Oct 22 04:55:59 CDT 2012


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1343510916 -7200
# Node ID 3afe06c09df844d6c2305f2c1b54195c674346ac
# Parent  038ba59ad31c1a3bf9816a66a907f475eca81365
more subrepo isolation, pass repo instead of repo.ui to hg.peer

ui contains the configuration of the repo. It is the same object as repo.ui.
When a repo is passed to hg.peer, the global configuration is read from
repo.baseui.

diff -r 038ba59ad31c -r 3afe06c09df8 hgext/transplant.py
--- a/hgext/transplant.py	Sam Sep 29 20:11:24 2012 +0900
+++ b/hgext/transplant.py	Sam Jul 28 23:28:36 2012 +0200
@@ -605,7 +605,7 @@
 
     sourcerepo = opts.get('source')
     if sourcerepo:
-        peer = hg.peer(ui, opts, ui.expandpath(sourcerepo))
+        peer = hg.peer(repo, opts, ui.expandpath(sourcerepo))
         branches = map(peer.lookup, opts.get('branch', ()))
         source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, peer,
                                     onlyheads=branches, force=True)
diff -r 038ba59ad31c -r 3afe06c09df8 mercurial/hg.py
--- a/mercurial/hg.py	Sam Sep 29 20:11:24 2012 +0900
+++ b/mercurial/hg.py	Sam Jul 28 23:28:36 2012 +0200
@@ -348,7 +348,7 @@
 
             # we need to re-init the repo after manually copying the data
             # into it
-            destpeer = peer(ui, peeropts, dest)
+            destpeer = peer(srcrepo, peeropts, dest)
             srcrepo.hook('outgoing', source='clone',
                           node=node.hex(node.nullid))
         else:
diff -r 038ba59ad31c -r 3afe06c09df8 mercurial/subrepo.py
--- a/mercurial/subrepo.py	Sam Sep 29 20:11:24 2012 +0900
+++ b/mercurial/subrepo.py	Sam Jul 28 23:28:36 2012 +0200
@@ -501,7 +501,7 @@
         if revision not in self._repo:
             self._repo._subsource = source
             srcurl = _abssource(self._repo)
-            other = hg.peer(self._repo.ui, {}, srcurl)
+            other = hg.peer(self._repo, {}, srcurl)
             if len(self._repo) == 0:
                 self._repo.ui.status(_('cloning subrepo %s from %s\n')
                                      % (subrelpath(self), srcurl))
@@ -566,7 +566,7 @@
         dsturl = _abssource(self._repo, True)
         self._repo.ui.status(_('pushing subrepo %s to %s\n') %
             (subrelpath(self), dsturl))
-        other = hg.peer(self._repo.ui, {'ssh': ssh}, dsturl)
+        other = hg.peer(self._repo, {'ssh': ssh}, dsturl)
         return self._repo.push(other, force, newbranch=newbranch)
 
     def outgoing(self, ui, dest, opts):


More information about the Mercurial-devel mailing list