/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_reconfigure.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-12 18:05:15 UTC
  • mto: (4371.4.5 vila-better-heads)
  • mto: This revision was merged to the branch mainline in revision 4449.
  • Revision ID: john@arbash-meinel.com-20090612180515-t0cwbjsnve094oik
Add a failing test for handling nodes that are in the same linear chain.

It fails because the ancestry skipping causes us to miss the fact that the two nodes
are actually directly related. We could check at the beginning, as the 
code used to do, but I think that will be incomplete for the more-than-two
heads cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2009 Canonical Ltd
 
1
# Copyright (C) 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
20
20
    tests,
21
21
    workingtree,
22
22
    )
23
 
from bzrlib.branchbuilder import BranchBuilder
24
23
 
25
24
 
26
25
class TestReconfigure(tests.TestCaseWithTransport):
183
182
 
184
183
    def test_lightweight_rich_root_pack_checkout_to_tree(self, format=None):
185
184
        self.test_lightweight_format_checkout_to_tree('rich-root-pack')
186
 
 
187
 
 
188
 
class TestReconfigureStacking(tests.TestCaseWithTransport):
189
 
 
190
 
    def test_reconfigure_stacking(self):
191
 
        """Test a fairly realistic scenario for stacking:
192
 
 
193
 
         * make a branch with some history
194
 
         * branch it
195
 
         * make the second branch stacked on the first
196
 
         * commit in the second
197
 
         * then make the second unstacked, so it has to fill in history from
198
 
           the original fallback lying underneath its original content
199
 
 
200
 
        See discussion in <https://bugs.edge.launchpad.net/bzr/+bug/391411>
201
 
        """
202
 
        # there are also per_branch tests that exercise remote operation etc
203
 
        tree_1 = self.make_branch_and_tree('b1', format='2a')
204
 
        self.build_tree(['b1/foo'])
205
 
        tree_1.add(['foo'])
206
 
        tree_1.commit('add foo')
207
 
        branch_1 = tree_1.branch
208
 
        # now branch and commit again
209
 
        bzrdir_2 = tree_1.bzrdir.sprout('b2')
210
 
        tree_2 = bzrdir_2.open_workingtree()
211
 
        branch_2 = tree_2.branch
212
 
        # now reconfigure to be stacked
213
 
        out, err = self.run_bzr('reconfigure --stacked-on b1 b2')
214
 
        self.assertContainsRe(out,
215
 
            '^.*/b2/ is now stacked on ../b1\n$')
216
 
        self.assertEquals('', err)
217
 
        # can also give the absolute URL of the branch, and it gets stored 
218
 
        # as a relative path if possible
219
 
        out, err = self.run_bzr('reconfigure --stacked-on %s b2'
220
 
            % (self.get_url('b1'),))
221
 
        self.assertContainsRe(out,
222
 
            '^.*/b2/ is now stacked on ../b1\n$')
223
 
        self.assertEquals('', err)
224
 
        # It should be given a relative URL to the destination, if possible,
225
 
        # because that's most likely to work across different transports
226
 
        self.assertEquals(branch_2.get_stacked_on_url(),
227
 
            '../b1')
228
 
        # commit, and it should be stored into b2's repo
229
 
        self.build_tree_contents([('foo', 'new foo')])
230
 
        tree_2.commit('update foo')
231
 
        # Now turn it off again
232
 
        out, err = self.run_bzr('reconfigure --unstacked b2')
233
 
        self.assertContainsRe(out,
234
 
            '^.*/b2/ is now not stacked\n$')
235
 
        self.assertEquals('', err)
236
 
        self.assertRaises(errors.NotStacked,
237
 
            branch_2.get_stacked_on_url)
238
 
 
239
 
    # XXX: Needs a test for reconfiguring stacking and shape at the same time;
240
 
    # no branch at location; stacked-on is not a branch; quiet mode.
241
 
    # -- mbp 20090706