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

Proposed by Jelmer Vernooij
Status: Rejected
Rejected by: Jelmer Vernooij
Proposed branch: lp:~jelmer/brz/git-submodule
Merge into: lp:brz
Diff against target: 463 lines (+146/-43)
15 files modified
breezy/branch.py (+10/-12)
breezy/builtins.py (+6/-5)
breezy/bzr/branch.py (+8/-0)
breezy/bzr/bzrdir.py (+7/-1)
breezy/bzr/workingtree.py (+7/-0)
breezy/bzr/workingtree_4.py (+18/-14)
breezy/git/branch.py (+15/-0)
breezy/git/dir.py (+6/-1)
breezy/git/fetch.py (+3/-3)
breezy/git/workingtree.py (+33/-0)
breezy/merge.py (+1/-1)
breezy/tests/blackbox/test_branch.py (+15/-0)
breezy/tests/blackbox/test_reference.py (+2/-0)
breezy/tests/per_branch/test_branch.py (+5/-6)
breezy/workingtree.py (+10/-0)
To merge this branch: bzr merge lp:~jelmer/brz/git-submodule
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+377752@code.launchpad.net

Commit message

Fix cloning of git repositories with submodules.

Description of the change

Fix cloning of git repositories with 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 :

Unmerged revisions

7454. By Jelmer Vernooij

Use strip_segment_parameters.

7453. By Jelmer Vernooij

Ignore missing nested trees.

7452. By Jelmer Vernooij

Fix typo.

7451. By Jelmer Vernooij

Import from gitmodules.

7450. By Jelmer Vernooij

Use find_previous_path rather than id2path.

7449. By Jelmer Vernooij

Fix tree reference listing.

7448. By Jelmer Vernooij

Move reference info to Git.

7447. By Jelmer Vernooij

