[PATCH 2 of 7] peer: subrepo isolation, pass repo instead of repo.ui to hg.peer

Simon Heimberg simohe at besonet.ch
Wed Oct 24 17:41:14 CDT 2012


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1343510916 -7200
# Node ID 04ba63a08fba6b1729727ed16ac7c23f40250c61
# Parent  b290e0a80a3a630a8f4941b51b504d87468dfd53
peer: subrepo isolation, pass repo instead of repo.ui to hg.peer

Do not pass ui because it 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 b290e0a80a3a -r 04ba63a08fba 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 b290e0a80a3a -r 04ba63a08fba 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 b290e0a80a3a -r 04ba63a08fba 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