Merge lp:~jelmer/brz/submodule-missing into lp:brz/3.2

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/submodule-missing
Merge into: lp:brz/3.2
Diff against target: 73 lines (+37/-3)
3 files modified
breezy/git/dir.py (+8/-2)
breezy/git/repository.py (+2/-1)
breezy/git/tests/test_remote.py (+27/-0)
To merge this branch: bzr merge lp:~jelmer/brz/submodule-missing
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+414558@code.launchpad.net

Commit message

Cope with invalid submodules.

Description of the change

Cope with invalid submodules.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/git/dir.py'
--- breezy/git/dir.py 2022-01-08 01:23:14 +0000
+++ breezy/git/dir.py 2022-01-25 14:16:15 +0000
@@ -210,9 +210,15 @@
210 sublocation = wt.get_reference_info(path)210 sublocation = wt.get_reference_info(path)
211 if sublocation is None:211 if sublocation is None:
212 trace.warning("Unable to find submodule info for %s", path)212 trace.warning("Unable to find submodule info for %s", path)
213 return None213 continue
214 remote_url = urlutils.join(self.user_url, sublocation)214 remote_url = urlutils.join(self.user_url, sublocation)
215 subbranch = _mod_branch.Branch.open(remote_url, possible_transports=possible_transports)215 try:
216 subbranch = _mod_branch.Branch.open(remote_url, possible_transports=possible_transports)
217 except brz_errors.NotBranchError as e:
218 trace.warning(
219 'Unable to clone submodule %s from %s: %s',
220 path, remote_url, e)
221 continue
216 subbranch.controldir.sprout(222 subbranch.controldir.sprout(
217 target, basis.get_reference_revision(path),223 target, basis.get_reference_revision(path),
218 force_new_repo=force_new_repo, recurse=recurse,224 force_new_repo=force_new_repo, recurse=recurse,
219225
=== modified file 'breezy/git/repository.py'
--- breezy/git/repository.py 2022-01-16 17:24:02 +0000
+++ breezy/git/repository.py 2022-01-25 14:16:15 +0000
@@ -186,7 +186,8 @@
186 transaction = self._transaction186 transaction = self._transaction
187 self._transaction = None187 self._transaction = None
188 transaction.finish()188 transaction.finish()
189 self._git.close()189 if hasattr(self, '_git'):
190 self._git.close()
190191
191 def is_write_locked(self):192 def is_write_locked(self):
192 return (self._lock_mode == 'w')193 return (self._lock_mode == 'w')
193194
=== modified file 'breezy/git/tests/test_remote.py'
--- breezy/git/tests/test_remote.py 2022-01-08 01:23:14 +0000
+++ breezy/git/tests/test_remote.py 2022-01-25 14:16:15 +0000
@@ -293,6 +293,33 @@
293 self.remote_real.head()),293 self.remote_real.head()),
294 local.open_branch().last_revision())294 local.open_branch().last_revision())
295295
296 def test_sprout_submodule_invalid(self):
297 self.sub_real = GitRepo.init('sub', mkdir=True)
298 self.sub_real.do_commit(
299 message=b'message in sub',
300 committer=b'committer <committer@example.com>',
301 author=b'author <author@example.com>')
302
303 self.sub_real.clone('remote/nested')
304 self.remote_real.stage('nested')
305 self.permit_url(urljoin(self.remote_url, '../sub'))
306 self.assertIn(b'nested', self.remote_real.open_index())
307 self.remote_real.do_commit(
308 message=b'message',
309 committer=b'committer <committer@example.com>',
310 author=b'author <author@example.com>')
311
312 remote = ControlDir.open(self.remote_url)
313 self.make_controldir('local', format=self._to_format)
314 local = remote.sprout('local')
315 self.assertEqual(
316 default_mapping.revision_id_foreign_to_bzr(
317 self.remote_real.head()),
318 local.open_branch().last_revision())
319 self.assertRaises(
320 NotBranchError,
321 local.open_workingtree().get_nested_tree, 'nested')
322
296 def test_sprout_submodule_relative(self):323 def test_sprout_submodule_relative(self):
297 self.sub_real = GitRepo.init('sub', mkdir=True)324 self.sub_real = GitRepo.init('sub', mkdir=True)
298 self.sub_real.do_commit(325 self.sub_real.do_commit(

Subscribers

People subscribed via source and target branches