Merge lp:~jelmer/brz/cross-branch-fetch into lp:brz

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/cross-branch-fetch
Merge into: lp:brz
Diff against target: 50 lines (+26/-2)
2 files modified
breezy/git/branch.py (+2/-2)
breezy/tests/per_interbranch/test_push.py (+24/-0)
To merge this branch: bzr merge lp:~jelmer/brz/cross-branch-fetch
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+356759@code.launchpad.net

Commit message

Fix fetching between non-default colocated git branches.

Description of the change

Fix fetching between non-default colocated git branches.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/branch.py'
2--- breezy/git/branch.py 2018-08-15 19:35:30 +0000
3+++ breezy/git/branch.py 2018-10-15 19:18:07 +0000
4@@ -1078,9 +1078,9 @@
5 fetch_tags = c.get('branch.fetch_tags')
6
7 if stop_revision is None:
8- refs = interrepo.fetch(branches=[b"HEAD"], include_tags=fetch_tags)
9+ refs = interrepo.fetch(branches=[self.source.ref], include_tags=fetch_tags)
10 try:
11- head = refs[b"HEAD"]
12+ head = refs[self.source.ref]
13 except KeyError:
14 stop_revision = revision.NULL_REVISION
15 else:
16
17=== modified file 'breezy/tests/per_interbranch/test_push.py'
18--- breezy/tests/per_interbranch/test_push.py 2018-07-23 22:25:11 +0000
19+++ breezy/tests/per_interbranch/test_push.py 2018-10-15 19:18:07 +0000
20@@ -179,6 +179,30 @@
21 raise tests.TestNotApplicable(
22 'push between branches of same format')
23
24+ def test_between_colocated(self):
25+ """Pushing from one colocated branch to another doesn't change the active branch."""
26+ source = self.make_from_branch_and_tree('source')
27+ target = self.make_to_branch('target')
28+
29+ self.build_tree(['source/a'])
30+ source.add(['a'])
31+ revid1 = source.commit('a')
32+
33+ self.build_tree(['source/b'])
34+ source.add(['b'])
35+ revid2 = source.commit('b')
36+
37+ source_colo = source.controldir.create_branch('colo')
38+ source_colo.generate_revision_history(revid1)
39+ try:
40+ source_colo.push(target)
41+ except errors.NoRoundtrippingSupport:
42+ raise tests.TestNotApplicable(
43+ 'push between branches of different format')
44+ self.assertEqual(source_colo.last_revision(), revid1)
45+ self.assertEqual(source.last_revision(), revid2)
46+ self.assertEqual(target.last_revision(), revid1)
47+
48 def test_push_within_repository(self):
49 """Push from one branch to another inside the same repository."""
50 try:

Subscribers

People subscribed via source and target branches