Rev 82: Merge crufty fix for push. in http://bazaar.launchpad.net/~bzr-loom-devs/bzr-loom/trunk/
Robert Collins
robertc at robertcollins.net
Tue Apr 15 03:27:07 BST 2008
At http://bazaar.launchpad.net/~bzr-loom-devs/bzr-loom/trunk/
------------------------------------------------------------
revno: 82
revision-id: robertc at robertcollins.net-20080415022706-ya0nnza5o71i13c1
parent: aaron at aaronbentley.com-20080404045624-9sdd2b3u2ff388fn
parent: robertc at robertcollins.net-20080410003837-fp8ig8zt88y1g2e1
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Tue 2008-04-15 12:27:06 +1000
message:
Merge crufty fix for push.
modified:
NEWS news-20080228111444-miryhm4hma987q57-1
branch.py branch.py-20060620084702-jnrwijq76kg45klj-5
tests/test_branch.py test_branch.py-20060620084702-jnrwijq76kg45klj-9
------------------------------------------------------------
revno: 81.1.1
revision-id: robertc at robertcollins.net-20080410003837-fp8ig8zt88y1g2e1
parent: aaron at aaronbentley.com-20080404045624-9sdd2b3u2ff388fn
committer: Robert Collins <robertc at robertcollins.net>
branch nick: push
timestamp: Thu 2008-04-10 10:38:37 +1000
message:
Crufty but functional fix for push.
modified:
NEWS news-20080228111444-miryhm4hma987q57-1
branch.py branch.py-20060620084702-jnrwijq76kg45klj-5
tests/test_branch.py test_branch.py-20060620084702-jnrwijq76kg45klj-9
=== modified file 'NEWS'
--- a/NEWS 2008-03-26 01:42:23 +0000
+++ b/NEWS 2008-04-10 00:38:37 +0000
@@ -15,6 +15,9 @@
IMPROVEMENTS:
+ * ``bzr push`` now pushes the last-loom rather than creating an empty loom.
+ (Robert Collins, #201613)
+
BUGFIXES:
API BREAKS:
=== modified file 'branch.py'
--- a/branch.py 2008-04-04 02:33:58 +0000
+++ b/branch.py 2008-04-10 00:38:37 +0000
@@ -548,6 +548,13 @@
finally:
pb.finished()
+ @needs_read_lock
+ def push(self, target, overwrite=False, stop_revision=None,
+ _override_hook_source_branch=None):
+ # Not ideal, but see the issues raised on bazaar at lists.canonical.com
+ # about the push api needing work.
+ return target.pull(self, overwrite=overwrite, stop_revision=stop_revision)
+
@needs_write_lock
def record_loom(self, commit_message):
"""Perform a 'commit' to the loom branch.
=== modified file 'tests/test_branch.py'
--- a/tests/test_branch.py 2008-03-20 06:17:25 +0000
+++ b/tests/test_branch.py 2008-04-10 00:38:37 +0000
@@ -375,6 +375,42 @@
self.assertTrue(target.repository.has_revision(rev_id))
self.assertEqual(source.branch.loom_parents(), target.loom_parents())
+ def test_push_loom_loom(self):
+ """Pushing a loom to a loom copies the current loom state."""
+ source = self.get_tree_with_loom('source')
+ source.branch.new_thread('bottom')
+ source.branch.new_thread('top')
+ source.branch.nick = 'bottom'
+ source.branch.record_loom('commit to loom')
+ target = source.bzrdir.sprout('target').open_branch()
+ target.nick = 'top'
+ # put a commit in the bottom and top of this loom
+ bottom_rev1 = source.commit('commit bottom')
+ source_loom_tree = LoomTreeDecorator(source)
+ source_loom_tree.up_thread()
+ top_rev1 = source.commit('integrate bottom changes.')
+ source_loom_tree.down_thread()
+ # and now another commit at the bottom
+ bottom_rev2 = source.commit('bottom 2', allow_pointless=True)
+ source.branch.record_loom('commit to loom again')
+ # we now have two commits in the bottom warp, one in the top, and
+ # all three should be pulled. We are pushing into a loom which has
+ # a different current thread too : that should not affect us.
+ source.branch.push(target)
+ for rev in (bottom_rev1, bottom_rev2, top_rev1):
+ self.assertTrue(target.repository.has_revision(rev))
+ # check loom threads
+ threads = target.get_loom_state().get_threads()
+ self.assertEqual(
+ [('bottom', bottom_rev2, [bottom_rev2]),
+ ('top', top_rev1, [top_rev1])],
+ threads)
+ # check loom tip was pulled
+ loom_rev_ids = source.branch.loom_parents()
+ for rev_id in loom_rev_ids:
+ self.assertTrue(target.repository.has_revision(rev_id))
+ self.assertEqual(source.branch.loom_parents(), target.loom_parents())
+
def test_implicit_record(self):
tree = self.get_tree_with_loom('source')
tree.branch.new_thread('bottom')
More information about the bazaar-commits
mailing list