Origin: commit, https://github.com/jelmer/breezy,branch=git-fixes, revision: 7294
Author: Jelmer Vernooĳ <jelmer@jelmer.uk>
Last-Update: 2019-02-27
Applied-Upstream: no
X-Bzr-Revision-Id: jelmer@jelmer.uk-20190227031315-5vxa3gg3y2odo33j

=== modified file 'breezy/git/cache.py'
--- old/breezy/git/cache.py	2018-11-12 01:41:38 +0000
+++ new/breezy/git/cache.py	2019-02-24 03:46:16 +0000
@@ -613,11 +613,9 @@
 
     def open(self, transport):
         try:
-            basepath = transport.local_abspath(".").encode(osutils._fs_enc)
+            basepath = transport.local_abspath(".")
         except bzr_errors.NotLocalUrl:
             basepath = get_cache_dir()
-        if not isinstance(basepath, str):
-            raise TypeError(basepath)
         try:
             return TdbBzrGitCache(os.path.join(basepath, "idmap.tdb"))
         except ImportError:

=== modified file 'breezy/git/git-remote-bzr'
--- old/breezy/git/git-remote-bzr	2018-03-26 22:28:24 +0000
+++ new/breezy/git/git-remote-bzr	2019-02-24 03:45:58 +0000
@@ -35,7 +35,7 @@
 from breezy.plugin import load_plugins
 load_plugins()
 
-from breezy.plugins.git.git_remote_helper import (
+from breezy.git.git_remote_helper import (
     RemoteHelper,
     open_local_dir,
     open_remote_dir,

=== modified file 'breezy/git/tests/test_git_remote_helper.py'
--- old/breezy/git/tests/test_git_remote_helper.py	2018-11-21 03:39:28 +0000
+++ new/breezy/git/tests/test_git_remote_helper.py	2019-02-27 03:13:15 +0000
@@ -23,12 +23,14 @@
 
 from io import BytesIO
 import os
+import subprocess
 
 from dulwich.repo import Repo
 
 from ...tests import (
     TestCaseWithTransport,
     )
+from ...tests.features import PathFeature
 
 from ..object_store import get_object_store
 from ..git_remote_helper import (
@@ -46,6 +48,11 @@
         return object_store._lookup_revision_sha1(bzr_revid)
 
 
+git_remote_bzr_path = os.path.abspath(
+    os.path.join(os.path.dirname(__file__), '..', 'git-remote-bzr'))
+git_remote_bzr_feature = PathFeature(git_remote_bzr_path)
+
+
 class OpenLocalDirTests(TestCaseWithTransport):
 
     def test_from_env_dir(self):
@@ -90,6 +97,28 @@
             }, r.get_refs())
 
 
+class ExecuteRemoteHelperTests(TestCaseWithTransport):
+
+    def test_run(self):
+        self.requireFeature(git_remote_bzr_feature)
+        local_dir = self.make_branch_and_tree('local', format='git').controldir
+        local_path = local_dir.control_transport.local_abspath('.')
+        remote_tree = self.make_branch_and_tree('remote')
+        remote_dir = remote_tree.controldir
+        shortname = 'bzr'
+        env = dict(os.environ)
+        env['GIT_DIR'] = local_path
+        p = subprocess.Popen(
+            [git_remote_bzr_path, local_path, remote_dir.user_url],
+            stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE, env=env)
+        (out, err) = p.communicate(b'capabilities\n')
+        lines = out.splitlines()
+        self.assertIn(b'import', lines)
+        self.assertIn(b'push', lines)
+        self.assertEqual(b'', err)
+
+
 class RemoteHelperTests(TestCaseWithTransport):
 
     def setUp(self):

=== modified file 'breezy/tests/features.py'
--- old/breezy/tests/features.py	2019-01-19 01:44:20 +0000
+++ new/breezy/tests/features.py	2019-02-27 03:13:15 +0000
@@ -568,3 +568,17 @@
 
 
 BackslashFilenameFeature = _BackslashFilenameFeature()
+
+
+class PathFeature(Feature):
+    """Feature testing whether a particular path exists."""
+
+    def __init__(self, path):
+        super(PathFeature, self).__init__()
+        self.path = path
+
+    def _probe(self):
+        return os.path.exists(self.path)
+
+    def feature_name(self):
+        return "%s exists" % self.path

