[MERGE] Avoid losing data when converting a local branch to a lightweight checkout
Andrew Bennetts
andrew at canonical.com
Mon Apr 7 03:43:15 BST 2008
Aaron Bentley wrote:
[...]
> >> +++ bzrlib/tests/test_reconfigure.py 2008-04-06 16:54:35 +0000
> >> @@ -203,6 +203,11 @@
> >> checkout.commit('test', rev_id='new-commit', local=True)
> >> reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
> >> checkout.bzrdir)
> >> + self.assertRaises(errors.UnsyncedBranches, reconfiguration.apply)
> >> + parent.pull(checkout.branch)
> >> + # work around pack fetch bug
> >> + checkout.commit('test2', local=True)
> >> + checkout.branch.set_last_revision_info(1, 'new-commit')
> >> reconfiguration.apply()
> >> wt = checkout.bzrdir.open_workingtree()
> >> self.assertTrue(parent.repository.has_same_location(
> >
> > I don't follow this. Why would the checkout be out of sync with the parent
> > here?
>
> new-commit was a local commit. Once it is pulled into the parent
> branch, they are no longer out of sync, and the reconfiguration succeeds.
Oh right. In that case, this looks like you've jammed a second test into an
existing test method. I'd rather you added a separate test for this.
If nothing else, I suspect I would have been less likely to get confused if the
new test wasn't cluttered by the other test...
(See also
http://xunitpatterns.com/Principles%20of%20Test%20Automation.html#Verify%20One%20Condition%20per%20Test)
-Andrew.
More information about the bazaar
mailing list