changeset 39603:a8d2faeca49e

bundlerepo: factor out code for instantiating a bundle repository This code will soon become a bit more complicated. So extract to its own function. And change both instantiators of bundlerepository to use it. Differential Revision: https://phab.mercurial-scm.org/D4554
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 11 Sep 2018 19:16:32 -0700
parents 2d2bbf3f3e09
children 335ae4d0a552
files mercurial/bundlerepo.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Tue Sep 11 18:45:05 2018 -0700
+++ b/mercurial/bundlerepo.py	Tue Sep 11 19:16:32 2018 -0700
@@ -479,7 +479,12 @@
             repopath, bundlename = s
     else:
         repopath, bundlename = parentpath, path
-    return bundlerepository(ui, repopath, bundlename)
+
+    return makebundlerepository(ui, repopath, bundlename)
+
+def makebundlerepository(ui, repopath, bundlepath):
+    """Make a bundle repository object based on repo and bundle paths."""
+    return bundlerepository(ui, repopath, bundlepath)
 
 class bundletransactionmanager(object):
     def transaction(self):
@@ -588,8 +593,10 @@
             bundle = None
         if not localrepo:
             # use the created uncompressed bundlerepo
-            localrepo = bundlerepo = bundlerepository(repo.baseui, repo.root,
-                                                      fname)
+            localrepo = bundlerepo = makebundlerepository(repo. baseui,
+                                                          repo.root,
+                                                          fname)
+
             # this repo contains local and peer now, so filter out local again
             common = repo.heads()
     if localrepo: