bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
1185.84.4
by Aaron Bentley
Use parent branch as default base branch |
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 |
||
|
1793.2.2
by Aaron Bentley
Move BundleReader into v07 serializer |
22 |
from bzrlib.bundle.serializer import read_bundle |
|
1185.84.4
by Aaron Bentley
Use parent branch as default base branch |
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') |
|
|
1793.2.2
by Aaron Bentley
Move BundleReader into v07 serializer |
41 |
br = read_bundle(StringIO(self.run_bzr('bundle')[0])) |
42 |
self.assertEqual(br.revisions[0].revision_id, 'revision3') |
|
43 |
self.assertEqual(len(br.revisions), 2) |
|
44 |
self.assertEqual(br.revisions[1].revision_id, 'revision2') |
|
|
1804.1.1
by Aaron Bentley
Add support for submit location to bundles |
45 |
|
46 |
def test_uses_submit(self): |
|
47 |
"""Submit location can be used and set""" |
|
48 |
||
49 |
submit_tree = BzrDir.create_standalone_workingtree('submit') |
|
50 |
submit_tree.commit('initial commit', rev_id='revision1') |
|
51 |
parent_tree = submit_tree.bzrdir.sprout('parent').open_workingtree() |
|
52 |
parent_tree.commit('next commit', rev_id='revision2') |
|
53 |
branch_tree = parent_tree.bzrdir.sprout('branch').open_workingtree() |
|
54 |
branch_tree.commit('last commit', rev_id='revision3') |
|
55 |
os.chdir('branch') |
|
56 |
br = read_bundle(StringIO(self.run_bzr('bundle')[0])) |
|
57 |
self.assertEqual(br.revisions[0].revision_id, 'revision3') |
|
58 |
self.assertEqual(len(br.revisions), 1) |
|
59 |
br = read_bundle(StringIO(self.run_bzr('bundle', '../submit')[0])) |
|
60 |
self.assertEqual(len(br.revisions), 2) |
|
61 |
# submit location should be auto-remembered
|
|
62 |
br = read_bundle(StringIO(self.run_bzr('bundle')[0])) |
|
63 |
self.assertEqual(len(br.revisions), 2) |
|
64 |
self.run_bzr('bundle', '../parent') |
|
65 |
br = read_bundle(StringIO(self.run_bzr('bundle')[0])) |
|
66 |
self.assertEqual(len(br.revisions), 2) |
|
67 |
self.run_bzr('bundle', '../parent', '--remember') |
|
68 |
br = read_bundle(StringIO(self.run_bzr('bundle')[0])) |
|
69 |
self.assertEqual(len(br.revisions), 1) |
|
70 |
err = self.run_bzr('bundle', '--remember', retcode=3)[1] |
|
71 |
self.assertContainsRe(err, |
|
72 |
'--remember requires a branch to be specified.') |