~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-18 05:39:44 UTC
  • mfrom: (1185.84.4 bundles)
  • Revision ID: pqm@pqm.ubuntu.com-20060618053944-9dbfbd1db2c79933
Use parent branch as default base branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2006 by Canonical Ltd
 
2
# Authors: Aaron Bentley
 
3
#
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; either version 2 of the License, or
 
7
# (at your option) any later version.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program; if not, write to the Free Software
 
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 
 
18
 
 
19
import os
 
20
from StringIO import StringIO
 
21
 
 
22
from bzrlib.bundle.read_bundle import BundleReader
 
23
from bzrlib.bzrdir import BzrDir
 
24
from bzrlib.tests import TestCaseInTempDir
 
25
 
 
26
 
 
27
class TestBundle(TestCaseInTempDir):
 
28
 
 
29
    def test_uses_parent(self):
 
30
        """Parent location is used as a basis by default"""
 
31
        
 
32
        parent_tree = BzrDir.create_standalone_workingtree('parent')
 
33
        parent_tree.commit('initial commit', rev_id='revision1')
 
34
        os.chdir('parent')
 
35
        errmsg = self.run_bzr('bundle', retcode=3)[1]
 
36
        self.assertContainsRe(errmsg, 'No base branch known or specified')
 
37
        branch_tree = parent_tree.bzrdir.sprout('../branch').open_workingtree()
 
38
        branch_tree.commit('next commit', rev_id='revision2')
 
39
        branch_tree.commit('last commit', rev_id='revision3')
 
40
        os.chdir('../branch')
 
41
        br = BundleReader(StringIO(self.run_bzr('bundle')[0]))
 
42
        self.assertEqual(br.info.revisions[0].revision_id, 'revision3')
 
43
        self.assertEqual(len(br.info.revisions), 2)
 
44
        self.assertEqual(br.info.revisions[1].revision_id, 'revision2')