bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2257.2.2
by Wouter van Heyst
Actually test that `bzr init-repo --{no,}-trees` still works |
1 |
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
|
|
1558.5.1
by Aaron Bentley
Added make-repository command |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
"""Black-box tests for repositories with shared branches"""
|
|
18 |
||
19 |
import os |
|
20 |
||
|
1658.1.6
by Martin Pool
init-repo shouldn't insist on creating a new directory (Malone #38331) |
21 |
from bzrlib.bzrdir import BzrDir |
|
1558.5.9
by Aaron Bentley
Updated tests per Robert Collins' suggestions |
22 |
import bzrlib.errors as errors |
|
2257.2.2
by Wouter van Heyst
Actually test that `bzr init-repo --{no,}-trees` still works |
23 |
from bzrlib.tests import TestCaseInTempDir |
|
1558.5.1
by Aaron Bentley
Added make-repository command |
24 |
|
25 |
class TestSharedRepo(TestCaseInTempDir): |
|
|
1558.5.9
by Aaron Bentley
Updated tests per Robert Collins' suggestions |
26 |
|
|
1558.5.4
by Aaron Bentley
Added bzr init test |
27 |
def test_make_repository(self): |
|
1558.5.9
by Aaron Bentley
Updated tests per Robert Collins' suggestions |
28 |
out, err = self.run_bzr("init-repository", "a") |
29 |
self.assertEqual(out, "") |
|
30 |
self.assertEqual(err, "") |
|
|
2257.2.2
by Wouter van Heyst
Actually test that `bzr init-repo --{no,}-trees` still works |
31 |
dir = BzrDir.open('a') |
|
1558.5.9
by Aaron Bentley
Updated tests per Robert Collins' suggestions |
32 |
self.assertIs(dir.open_repository().is_shared(), True) |
33 |
self.assertRaises(errors.NotBranchError, dir.open_branch) |
|
34 |
self.assertRaises(errors.NoWorkingTree, dir.open_workingtree) |
|
|
1558.5.4
by Aaron Bentley
Added bzr init test |
35 |
|
|
1658.1.6
by Martin Pool
init-repo shouldn't insist on creating a new directory (Malone #38331) |
36 |
def test_init_repo_existing_dir(self): |
37 |
"""Make repo in existing directory. |
|
38 |
|
|
39 |
(Malone #38331)
|
|
40 |
"""
|
|
41 |
out, err = self.run_bzr("init-repository", ".") |
|
42 |
dir = BzrDir.open('.') |
|
43 |
self.assertTrue(dir.open_repository()) |
|
44 |
||
|
1558.5.4
by Aaron Bentley
Added bzr init test |
45 |
def test_init(self): |
|
1558.5.6
by Aaron Bentley
Renamed make-repo init-repo |
46 |
self.run_bzr("init-repo", "a") |
|
1857.1.20
by Aaron Bentley
Strip out all the EnumOption stuff |
47 |
self.run_bzr("init", "--format=default", "a/b") |
|
2257.2.2
by Wouter van Heyst
Actually test that `bzr init-repo --{no,}-trees` still works |
48 |
dir = BzrDir.open('a') |
|
1558.5.9
by Aaron Bentley
Updated tests per Robert Collins' suggestions |
49 |
self.assertIs(dir.open_repository().is_shared(), True) |
50 |
self.assertRaises(errors.NotBranchError, dir.open_branch) |
|
51 |
self.assertRaises(errors.NoWorkingTree, dir.open_workingtree) |
|
|
2257.2.2
by Wouter van Heyst
Actually test that `bzr init-repo --{no,}-trees` still works |
52 |
bdir = BzrDir.open('a/b') |
|
1558.5.9
by Aaron Bentley
Updated tests per Robert Collins' suggestions |
53 |
bdir.open_branch() |
54 |
self.assertRaises(errors.NoRepositoryPresent, bdir.open_repository) |
|
|
2257.2.1
by Wouter van Heyst
Change the ui level default for init-repo to --trees. |
55 |
wt = bdir.open_workingtree() |
|
1558.5.5
by Aaron Bentley
Added tests for branch |
56 |
|
57 |
def test_branch(self): |
|
|
1558.5.6
by Aaron Bentley
Renamed make-repo init-repo |
58 |
self.run_bzr("init-repo", "a") |
|
1857.1.20
by Aaron Bentley
Strip out all the EnumOption stuff |
59 |
self.run_bzr("init", "--format=default", "a/b") |
|
1558.5.5
by Aaron Bentley
Added tests for branch |
60 |
self.run_bzr('branch', 'a/b', 'a/c') |
|
2257.2.2
by Wouter van Heyst
Actually test that `bzr init-repo --{no,}-trees` still works |
61 |
cdir = BzrDir.open('a/c') |
|
1558.5.9
by Aaron Bentley
Updated tests per Robert Collins' suggestions |
62 |
cdir.open_branch() |
63 |
self.assertRaises(errors.NoRepositoryPresent, cdir.open_repository) |
|
|
2257.2.1
by Wouter van Heyst
Change the ui level default for init-repo to --trees. |
64 |
cdir.open_workingtree() |
|
1624.2.2
by Erik Bågfors
tests for --tree |
65 |
|
66 |
def test_branch_tree(self): |
|
|
1624.2.4
by Erik Bågfors
rename --tree to --trees |
67 |
self.run_bzr("init-repo", "--trees", "a") |
|
1857.1.20
by Aaron Bentley
Strip out all the EnumOption stuff |
68 |
self.run_bzr("init", "--format=default", "b") |
|
1624.2.2
by Erik Bågfors
tests for --tree |
69 |
file('b/hello', 'wt').write('bar') |
70 |
self.run_bzr("add", "b/hello") |
|
71 |
self.run_bzr("commit", "-m", "bar", "b/hello") |
|
72 |
||
73 |
self.run_bzr('branch', 'b', 'a/c') |
|
|
2257.2.2
by Wouter van Heyst
Actually test that `bzr init-repo --{no,}-trees` still works |
74 |
cdir = BzrDir.open('a/c') |
|
1624.2.2
by Erik Bågfors
tests for --tree |
75 |
cdir.open_branch() |
76 |
self.assertRaises(errors.NoRepositoryPresent, cdir.open_repository) |
|
|
1634.1.2
by Robert Collins
Merge Erik Bågfors --trees option for init-repository. |
77 |
self.failUnlessExists('a/c/hello') |
|
1624.2.3
by Erik Bågfors
better test for --tree option |
78 |
cdir.open_workingtree() |
|
1624.2.2
by Erik Bågfors
tests for --tree |
79 |
|
|
2257.2.2
by Wouter van Heyst
Actually test that `bzr init-repo --{no,}-trees` still works |
80 |
def test_trees_default(self): |
81 |
# 0.15 switched to trees by default
|
|
82 |
self.run_bzr("init-repo", "repo") |
|
83 |
repo = BzrDir.open("repo").open_repository() |
|
84 |
self.assertEqual(True, repo.make_working_trees()) |
|
85 |
||
86 |
def test_trees_argument(self): |
|
87 |
# Supplying the --trees argument should be harmless,
|
|
88 |
# as it was previously non-default we need to get it right.
|
|
89 |
self.run_bzr("init-repo", "--trees", "trees") |
|
90 |
repo = BzrDir.open("trees").open_repository() |
|
91 |
self.assertEqual(True, repo.make_working_trees()) |
|
92 |
||
93 |
def test_no_trees_argument(self): |
|
94 |
# --no-trees should make it so that there is no working tree
|
|
95 |
self.run_bzr("init-repo", "--no-trees", "notrees") |
|
96 |
repo = BzrDir.open("notrees").open_repository() |
|
97 |
self.assertEqual(False, repo.make_working_trees()) |