~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2008-07-11 21:41:24 UTC
  • mto: This revision was merged to the branch mainline in revision 3543.
  • Revision ID: john@arbash-meinel.com-20080711214124-qi09irlj7pd5cuzg
Shortcut the case when one revision is in the ancestry of the other.

At the cost of a heads() check, when one parent supersedes, we don't have to extract
the text for the other. Changes merge time from 3m37s => 3m21s. Using a
CachingParentsProvider would drop the time down to 3m11s.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
        wt.add(['a', 'b', 'c'])
33
33
        wt.commit('initial commit', rev_id='a1')
34
34
 
35
 
        self.build_tree_contents([('tree/a', 'new contents of a\n')])
 
35
        open('tree/a', 'wb').write('new contents of a\n')
36
36
        wt.commit('second commit', rev_id='a2')
37
37
 
38
38
        return wt
213
213
 
214
214
        self.assertEqual(['a2', 'b3', 'c3'], wt.get_parent_ids())
215
215
 
216
 
    def test_uncommit_shows_log_with_revision_id(self):
217
 
        wt = self.create_simple_tree()
218
 
 
219
 
        out, err = self.run_bzr('uncommit --force', working_dir='tree')
220
 
        self.assertContainsRe(out, r'second commit')
221
 
        self.assertContainsRe(err, r'You can restore the old tip by running')
222
 
        self.assertContainsRe(err, r'bzr pull . -r revid:a2')
223
 
 
224
216
    def test_uncommit_octopus_merge(self):
225
217
        # Check that uncommit keeps the pending merges in the same order
226
218
        # though it will also filter out ones in the ancestry
231
223
 
232
224
        tree2.commit('unchanged', rev_id='b3')
233
225
        tree3.commit('unchanged', rev_id='c3')
234
 
 
 
226
        
235
227
        wt.merge_from_branch(tree2.branch)
236
228
        wt.merge_from_branch(tree3.branch)
237
229
        wt.commit('merge b3, c3', rev_id='a3')