Rev 3238: Refactor to reduce duplication. in http://people.ubuntu.com/~robertc/baz2.0/shallow-branch
Robert Collins
robertc at robertcollins.net
Tue Feb 26 03:43:44 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/shallow-branch
------------------------------------------------------------
revno: 3238
revision-id:robertc at robertcollins.net-20080226034339-splbn4dr2gq00ilb
parent: robertc at robertcollins.net-20080226015859-0ny930hk79seevw0
committer: Robert Collins <robertc at robertcollins.net>
branch nick: push.reference
timestamp: Tue 2008-02-26 14:43:39 +1100
message:
Refactor to reduce duplication.
modified:
bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py 2008-02-26 01:58:59 +0000
+++ b/bzrlib/tests/blackbox/test_push.py 2008-02-26 03:43:39 +0000
@@ -263,6 +263,14 @@
branch_tree.commit('moar work plz')
return trunk_tree, branch_tree
+ def assertPublished(self, branch_revid, stacked_on):
+ """Assert that the branch 'published' has been published correctly."""
+ published_branch = Branch.open('published')
+ # The published branch refers to the mainline
+ self.assertEqual(stacked_on, published_branch.get_stacked_on())
+ # and the branch's work was pushed
+ self.assertTrue(published_branch.repository.has_revision(branch_revid))
+
def test_push_new_branch_reference(self):
"""Pushing a new branch with --reference creates a stacked branch."""
trunk_tree, branch_tree = self.create_trunk_and_feature_branch()
@@ -272,13 +280,8 @@
self.assertEqual('', out)
self.assertEqual('Created new shallow branch referring to %s.\n' %
trunk_tree.branch.base, err)
- published_branch = Branch.open('published')
- # The published branch refers to the mainline
- self.assertEqual(trunk_tree.branch.base,
- published_branch.get_stacked_on())
- # and the branch's work was pushed
- branch_revid = branch_tree.last_revision()
- self.assertTrue(published_branch.repository.has_revision(branch_revid))
+ self.assertPublished(branch_tree.last_revision(),
+ trunk_tree.branch.base)
def test_push_new_branch_shallow_uses_parent_public(self):
"""Pushing a new branch with --reference creates a stacked branch."""
@@ -296,12 +299,7 @@
self.assertEqual('', out)
self.assertEqual('Created new shallow branch referring to %s.\n' %
trunk_public_url, err)
- published_branch = Branch.open('published')
- # The published branch refers to the mainline
- self.assertEqual(trunk_public_url, published_branch.get_stacked_on())
- # and the branch's work was pushed
- branch_revid = branch_tree.last_revision()
- self.assertTrue(published_branch.repository.has_revision(branch_revid))
+ self.assertPublished(branch_tree.last_revision(), trunk_public_url)
class RedirectingMemoryTransport(MemoryTransport):
More information about the bazaar-commits
mailing list