Merge lp:~jelmer/brz/git-fixes into lp:brz

Proposed by Jelmer Vernooij
Status: Superseded
Proposed branch: lp:~jelmer/brz/git-fixes
Merge into: lp:brz
Diff against target: 71 lines (+26/-4)
3 files modified
breezy/git/cache.py (+1/-3)
breezy/git/git-remote-bzr (+1/-1)
breezy/git/tests/test_git_remote_helper.py (+24/-0)
To merge this branch: bzr merge lp:~jelmer/brz/git-fixes
Reviewer Review Type Date Requested Status
Breezy developers Pending
Review via email: mp+363583@code.launchpad.net

Description of the change

Some more git fixes:

* Fix git-remote-helper
* Fix finding of cache directory for remote URLs

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/cache.py'
2--- breezy/git/cache.py 2018-11-12 01:41:38 +0000
3+++ breezy/git/cache.py 2019-02-24 04:07:19 +0000
4@@ -613,11 +613,9 @@
5
6 def open(self, transport):
7 try:
8- basepath = transport.local_abspath(".").encode(osutils._fs_enc)
9+ basepath = transport.local_abspath(".")
10 except bzr_errors.NotLocalUrl:
11 basepath = get_cache_dir()
12- if not isinstance(basepath, str):
13- raise TypeError(basepath)
14 try:
15 return TdbBzrGitCache(os.path.join(basepath, "idmap.tdb"))
16 except ImportError:
17
18=== modified file 'breezy/git/git-remote-bzr'
19--- breezy/git/git-remote-bzr 2018-03-26 22:28:24 +0000
20+++ breezy/git/git-remote-bzr 2019-02-24 04:07:19 +0000
21@@ -35,7 +35,7 @@
22 from breezy.plugin import load_plugins
23 load_plugins()
24
25-from breezy.plugins.git.git_remote_helper import (
26+from breezy.git.git_remote_helper import (
27 RemoteHelper,
28 open_local_dir,
29 open_remote_dir,
30
31=== modified file 'breezy/git/tests/test_git_remote_helper.py'
32--- breezy/git/tests/test_git_remote_helper.py 2018-11-21 03:39:28 +0000
33+++ breezy/git/tests/test_git_remote_helper.py 2019-02-24 04:07:19 +0000
34@@ -23,6 +23,7 @@
35
36 from io import BytesIO
37 import os
38+import subprocess
39
40 from dulwich.repo import Repo
41
42@@ -90,6 +91,29 @@
43 }, r.get_refs())
44
45
46+class ExecuteRemoteHelperTests(TestCaseWithTransport):
47+
48+ def test_run(self):
49+ local_dir = self.make_branch_and_tree('local', format='git').controldir
50+ local_path = local_dir.control_transport.local_abspath('.')
51+ remote_tree = self.make_branch_and_tree('remote')
52+ remote_dir = remote_tree.controldir
53+ shortname = 'bzr'
54+ remote_helper_path = os.path.abspath(
55+ os.path.join(os.path.dirname(__file__), '..', 'git-remote-bzr'))
56+ env = dict(os.environ)
57+ env['GIT_DIR'] = local_path
58+ p = subprocess.Popen(
59+ ['git-remote-bzr', local_path, remote_dir.user_url],
60+ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
61+ stderr=subprocess.PIPE, env=env)
62+ (out, err) = p.communicate(b'capabilities\n')
63+ lines = out.splitlines()
64+ self.assertIn(b'import', lines)
65+ self.assertIn(b'export', lines)
66+ self.assertEqual(b'', err)
67+
68+
69 class RemoteHelperTests(TestCaseWithTransport):
70
71 def setUp(self):

Subscribers

People subscribed via source and target branches