Merge lp:brz/3.2 into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 7573
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:brz/3.2
Merge into: lp:brz
Diff against target: 153 lines (+53/-24)
5 files modified
breezy/git/dir.py (+6/-7)
breezy/git/tests/test_remote.py (+36/-0)
breezy/tests/test_source.py (+6/-17)
doc/en/release-notes/brz-3.2.txt (+4/-0)
setup.py (+1/-0)
To merge this branch: bzr merge lp:brz/3.2
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+413826@code.launchpad.net

Commit message

Merge lp:brz/3.2.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
lp:brz/3.2 updated
7573. By Jelmer Vernooij

Fix checking out git repositories with submodules with relative paths.

Merged from https://code.launchpad.net/~jelmer/brz/submodule-relative/+merge/413825

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/dir.py'
2--- breezy/git/dir.py 2021-11-13 13:01:39 +0000
3+++ breezy/git/dir.py 2022-01-08 02:04:36 +0000
4@@ -208,14 +208,13 @@
5 subtrees = []
6 for path in subtrees:
7 target = urlutils.join(url, urlutils.escape(path))
8- sublocation = wt.reference_parent(
9- path, possible_transports=possible_transports)
10+ sublocation = wt.get_reference_info(path)
11 if sublocation is None:
12- trace.warning(
13- 'Ignoring nested tree %s, parent location unknown.',
14- path)
15- continue
16- sublocation.controldir.sprout(
17+ trace.warning("Unable to find submodule info for %s", path)
18+ return None
19+ remote_url = urlutils.join(self.user_url, sublocation)
20+ subbranch = _mod_branch.Branch.open(remote_url, possible_transports=possible_transports)
21+ subbranch.controldir.sprout(
22 target, basis.get_reference_revision(path),
23 force_new_repo=force_new_repo, recurse=recurse,
24 stacked=stacked)
25
26=== modified file 'breezy/git/tests/test_remote.py'
27--- breezy/git/tests/test_remote.py 2021-04-03 12:58:34 +0000
28+++ breezy/git/tests/test_remote.py 2022-01-08 02:04:36 +0000
29@@ -34,6 +34,7 @@
30 TestCaseWithTransport,
31 )
32 from ...tests.features import ExecutableFeature
33+from ...urlutils import join as urljoin
34
35 from ..mapping import default_mapping
36 from ..remote import (
37@@ -292,6 +293,41 @@
38 self.remote_real.head()),
39 local.open_branch().last_revision())
40
41+ def test_sprout_submodule_relative(self):
42+ self.sub_real = GitRepo.init('sub', mkdir=True)
43+ self.sub_real.do_commit(
44+ message=b'message in sub',
45+ committer=b'committer <committer@example.com>',
46+ author=b'author <author@example.com>')
47+
48+ with open('remote/.gitmodules', 'w') as f:
49+ f.write("""
50+[submodule "lala"]
51+\tpath = nested
52+\turl = ../sub/.git
53+""")
54+ self.remote_real.stage('.gitmodules')
55+ self.sub_real.clone('remote/nested')
56+ self.remote_real.stage('nested')
57+ self.permit_url(urljoin(self.remote_url, '../sub'))
58+ self.assertIn(b'nested', self.remote_real.open_index())
59+ self.remote_real.do_commit(
60+ message=b'message',
61+ committer=b'committer <committer@example.com>',
62+ author=b'author <author@example.com>')
63+
64+ remote = ControlDir.open(self.remote_url)
65+ self.make_controldir('local', format=self._to_format)
66+ local = remote.sprout('local')
67+ self.assertEqual(
68+ default_mapping.revision_id_foreign_to_bzr(
69+ self.remote_real.head()),
70+ local.open_branch().last_revision())
71+ self.assertEqual(
72+ default_mapping.revision_id_foreign_to_bzr(
73+ self.sub_real.head()),
74+ local.open_workingtree().get_nested_tree('nested').last_revision())
75+
76 def test_sprout_with_tags(self):
77 c1 = self.remote_real.do_commit(
78 message=b'message',
79
80=== modified file 'breezy/tests/test_source.py'
81--- breezy/tests/test_source.py 2021-08-21 13:02:55 +0000
82+++ breezy/tests/test_source.py 2022-01-08 02:04:36 +0000
83@@ -20,7 +20,7 @@
84 """
85
86 import os
87-import parser
88+import ast
89 import re
90 import symbol
91 import sys
92@@ -345,18 +345,6 @@
93 """bzr shouldn't use the 'assert' statement."""
94 # assert causes too much variation between -O and not, and tends to
95 # give bad errors to the user
96- def search(x):
97- # scan down through x for assert statements, report any problems
98- # this is a bit cheesy; it may get some false positives?
99- if x[0] == symbol.assert_stmt:
100- return True
101- elif x[0] == token.NAME:
102- # can't search further down
103- return False
104- for sub in x[1:]:
105- if sub and search(sub):
106- return True
107- return False
108 badfiles = []
109 assert_re = re.compile(r'\bassert\b')
110 for fname, text in self.get_source_file_contents():
111@@ -364,10 +352,11 @@
112 continue
113 if not assert_re.search(text):
114 continue
115- st = parser.suite(text)
116- code = parser.st2tuple(st)
117- if search(code):
118- badfiles.append(fname)
119+ tree = ast.parse(text)
120+ for entry in ast.walk(tree):
121+ if isinstance(entry, ast.Assert):
122+ badfiles.append(fname)
123+ break
124 if badfiles:
125 self.fail(
126 "these files contain an assert statement and should not:\n%s"
127
128=== modified file 'doc/en/release-notes/brz-3.2.txt'
129--- doc/en/release-notes/brz-3.2.txt 2021-08-18 23:37:47 +0000
130+++ doc/en/release-notes/brz-3.2.txt 2022-01-08 02:04:36 +0000
131@@ -17,6 +17,10 @@
132 * Fix compatibility with newer versions of Dulwich.
133 (Jelmer Vernooij)
134
135+ * Avoid using the ``parser`` module, which
136+ has been removed in Python 3.10.
137+ (Jelmer Vernooij, #1956500)
138+
139 Testing
140 *******
141
142
143=== modified file 'setup.py'
144--- setup.py 2021-12-27 15:10:53 +0000
145+++ setup.py 2022-01-08 02:04:36 +0000
146@@ -86,6 +86,7 @@
147 'testtools',
148 'testtools<=2.4.0;python_version<"3.0"',
149 'python-subunit',
150+ 'dulwich>=0.20.29',
151 ],
152 'python_requires': '>=3.5',
153 }

Subscribers

People subscribed via source and target branches