Fix cloning of git repositories with submodules.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/branch.py'
--- breezy/branch.py 2019-10-19 23:18:56 +0000
+++ breezy/branch.py 2020-01-17 02:30:07 +0000
@@ -51,7 +51,7 @@
51 text_type,51 text_type,
52 viewitems,52 viewitems,
53 )53 )
54from .trace import mutter, mutter_callsite, note, is_quiet54from .trace import mutter, mutter_callsite, note, is_quiet, warning
5555
5656
57class UnstackableBranchFormat(errors.BzrError):57class UnstackableBranchFormat(errors.BzrError):
@@ -676,14 +676,6 @@
676 raise errors.UpgradeRequired(self.user_url)676 raise errors.UpgradeRequired(self.user_url)
677 self.get_config_stack().set('append_revisions_only', enabled)677 self.get_config_stack().set('append_revisions_only', enabled)
678678
679 def set_reference_info(self, tree_path, branch_location, file_id=None):
680 """Set the branch location to use for a tree reference."""
681 raise errors.UnsupportedOperation(self.set_reference_info, self)
682
683 def get_reference_info(self, path):
684 """Get the tree_path and branch_location for a tree reference."""
685 raise errors.UnsupportedOperation(self.get_reference_info, self)
686
687 def fetch(self, from_branch, last_revision=None, limit=None):679 def fetch(self, from_branch, last_revision=None, limit=None):
688 """Copy revisions from from_branch into this branch.680 """Copy revisions from from_branch into this branch.
689681
@@ -1412,7 +1404,10 @@
1412 basis_tree = tree.basis_tree()1404 basis_tree = tree.basis_tree()
1413 with basis_tree.lock_read():1405 with basis_tree.lock_read():
1414 for path in basis_tree.iter_references():1406 for path in basis_tree.iter_references():
1415 reference_parent = self.reference_parent(path)1407 reference_parent = tree.reference_parent(path)
1408 if reference_parent is None:
1409 warning('Branch location for %s unknown.', path)
1410 continue
1416 reference_parent.create_checkout(1411 reference_parent.create_checkout(
1417 tree.abspath(path),1412 tree.abspath(path),
1418 basis_tree.get_reference_revision(path), lightweight)1413 basis_tree.get_reference_revision(path), lightweight)
@@ -1432,8 +1427,11 @@
1432 :return: A branch associated with the nested tree1427 :return: A branch associated with the nested tree
1433 """1428 """
1434 # FIXME should provide multiple branches, based on config1429 # FIXME should provide multiple branches, based on config
1435 return Branch.open(self.controldir.root_transport.clone(path).base,1430 try:
1436 possible_transports=possible_transports)1431 return Branch.open(self.controldir.root_transport.clone(path).base,
1432 possible_transports=possible_transports)
1433 except errors.NotBranchError:
1434 return None
14371435
1438 def supports_tags(self):1436 def supports_tags(self):
1439 return self._format.supports_tags()1437 return self._format.supports_tags()
14401438
=== modified file 'breezy/builtins.py'
--- breezy/builtins.py 2020-01-12 14:46:56 +0000
+++ breezy/builtins.py 2020-01-17 02:30:07 +0000
@@ -6738,21 +6738,22 @@
6738 if tree is None:6738 if tree is None:
6739 tree = branch.basis_tree()6739 tree = branch.basis_tree()
6740 if path is None:6740 if path is None:
6741 info = viewitems(branch._get_all_reference_info())6741 info = [
6742 (path, tree.get_reference_info(path))
6743 for path in tree.iter_references()]
6742 self._display_reference_info(tree, branch, info)6744 self._display_reference_info(tree, branch, info)
6743 else:6745 else:
6744 if not tree.is_versioned(path) and not force_unversioned:6746 if not tree.is_versioned(path) and not force_unversioned:
6745 raise errors.NotVersionedError(path)6747 raise errors.NotVersionedError(path)
6746 if location is None:6748 if location is None:
6747 info = [(path, branch.get_reference_info(path))]6749 info = [(path, tree.get_reference_info(path))]
6748 self._display_reference_info(tree, branch, info)6750 self._display_reference_info(tree, branch, info)
6749 else:6751 else:
6750 branch.set_reference_info(6752 tree.set_reference_info(path, location)
6751 path, location, file_id=tree.path2id(path))
67526753
6753 def _display_reference_info(self, tree, branch, info):6754 def _display_reference_info(self, tree, branch, info):
6754 ref_list = []6755 ref_list = []
6755 for path, (location, file_id) in info:6756 for path, location in info:
6756 ref_list.append((path, location))6757 ref_list.append((path, location))
6757 for path, location in sorted(ref_list):6758 for path, location in sorted(ref_list):
6758 self.outf.write('%s %s\n' % (path, location))6759 self.outf.write('%s %s\n' % (path, location))
67596760
=== modified file 'breezy/bzr/branch.py'
--- breezy/bzr/branch.py 2020-01-12 13:56:10 +0000
+++ breezy/bzr/branch.py 2020-01-17 02:30:07 +0000
@@ -450,6 +450,14 @@
450 reconciler = BranchReconciler(self, thorough=thorough)450 reconciler = BranchReconciler(self, thorough=thorough)
451 return reconciler.reconcile()451 return reconciler.reconcile()
452452
453 def set_reference_info(self, tree_path, branch_location, file_id=None):
454 """Set the branch location to use for a tree reference."""
455 raise errors.UnsupportedOperation(self.set_reference_info, self)
456
457 def get_reference_info(self, path):
458 """Get the tree_path and branch_location for a tree reference."""
459 raise errors.UnsupportedOperation(self.get_reference_info, self)
460
453461
454class BzrBranch8(BzrBranch):462class BzrBranch8(BzrBranch):
455 """A branch that stores tree-reference locations."""463 """A branch that stores tree-reference locations."""
456464
=== modified file 'breezy/bzr/bzrdir.py'
--- breezy/bzr/bzrdir.py 2019-10-20 00:11:04 +0000
+++ breezy/bzr/bzrdir.py 2020-01-17 02:30:07 +0000
@@ -65,6 +65,7 @@
65from ..trace import (65from ..trace import (
66 mutter,66 mutter,
67 note,67 note,
68 warning,
68 )69 )
6970
70from .. import (71from .. import (
@@ -467,8 +468,13 @@
467 subtrees = []468 subtrees = []
468 for path in subtrees:469 for path in subtrees:
469 target = urlutils.join(url, urlutils.escape(path))470 target = urlutils.join(url, urlutils.escape(path))
470 sublocation = source_branch.reference_parent(471 sublocation = wt.reference_parent(
471 path, possible_transports=possible_transports)472 path, possible_transports=possible_transports)
473 if sublocation is None:
474 warning(
475 'Ignoring nested tree %s, parent location unknown.',
476 path)
477 continue
472 sublocation.controldir.sprout(478 sublocation.controldir.sprout(
473 target, basis.get_reference_revision(path),479 target, basis.get_reference_revision(path),
474 force_new_repo=force_new_repo, recurse=recurse,480 force_new_repo=force_new_repo, recurse=recurse,
475481
=== modified file 'breezy/bzr/workingtree.py'
--- breezy/bzr/workingtree.py 2020-01-11 02:39:17 +0000
+++ breezy/bzr/workingtree.py 2020-01-17 02:30:07 +0000
@@ -1796,6 +1796,13 @@
1796 else:1796 else:
1797 yield get_canonical_path(self, path, normalize)1797 yield get_canonical_path(self, path, normalize)
17981798
1799 def get_reference_info(self, path):
1800 return self.branch.get_reference_info(path)[0]
1801
1802 def set_reference_info(self, tree_path, branch_location):
1803 self.branch.set_reference_info(
1804 tree_path, branch_location, file_id=self.path2id(tree_path))
1805
17991806
1800class WorkingTreeFormatMetaDir(bzrdir.BzrFormat, WorkingTreeFormat):1807class WorkingTreeFormatMetaDir(bzrdir.BzrFormat, WorkingTreeFormat):
1801 """Base class for working trees that live in bzr meta directories."""1808 """Base class for working trees that live in bzr meta directories."""
18021809
=== modified file 'breezy/bzr/workingtree_4.py'
--- breezy/bzr/workingtree_4.py 2020-01-11 22:33:18 +0000
+++ breezy/bzr/workingtree_4.py 2020-01-17 02:30:07 +0000
@@ -130,6 +130,9 @@
130 self.views = self._make_views()130 self.views = self._make_views()
131 # --- allow tests to select the dirstate iter_changes implementation131 # --- allow tests to select the dirstate iter_changes implementation
132 self._iter_changes = dirstate._process_entry132 self._iter_changes = dirstate._process_entry
133 self._repo_supports_tree_reference = getattr(
134 self._branch.repository._format, "supports_tree_reference",
135 False)
133136
134 def _add(self, files, ids, kinds):137 def _add(self, files, ids, kinds):
135 """See MutableTree._add."""138 """See MutableTree._add."""
@@ -550,20 +553,21 @@
550 # When the repo doesn't support references, we will have nothing to553 # When the repo doesn't support references, we will have nothing to
551 # return554 # return
552 return555 return
553 for key, tree_details in self.current_dirstate()._iter_entries():556 with self.lock_read():
554 if tree_details[0][0] in (b'a', b'r'): # absent, relocated557 for key, tree_details in self.current_dirstate()._iter_entries():
555 # not relevant to the working tree558 if tree_details[0][0] in (b'a', b'r'): # absent, relocated
556 continue559 # not relevant to the working tree
557 if not key[1]:560 continue
558 # the root is not a reference.561 if not key[1]:
559 continue562 # the root is not a reference.
560 relpath = pathjoin(key[0].decode('utf8'), key[1].decode('utf8'))563 continue
561 try:564 relpath = pathjoin(key[0].decode('utf8'), key[1].decode('utf8'))
562 if self.kind(relpath) == 'tree-reference':565 try:
563 yield relpath566 if self.kind(relpath) == 'tree-reference':
564 except errors.NoSuchFile:567 yield relpath
565 # path is missing on disk.568 except errors.NoSuchFile:
566 continue569 # path is missing on disk.
570 continue
567571
568 def _observed_sha1(self, path, sha_and_stat):572 def _observed_sha1(self, path, sha_and_stat):
569 """See MutableTree._observed_sha1."""573 """See MutableTree._observed_sha1."""
570574
=== modified file 'breezy/git/branch.py'
--- breezy/git/branch.py 2020-01-16 23:24:40 +0000
+++ breezy/git/branch.py 2020-01-17 02:30:07 +0000
@@ -22,6 +22,10 @@
22from io import BytesIO22from io import BytesIO
23from collections import defaultdict23from collections import defaultdict
2424
25from dulwich.config import (
26 ConfigFile as GitConfigFile,
27 parse_submodules,
28 )
25from dulwich.objects import (29from dulwich.objects import (
26 NotCommitError,30 NotCommitError,
27 ZERO_SHA,31 ZERO_SHA,
@@ -980,6 +984,15 @@
980 other_branch=self.source)984 other_branch=self.source)
981 return head, refs985 return head, refs
982986
987 def _import_tree_references(self, revid):
988 tree = self.target.repository.revision_tree(revid)
989 with tree.get_file('.gitmodules') as f:
990 for path, url, section in parse_submodules(
991 GitConfigFile.from_file(f)):
992 self.target.set_reference_info(
993 path.decode('utf-8'), url.decode('utf-8'),
994 tree.path2id(path.decode('utf-8')))
995
983 def _basic_pull(self, stop_revision, overwrite, run_hooks,996 def _basic_pull(self, stop_revision, overwrite, run_hooks,
984 _override_hook_target, _hook_master):997 _override_hook_target, _hook_master):
985 if overwrite is True:998 if overwrite is True:
@@ -1007,6 +1020,7 @@
1007 result.tag_conflicts = tags_ret1020 result.tag_conflicts = tags_ret
1008 (result.new_revno, result.new_revid) = \1021 (result.new_revno, result.new_revid) = \
1009 self.target.last_revision_info()1022 self.target.last_revision_info()
1023 self._import_tree_references(result.new_revid)
1010 if _hook_master:1024 if _hook_master:
1011 result.master_branch = _hook_master1025 result.master_branch = _hook_master
1012 result.local_branch = result.target_branch1026 result.local_branch = result.target_branch
@@ -1075,6 +1089,7 @@
1075 self.target.tags, "tags" in overwrite, ignore_master=True)1089 self.target.tags, "tags" in overwrite, ignore_master=True)
1076 (result.tag_updates, result.tag_conflicts) = tags_ret1090 (result.tag_updates, result.tag_conflicts) = tags_ret
1077 result.new_revno, result.new_revid = self.target.last_revision_info()1091 result.new_revno, result.new_revid = self.target.last_revision_info()
1092 self._import_tree_references(result.new_revid)
1078 return result1093 return result
10791094
10801095
10811096
=== modified file 'breezy/git/dir.py'
--- breezy/git/dir.py 2020-01-12 14:46:56 +0000
+++ breezy/git/dir.py 2020-01-17 02:30:07 +0000
@@ -207,8 +207,13 @@
207 subtrees = []207 subtrees = []
208 for path in subtrees:208 for path in subtrees:
209 target = urlutils.join(url, urlutils.escape(path))209 target = urlutils.join(url, urlutils.escape(path))
210 sublocation = source_branch.reference_parent(210 sublocation = wt.reference_parent(
211 path, possible_transports=possible_transports)211 path, possible_transports=possible_transports)
212 if sublocation is None:
213 trace.warning(
214 'Ignoring nested tree %s, parent location unknown.',
215 path)
216 continue
212 sublocation.controldir.sprout(217 sublocation.controldir.sprout(
213 target, basis.get_reference_revision(path),218 target, basis.get_reference_revision(path),
214 force_new_repo=force_new_repo, recurse=recurse,219 force_new_repo=force_new_repo, recurse=recurse,
215220
=== modified file 'breezy/git/fetch.py'
--- breezy/git/fetch.py 2019-10-28 01:38:39 +0000
+++ breezy/git/fetch.py 2020-01-17 02:30:07 +0000
@@ -55,6 +55,7 @@
55from ..bzr.testament import (55from ..bzr.testament import (
56 StrictTestament3,56 StrictTestament3,
57 )57 )
58from ..tree import find_previous_path
58from ..tsort import (59from ..tsort import (
59 topo_sort,60 topo_sort,
60 )61 )
@@ -125,9 +126,8 @@
125 # Check what revision we should store126 # Check what revision we should store
126 parent_keys = []127 parent_keys = []
127 for ptree in parent_bzr_trees:128 for ptree in parent_bzr_trees:
128 try:129 ppath = find_previous_path(base_bzr_tree, ptree, decoded_path, file_id)
129 ppath = ptree.id2path(file_id)130 if ppath is None:
130 except errors.NoSuchId:
131 continue131 continue
132 pkind = ptree.kind(ppath)132 pkind = ptree.kind(ppath)
133 if (pkind == ie.kind and133 if (pkind == ie.kind and
134134
=== modified file 'breezy/git/workingtree.py'
--- breezy/git/workingtree.py 2020-01-10 01:37:30 +0000
+++ breezy/git/workingtree.py 2020-01-17 02:30:07 +0000
@@ -25,6 +25,7 @@
25from dulwich.ignore import (25from dulwich.ignore import (
26 IgnoreFilterManager,26 IgnoreFilterManager,
27 )27 )
28from dulwich.config import ConfigFile as GitConfigFile
28from dulwich.file import GitFile, FileLocked29from dulwich.file import GitFile, FileLocked
29from dulwich.index import (30from dulwich.index import (
30 Index,31 Index,
@@ -49,6 +50,7 @@
49import sys50import sys
5051
51from .. import (52from .. import (
53 branch as _mod_branch,
52 conflicts as _mod_conflicts,54 conflicts as _mod_conflicts,
53 errors,55 errors,
54 controldir as _mod_controldir,56 controldir as _mod_controldir,
@@ -1325,6 +1327,37 @@
1325 new_parents = [revision_id]1327 new_parents = [revision_id]
1326 tree.set_parent_ids(new_parents)1328 tree.set_parent_ids(new_parents)
13271329
1330 def reference_parent(self, path, possible_transports=None):
1331 remote_url = self.get_reference_info(path)
1332 if remote_url is None:
1333 trace.warning("Unable to find submodule info for %s", path)
1334 return None
1335 return _mod_branch.Branch.open(remote_url, possible_transports=possible_transports)
1336
1337 def get_reference_info(self, path):
1338 submodule_info = self._submodule_info()
1339 info = submodule_info.get(path.encode('utf-8'))
1340 if info is None:
1341 return None
1342 return info[0].decode('utf-8')
1343
1344 def set_reference_info(self, tree_path, branch_location):
1345 path = self.abspath('.gitmodules')
1346 try:
1347 config = GitConfigFile.from_path(path)
1348 except EnvironmentError as e:
1349 if e.errno == errno.ENOENT:
1350 config = GitConfigFile()
1351 else:
1352 raise
1353 config.set(
1354 (b'submodule', tree_path.encode('utf-8')),
1355 b'path', tree_path.encode('utf-8'))
1356 config.set(
1357 (b'submodule', tree_path.encode('utf-8')),
1358 b'url', branch_location.encode('utf-8'))
1359 config.write_to_path(path)
1360
13281361
1329class GitWorkingTreeFormat(workingtree.WorkingTreeFormat):1362class GitWorkingTreeFormat(workingtree.WorkingTreeFormat):
13301363
13311364
=== modified file 'breezy/merge.py'
--- breezy/merge.py 2019-10-13 17:31:55 +0000
+++ breezy/merge.py 2020-01-17 02:30:07 +0000
@@ -641,7 +641,7 @@
641 continue641 continue
642 sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)642 sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
643 sub_merge.merge_type = self.merge_type643 sub_merge.merge_type = self.merge_type
644 other_branch = self.other_branch.reference_parent(relpath)644 other_branch = self.other_tree.reference_parent(relpath)
645 sub_merge.set_other_revision(other_revision, other_branch)645 sub_merge.set_other_revision(other_revision, other_branch)
646 base_tree_path = _mod_tree.find_previous_path(646 base_tree_path = _mod_tree.find_previous_path(
647 self.this_tree, self.base_tree, relpath)647 self.this_tree, self.base_tree, relpath)
648648
=== modified file 'breezy/tests/blackbox/test_branch.py'
--- breezy/tests/blackbox/test_branch.py 2019-10-19 23:18:56 +0000
+++ breezy/tests/blackbox/test_branch.py 2020-01-17 02:30:07 +0000
@@ -367,6 +367,7 @@
367 subtree.add(['a'])367 subtree.add(['a'])
368 subtree.commit('add subtree contents')368 subtree.commit('add subtree contents')
369 orig.add_reference(subtree)369 orig.add_reference(subtree)
370 orig.branch.set_reference_info('subtree', subtree.branch.user_url)
370 orig.commit('add subtree')371 orig.commit('add subtree')
371372
372 self.run_bzr('branch source target')373 self.run_bzr('branch source target')
@@ -376,6 +377,20 @@
376 self.assertTreesEqual(orig, target)377 self.assertTreesEqual(orig, target)
377 self.assertTreesEqual(subtree, target_subtree)378 self.assertTreesEqual(subtree, target_subtree)
378379
380 def test_branch_with_nested_trees_reference_unset(self):
381 orig = self.make_branch_and_tree('source', format='development-subtree')
382 subtree = self.make_branch_and_tree('source/subtree')
383 self.build_tree(['source/subtree/a'])
384 subtree.add(['a'])
385 subtree.commit('add subtree contents')
386 orig.add_reference(subtree)
387 orig.commit('add subtree')
388
389 self.run_bzr('branch source target')
390
391 target = WorkingTree.open('target')
392 self.assertRaises(errors.NotBranchError, WorkingTree.open, 'target/subtree')
393
379 def test_branch_with_nested_trees_no_recurse(self):394 def test_branch_with_nested_trees_no_recurse(self):
380 orig = self.make_branch_and_tree('source', format='development-subtree')395 orig = self.make_branch_and_tree('source', format='development-subtree')
381 subtree = self.make_branch_and_tree('source/subtree')396 subtree = self.make_branch_and_tree('source/subtree')
382397
=== modified file 'breezy/tests/blackbox/test_reference.py'
--- breezy/tests/blackbox/test_reference.py 2018-11-16 11:37:47 +0000
+++ breezy/tests/blackbox/test_reference.py 2020-01-17 02:30:07 +0000
@@ -76,6 +76,8 @@
76 tree.add('file', b'file-id')76 tree.add('file', b'file-id')
77 out, err = self.run_bzr('reference tree/file http://example.org')77 out, err = self.run_bzr('reference tree/file http://example.org')
78 location, file_id = tree.branch.get_reference_info('file')78 location, file_id = tree.branch.get_reference_info('file')
79 tree_location = tree.get_reference_info('file')
80 self.assertEqual('http://example.org', tree_location)
79 self.assertEqual('http://example.org', location)81 self.assertEqual('http://example.org', location)
80 self.assertEqual(b'file-id', file_id)82 self.assertEqual(b'file-id', file_id)
81 self.assertEqual('', out)83 self.assertEqual('', out)
8284
=== modified file 'breezy/tests/per_branch/test_branch.py'
--- breezy/tests/per_branch/test_branch.py 2020-01-12 15:16:27 +0000
+++ breezy/tests/per_branch/test_branch.py 2020-01-17 02:30:07 +0000
@@ -858,8 +858,8 @@
858 raise tests.TestNotApplicable('Tree cannot hold references.')858 raise tests.TestNotApplicable('Tree cannot hold references.')
859 reference_parent = tree.branch.reference_parent(859 reference_parent = tree.branch.reference_parent(
860 urlutils.relative_url(860 urlutils.relative_url(
861 urlutils.split_segment_parameters(tree.branch.user_url)[0],861 urlutils.strip_segment_parameters(tree.branch.user_url),
862 urlutils.split_segment_parameters(subtree.branch.user_url)[0]))862 urlutils.strip_segment_parameters(subtree.branch.user_url)))
863 self.assertEqual(subtree.branch.user_url, reference_parent.user_url)863 self.assertEqual(subtree.branch.user_url, reference_parent.user_url)
864864
865 def test_reference_parent_accepts_possible_transports(self):865 def test_reference_parent_accepts_possible_transports(self):
@@ -872,8 +872,8 @@
872 raise tests.TestNotApplicable('Tree cannot hold references.')872 raise tests.TestNotApplicable('Tree cannot hold references.')
873 reference_parent = tree.branch.reference_parent(873 reference_parent = tree.branch.reference_parent(
874 urlutils.relative_url(874 urlutils.relative_url(
875 urlutils.split_segment_parameters(tree.branch.user_url)[0],875 urlutils.strip_segment_parameters(tree.branch.user_url),
876 urlutils.split_segment_parameters(subtree.branch.user_url)[0]),876 urlutils.strip_segment_parameters(subtree.branch.user_url)),
877 possible_transports=[subtree.controldir.root_transport])877 possible_transports=[subtree.controldir.root_transport])
878878
879 def test_get_reference_info(self):879 def test_get_reference_info(self):
@@ -1014,8 +1014,7 @@
1014 'branch/new-branch').open_branch()1014 'branch/new-branch').open_branch()
1015 new_branch.set_reference_info('../foo', '../foo', b'file-id2')1015 new_branch.set_reference_info('../foo', '../foo', b'file-id2')
1016 new_branch.push(branch)1016 new_branch.push(branch)
1017 self.assertEqual('foo',1017 self.assertEqual('foo', branch.get_reference_info('../foo')[0])
1018 branch.get_reference_info('../foo')[0])
10191018
1020 def test_merge_updates_references(self):1019 def test_merge_updates_references(self):
1021 branch = self.make_branch_with_reference('branch', 'reference')1020 branch = self.make_branch_with_reference('branch', 'reference')
10221021
=== modified file 'breezy/workingtree.py'
--- breezy/workingtree.py 2020-01-11 17:50:28 +0000
+++ breezy/workingtree.py 2020-01-17 02:30:07 +0000
@@ -1325,6 +1325,16 @@
1325 with self.lock_read():1325 with self.lock_read():
1326 return next(self.get_canonical_paths([path]))1326 return next(self.get_canonical_paths([path]))
13271327
1328 def reference_parent(self, path, possible_transports=None):
1329 return self.branch.reference_parent(
1330 path, possible_transports=possible_transports)
1331
1332 def get_reference_info(self, path):
1333 raise errors.UnsupportedOperation(self.get_reference_info, self)
1334
1335 def set_reference_info(self, tree_path, branch_location):
1336 raise errors.UnsupportedOperation(self.set_reference_info, self)
1337
13281338
1329class WorkingTreeFormatRegistry(ControlComponentFormatRegistry):1339class WorkingTreeFormatRegistry(ControlComponentFormatRegistry):
1330 """Registry for working tree formats."""1340 """Registry for working tree formats."""

Subscribers

People subscribed via source and target branches