bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2052.3.2
by John Arbash Meinel
Change Copyright .. by Canonical to Copyright ... Canonical |
1 |
# Copyright (C) 2005 Canonical Ltd
|
|
1185.85.7
by John Arbash Meinel
Added Copyright, changed test_missing to use run_bzr instead of capture. |
2 |
# -*- coding: utf-8 -*-
|
3 |
# vim: encoding=utf-8
|
|
|
1685.1.80
by Wouter van Heyst
more code cleanup |
4 |
#
|
|
1185.85.7
by John Arbash Meinel
Added Copyright, changed test_missing to use run_bzr instead of capture. |
5 |
# This program is free software; you can redistribute it and/or modify
|
6 |
# it under the terms of the GNU General Public License as published by
|
|
7 |
# the Free Software Foundation; either version 2 of the License, or
|
|
8 |
# (at your option) any later version.
|
|
|
1685.1.80
by Wouter van Heyst
more code cleanup |
9 |
#
|
|
1185.85.7
by John Arbash Meinel
Added Copyright, changed test_missing to use run_bzr instead of capture. |
10 |
# This program is distributed in the hope that it will be useful,
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
# GNU General Public License for more details.
|
|
|
1685.1.80
by Wouter van Heyst
more code cleanup |
14 |
#
|
|
1185.85.7
by John Arbash Meinel
Added Copyright, changed test_missing to use run_bzr instead of capture. |
15 |
# You should have received a copy of the GNU General Public License
|
16 |
# along with this program; if not, write to the Free Software
|
|
17 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
1685.1.80
by Wouter van Heyst
more code cleanup |
18 |
|
19 |
"""Black-box tests for bzr missing."""
|
|
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
20 |
|
21 |
import os |
|
22 |
||
|
2193.4.3
by Alexander Belchenko
Use new API for testing |
23 |
from bzrlib import osutils |
24 |
||
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
25 |
from bzrlib.branch import Branch |
|
2193.4.3
by Alexander Belchenko
Use new API for testing |
26 |
from bzrlib.tests import TestCaseWithTransport |
27 |
||
28 |
||
29 |
class TestMissing(TestCaseWithTransport): |
|
|
1607.1.15
by Robert Collins
Change missing to not require a write lock unless it is setting the parent. |
30 |
|
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
31 |
def test_missing(self): |
|
1185.54.21
by Aaron Bentley
Fixed up tests |
32 |
missing = "You are missing 1 revision(s):" |
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
33 |
|
34 |
# create a source branch
|
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
35 |
a_tree = self.make_branch_and_tree('a') |
36 |
self.build_tree_contents([('a/a', 'initial\n')]) |
|
37 |
a_tree.add('a') |
|
38 |
a_tree.commit(message='initial') |
|
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
39 |
|
40 |
# clone and add a differing revision
|
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
41 |
b_tree = a_tree.bzrdir.sprout('b').open_workingtree() |
42 |
self.build_tree_contents([('b/a', 'initial\nmore\n')]) |
|
43 |
b_tree.commit(message='more') |
|
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
44 |
|
|
1607.1.15
by Robert Collins
Change missing to not require a write lock unless it is setting the parent. |
45 |
# run missing in a against b
|
46 |
# this should not require missing to take out a write lock on a
|
|
47 |
# or b. So we take a write lock on both to test that at the same
|
|
48 |
# time. This may let the test pass while the default branch is an
|
|
49 |
# os-locking branch, but it will trigger failures with lockdir based
|
|
50 |
# branches.
|
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
51 |
a_branch = a_tree.branch |
52 |
a_branch.lock_write() |
|
53 |
b_branch = b_tree.branch |
|
54 |
b_branch.lock_write() |
|
55 |
os.chdir('a') |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
56 |
out,err = self.run_bzr('missing ../b', retcode=1) |
|
1607.1.15
by Robert Collins
Change missing to not require a write lock unless it is setting the parent. |
57 |
lines = out.splitlines() |
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
58 |
# we're missing the extra revision here
|
59 |
self.assertEqual(missing, lines[0]) |
|
|
1607.1.15
by Robert Collins
Change missing to not require a write lock unless it is setting the parent. |
60 |
# and we expect 8 lines of output which we trust at the moment to be
|
61 |
# good.
|
|
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
62 |
self.assertEqual(8, len(lines)) |
|
1607.1.15
by Robert Collins
Change missing to not require a write lock unless it is setting the parent. |
63 |
# we do not expect any error output.
|
64 |
self.assertEqual('', err) |
|
65 |
# unlock the branches for the rest of the test
|
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
66 |
a_branch.unlock() |
67 |
b_branch.unlock() |
|
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
68 |
|
69 |
# get extra revision from b
|
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
70 |
a_tree.merge_from_branch(b_branch) |
71 |
a_tree.commit(message='merge') |
|
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
72 |
|
73 |
# compare again, but now we have the 'merge' commit extra
|
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
74 |
lines = self.run_bzr('missing ../b', retcode=1)[0].splitlines() |
|
1185.54.21
by Aaron Bentley
Fixed up tests |
75 |
self.assertEqual("You have 1 extra revision(s):", lines[0]) |
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
76 |
self.assertEqual(8, len(lines)) |
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
77 |
lines2 = self.run_bzr('missing ../b --mine-only', retcode=1)[0] |
|
1185.54.22
by Aaron Bentley
Test every option for "bzr missing" |
78 |
lines2 = lines2.splitlines() |
79 |
self.assertEqual(lines, lines2) |
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
80 |
lines3 = self.run_bzr('missing ../b --theirs-only', retcode=1)[0] |
|
1185.54.22
by Aaron Bentley
Test every option for "bzr missing" |
81 |
lines3 = lines3.splitlines() |
82 |
self.assertEqual(0, len(lines3)) |
|
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
83 |
|
84 |
# relative to a, missing the 'merge' commit
|
|
85 |
os.chdir('../b') |
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
86 |
lines = self.run_bzr('missing ../a', retcode=1)[0].splitlines() |
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
87 |
self.assertEqual(missing, lines[0]) |
88 |
self.assertEqual(8, len(lines)) |
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
89 |
lines2 = self.run_bzr('missing ../a --theirs-only', retcode=1)[0] |
|
1185.54.22
by Aaron Bentley
Test every option for "bzr missing" |
90 |
lines2 = lines2.splitlines() |
91 |
self.assertEqual(lines, lines2) |
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
92 |
lines3 = self.run_bzr('missing ../a --mine-only', retcode=1)[0] |
|
1185.54.22
by Aaron Bentley
Test every option for "bzr missing" |
93 |
lines3 = lines3.splitlines() |
94 |
self.assertEqual(0, len(lines3)) |
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
95 |
lines4 = self.run_bzr('missing ../a --short', retcode=1)[0] |
|
1185.54.22
by Aaron Bentley
Test every option for "bzr missing" |
96 |
lines4 = lines4.splitlines() |
97 |
self.assertEqual(4, len(lines4)) |
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
98 |
lines5 = self.run_bzr('missing ../a --line', retcode=1)[0] |
|
1185.54.22
by Aaron Bentley
Test every option for "bzr missing" |
99 |
lines5 = lines5.splitlines() |
100 |
self.assertEqual(2, len(lines5)) |
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
101 |
lines6 = self.run_bzr('missing ../a --reverse', retcode=1)[0] |
|
1185.54.22
by Aaron Bentley
Test every option for "bzr missing" |
102 |
lines6 = lines6.splitlines() |
103 |
self.assertEqual(lines6, lines) |
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
104 |
lines7 = self.run_bzr('missing ../a --show-ids', retcode=1)[0] |
|
1185.54.22
by Aaron Bentley
Test every option for "bzr missing" |
105 |
lines7 = lines7.splitlines() |
106 |
self.assertEqual(11, len(lines7)) |
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
107 |
lines8 = self.run_bzr('missing ../a --verbose', retcode=1)[0] |
|
1185.54.22
by Aaron Bentley
Test every option for "bzr missing" |
108 |
lines8 = lines8.splitlines() |
109 |
self.assertEqual("modified:", lines8[-2]) |
|
110 |
self.assertEqual(" a", lines8[-1]) |
|
111 |
||
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
112 |
# after a pull we're back on track
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
113 |
b_tree.pull(a_branch) |
114 |
self.assertEqual("Branches are up to date.\n", self.run_bzr('missing ../a')[0]) |
|
|
1185.55.1
by Wouter van Heyst
Add testcase for missing command, improved with feedback from Robert |
115 |
|
|
2193.4.1
by Alexander Belchenko
'bzr missing' without specifying location show remembered location unescaped |
116 |
def test_missing_check_last_location(self): |
117 |
# check that last location shown as filepath not file URL
|
|
118 |
||
119 |
# create a source branch
|
|
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
120 |
wt = self.make_branch_and_tree('a') |
|
2193.4.3
by Alexander Belchenko
Use new API for testing |
121 |
b = wt.branch |
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
122 |
self.build_tree(['a/foo']) |
|
2193.4.3
by Alexander Belchenko
Use new API for testing |
123 |
wt.add('foo') |
124 |
wt.commit('initial') |
|
125 |
||
|
2664.14.2
by Daniel Watkins
Fixed tests.blackbox.test_missing to use internals where appropriate. |
126 |
os.chdir('a') |
|
2193.4.3
by Alexander Belchenko
Use new API for testing |
127 |
location = osutils.getcwd() + '/' |
128 |
||
|
2193.4.1
by Alexander Belchenko
'bzr missing' without specifying location show remembered location unescaped |
129 |
# clone
|
|
2193.4.3
by Alexander Belchenko
Use new API for testing |
130 |
b.bzrdir.sprout('../b') |
|
2193.4.1
by Alexander Belchenko
'bzr missing' without specifying location show remembered location unescaped |
131 |
|
132 |
# check last location
|
|
|
2193.4.3
by Alexander Belchenko
Use new API for testing |
133 |
lines, err = self.run_bzr('missing', working_dir='../b') |
|
2193.4.1
by Alexander Belchenko
'bzr missing' without specifying location show remembered location unescaped |
134 |
self.assertEquals('Using last location: %s\n' |
135 |
'Branches are up to date.\n' % location, |
|
136 |
lines) |
|
|
2193.4.3
by Alexander Belchenko
Use new API for testing |
137 |
self.assertEquals('', err) |