6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
1 |
# Copyright (C) 2005-2012 Canonical Ltd
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
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.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
7 |
#
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
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.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
12 |
#
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
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
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
16 |
|
17 |
||
1666.1.5
by Robert Collins
Merge bound branch test performance improvements. |
18 |
"""Black-box tests for bzr pull."""
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
19 |
|
20 |
import os |
|
21 |
import sys |
|
22 |
||
4634.124.3
by Martin Pool
Give a warning from pulling across the network from a different format |
23 |
from bzrlib import ( |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
24 |
branch, |
4634.124.3
by Martin Pool
Give a warning from pulling across the network from a different format |
25 |
debug, |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
26 |
osutils, |
4634.124.3
by Martin Pool
Give a warning from pulling across the network from a different format |
27 |
remote, |
6175.2.4
by Vincent Ladeuil
Add script tests and documentation. |
28 |
tests, |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
29 |
uncommit, |
4634.124.3
by Martin Pool
Give a warning from pulling across the network from a different format |
30 |
urlutils, |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
31 |
workingtree, |
4634.124.3
by Martin Pool
Give a warning from pulling across the network from a different format |
32 |
)
|
33 |
||
3251.4.10
by Aaron Bentley
Pull of launchpad locations works (abentley, #181945) |
34 |
from bzrlib.directory_service import directories |
5651.5.3
by Andrew Bennetts
Use new fixture in more tests. |
35 |
from bzrlib.tests import ( |
36 |
fixtures, |
|
6175.2.4
by Vincent Ladeuil
Add script tests and documentation. |
37 |
script, |
5651.5.3
by Andrew Bennetts
Use new fixture in more tests. |
38 |
)
|
1614.2.8
by Olaf Conradi
Added testcases for using pull with --remember. Moved remember code to |
39 |
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
40 |
|
6175.2.4
by Vincent Ladeuil
Add script tests and documentation. |
41 |
class TestPull(tests.TestCaseWithTransport): |
1185.50.7
by John Arbash Meinel
Fix broken test from refactoring blackbox/test_pull |
42 |
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
43 |
def example_branch(self, path='.'): |
44 |
tree = self.make_branch_and_tree(path) |
|
45 |
self.build_tree_contents([ |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
46 |
(osutils.pathjoin(path, 'hello'), 'foo'), |
47 |
(osutils.pathjoin(path, 'goodbye'), 'baz')]) |
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
48 |
tree.add('hello') |
49 |
tree.commit(message='setup') |
|
50 |
tree.add('goodbye') |
|
51 |
tree.commit(message='setup') |
|
52 |
return tree |
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
53 |
|
54 |
def test_pull(self): |
|
55 |
"""Pull changes from one branch to another."""
|
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
56 |
a_tree = self.example_branch('a') |
6165.4.7
by Jelmer Vernooij
More fixes. |
57 |
base_rev = a_tree.branch.last_revision() |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
58 |
self.run_bzr('pull', retcode=3, working_dir='a') |
59 |
self.run_bzr('missing', retcode=3, working_dir='a') |
|
60 |
self.run_bzr('missing .', working_dir='a') |
|
61 |
self.run_bzr('missing', working_dir='a') |
|
1666.1.5
by Robert Collins
Merge bound branch test performance improvements. |
62 |
# this will work on windows because we check for the same branch
|
63 |
# in pull - if it fails, it is a regression
|
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
64 |
self.run_bzr('pull', working_dir='a') |
65 |
self.run_bzr('pull /', retcode=3, working_dir='a') |
|
1185.31.31
by John Arbash Meinel
avoiding 'bzr pull .' means all tests pass under cygwin |
66 |
if sys.platform not in ('win32', 'cygwin'): |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
67 |
self.run_bzr('pull', working_dir='a') |
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
68 |
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
69 |
b_tree = a_tree.bzrdir.sprout('b').open_workingtree() |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
70 |
self.run_bzr('pull', working_dir='b') |
71 |
os.mkdir('b/subdir') |
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
72 |
b_tree.add('subdir') |
6165.4.7
by Jelmer Vernooij
More fixes. |
73 |
new_rev = b_tree.commit(message='blah', allow_pointless=True) |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
74 |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
75 |
a = branch.Branch.open('a') |
76 |
b = branch.Branch.open('b') |
|
6165.4.7
by Jelmer Vernooij
More fixes. |
77 |
self.assertEqual(a.last_revision(), base_rev) |
78 |
self.assertEqual(b.last_revision(), new_rev) |
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
79 |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
80 |
self.run_bzr('pull ../b', working_dir='a') |
6165.4.6
by Jelmer Vernooij
Avoid more uses of revision_history. |
81 |
self.assertEqual(a.last_revision(), b.last_revision()) |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
82 |
a_tree.commit(message='blah2', allow_pointless=True) |
83 |
b_tree.commit(message='blah3', allow_pointless=True) |
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
84 |
# no overwrite
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
85 |
self.run_bzr('pull ../a', retcode=3, working_dir='b') |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
86 |
b_tree.bzrdir.sprout('overwriteme') |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
87 |
self.run_bzr('pull --overwrite ../a', working_dir='overwriteme') |
88 |
overwritten = branch.Branch.open('overwriteme') |
|
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
89 |
self.assertEqual(overwritten.last_revision(), |
90 |
a.last_revision()) |
|
2738.2.6
by Daniel Watkins
Now use internal merging. |
91 |
a_tree.merge_from_branch(b_tree.branch) |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
92 |
a_tree.commit(message="blah4", allow_pointless=True) |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
93 |
|
94 |
self.run_bzr('pull ../../a', working_dir='b/subdir') |
|
6165.4.1
by Jelmer Vernooij
Avoid using revision_history. |
95 |
self.assertEqual(a.last_revision(), b.last_revision()) |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
96 |
sub_tree = workingtree.WorkingTree.open_containing('b/subdir')[0] |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
97 |
sub_tree.commit(message="blah5", allow_pointless=True) |
98 |
sub_tree.commit(message="blah6", allow_pointless=True) |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
99 |
self.run_bzr('pull ../a', working_dir='b') |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
100 |
a_tree.commit(message="blah7", allow_pointless=True) |
101 |
a_tree.merge_from_branch(b_tree.branch) |
|
102 |
a_tree.commit(message="blah8", allow_pointless=True) |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
103 |
self.run_bzr('pull ../b', working_dir='a') |
104 |
self.run_bzr('pull ../b', working_dir='a') |
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
105 |
|
2220.2.9
by Martin Pool
Add specific tests for push -d and pull -d |
106 |
def test_pull_dash_d(self): |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
107 |
self.example_branch('a') |
108 |
self.make_branch_and_tree('b') |
|
109 |
self.make_branch_and_tree('c') |
|
2220.2.9
by Martin Pool
Add specific tests for push -d and pull -d |
110 |
# pull into that branch
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
111 |
self.run_bzr('pull -d b a') |
2220.2.9
by Martin Pool
Add specific tests for push -d and pull -d |
112 |
# pull into a branch specified by a url
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
113 |
c_url = urlutils.local_path_to_url('c') |
2220.2.9
by Martin Pool
Add specific tests for push -d and pull -d |
114 |
self.assertStartsWith(c_url, 'file://') |
2738.2.3
by Daniel Watkins
Fixed jam's concerns. |
115 |
self.run_bzr(['pull', '-d', c_url, 'a']) |
2220.2.9
by Martin Pool
Add specific tests for push -d and pull -d |
116 |
|
1185.76.2
by Erik Bågfors
test for pull --revision |
117 |
def test_pull_revision(self): |
118 |
"""Pull some changes from one branch to another."""
|
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
119 |
a_tree = self.example_branch('a') |
120 |
self.build_tree_contents([ |
|
121 |
('a/hello2', 'foo'), |
|
122 |
('a/goodbye2', 'baz')]) |
|
123 |
a_tree.add('hello2') |
|
124 |
a_tree.commit(message="setup") |
|
125 |
a_tree.add('goodbye2') |
|
126 |
a_tree.commit(message="setup") |
|
127 |
||
128 |
b_tree = a_tree.bzrdir.sprout('b', |
|
129 |
revision_id=a_tree.branch.get_rev_id(1)).open_workingtree() |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
130 |
self.run_bzr('pull -r 2', working_dir='b') |
131 |
a = branch.Branch.open('a') |
|
132 |
b = branch.Branch.open('b') |
|
2738.2.4
by Daniel Watkins
Changed assertEquals to assertEqual. |
133 |
self.assertEqual(a.revno(),4) |
134 |
self.assertEqual(b.revno(),2) |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
135 |
self.run_bzr('pull -r 3', working_dir='b') |
2738.2.4
by Daniel Watkins
Changed assertEquals to assertEqual. |
136 |
self.assertEqual(b.revno(),3) |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
137 |
self.run_bzr('pull -r 4', working_dir='b') |
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
138 |
self.assertEqual(a.last_revision(), b.last_revision()) |
1185.76.2
by Erik Bågfors
test for pull --revision |
139 |
|
5535.3.28
by Andrew Bennetts
Implement fetching tags during branch pull. Needs more tests. |
140 |
def test_pull_tags(self): |
141 |
"""Tags are updated by pull, and revisions named in those tags are
|
|
142 |
fetched.
|
|
143 |
"""
|
|
144 |
# Make a source, sprout a target off it
|
|
145 |
builder = self.make_branch_builder('source') |
|
5651.5.3
by Andrew Bennetts
Use new fixture in more tests. |
146 |
source = fixtures.build_branch_with_non_ancestral_rev(builder) |
6404.6.5
by Vincent Ladeuil
Missed fallouts from the previous trunk merge. |
147 |
source.lock_write() |
148 |
try: |
|
149 |
source.get_config_stack().set('branch.fetch_tags', True) |
|
150 |
finally: |
|
151 |
source.unlock() |
|
5535.3.28
by Andrew Bennetts
Implement fetching tags during branch pull. Needs more tests. |
152 |
target_bzrdir = source.bzrdir.sprout('target') |
153 |
source.tags.set_tag('tag-a', 'rev-2') |
|
154 |
# Pull from source
|
|
155 |
self.run_bzr('pull -d target source') |
|
156 |
target = target_bzrdir.open_branch() |
|
157 |
# The tag is present, and so is its revision.
|
|
158 |
self.assertEqual('rev-2', target.tags.lookup_tag('tag-a')) |
|
159 |
target.repository.get_revision('rev-2') |
|
160 |
||
1185.50.7
by John Arbash Meinel
Fix broken test from refactoring blackbox/test_pull |
161 |
def test_overwrite_uptodate(self): |
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
162 |
# Make sure pull --overwrite overwrites
|
163 |
# even if the target branch has merged
|
|
164 |
# everything already.
|
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
165 |
a_tree = self.make_branch_and_tree('a') |
166 |
self.build_tree_contents([('a/foo', 'original\n')]) |
|
167 |
a_tree.add('foo') |
|
168 |
a_tree.commit(message='initial commit') |
|
169 |
||
170 |
b_tree = a_tree.bzrdir.sprout('b').open_workingtree() |
|
171 |
||
172 |
self.build_tree_contents([('a/foo', 'changed\n')]) |
|
173 |
a_tree.commit(message='later change') |
|
174 |
||
175 |
self.build_tree_contents([('a/foo', 'a third change')]) |
|
176 |
a_tree.commit(message='a third change') |
|
177 |
||
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
178 |
self.assertEqual(a_tree.branch.last_revision_info()[0], 3) |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
179 |
|
180 |
b_tree.merge_from_branch(a_tree.branch) |
|
181 |
b_tree.commit(message='merge') |
|
182 |
||
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
183 |
self.assertEqual(b_tree.branch.last_revision_info()[0], 2) |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
184 |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
185 |
self.run_bzr('pull --overwrite ../a', working_dir='b') |
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
186 |
(last_revinfo_b) = b_tree.branch.last_revision_info() |
187 |
self.assertEqual(last_revinfo_b[0], 3) |
|
188 |
self.assertEqual(last_revinfo_b[1], a_tree.branch.last_revision()) |
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
189 |
|
1185.50.7
by John Arbash Meinel
Fix broken test from refactoring blackbox/test_pull |
190 |
def test_overwrite_children(self): |
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
191 |
# Make sure pull --overwrite sets the revision-history
|
192 |
# to be identical to the pull source, even if we have convergence
|
|
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
193 |
a_tree = self.make_branch_and_tree('a') |
194 |
self.build_tree_contents([('a/foo', 'original\n')]) |
|
195 |
a_tree.add('foo') |
|
196 |
a_tree.commit(message='initial commit') |
|
197 |
||
198 |
b_tree = a_tree.bzrdir.sprout('b').open_workingtree() |
|
199 |
||
200 |
self.build_tree_contents([('a/foo', 'changed\n')]) |
|
201 |
a_tree.commit(message='later change') |
|
202 |
||
203 |
self.build_tree_contents([('a/foo', 'a third change')]) |
|
204 |
a_tree.commit(message='a third change') |
|
205 |
||
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
206 |
self.assertEqual(a_tree.branch.last_revision_info()[0], 3) |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
207 |
|
208 |
b_tree.merge_from_branch(a_tree.branch) |
|
209 |
b_tree.commit(message='merge') |
|
210 |
||
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
211 |
self.assertEqual(b_tree.branch.last_revision_info()[0], 2) |
2664.11.2
by Daniel Watkins
tests.blackbox.test_pull now uses internals where appropriate. |
212 |
|
213 |
self.build_tree_contents([('a/foo', 'a fourth change\n')]) |
|
214 |
a_tree.commit(message='a fourth change') |
|
215 |
||
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
216 |
rev_info_a = a_tree.branch.last_revision_info() |
6165.4.7
by Jelmer Vernooij
More fixes. |
217 |
self.assertEqual(rev_info_a[0], 4) |
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
218 |
|
219 |
# With convergence, we could just pull over the
|
|
220 |
# new change, but with --overwrite, we want to switch our history
|
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
221 |
self.run_bzr('pull --overwrite ../a', working_dir='b') |
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
222 |
rev_info_b = b_tree.branch.last_revision_info() |
223 |
self.assertEqual(rev_info_b[0], 4) |
|
224 |
self.assertEqual(rev_info_b, rev_info_a) |
|
1185.50.5
by John Arbash Meinel
pull --overwrite should always overwrite, not just if diverged. (Test case from Robey Pointer) |
225 |
|
1614.2.8
by Olaf Conradi
Added testcases for using pull with --remember. Moved remember code to |
226 |
def test_pull_remember(self): |
227 |
"""Pull changes from one branch to another and test parent location."""
|
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
228 |
t = self.get_transport() |
1614.2.16
by Olaf Conradi
Modified blackbox test cases to use bzrlib API. |
229 |
tree_a = self.make_branch_and_tree('branch_a') |
230 |
branch_a = tree_a.branch |
|
231 |
self.build_tree(['branch_a/a']) |
|
232 |
tree_a.add('a') |
|
233 |
tree_a.commit('commit a') |
|
1666.1.4
by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in |
234 |
tree_b = branch_a.bzrdir.sprout('branch_b').open_workingtree() |
235 |
branch_b = tree_b.branch |
|
236 |
tree_c = branch_a.bzrdir.sprout('branch_c').open_workingtree() |
|
237 |
branch_c = tree_c.branch |
|
1614.2.16
by Olaf Conradi
Modified blackbox test cases to use bzrlib API. |
238 |
self.build_tree(['branch_a/b']) |
239 |
tree_a.add('b') |
|
240 |
tree_a.commit('commit b') |
|
1614.2.8
by Olaf Conradi
Added testcases for using pull with --remember. Moved remember code to |
241 |
# reset parent
|
1614.2.16
by Olaf Conradi
Modified blackbox test cases to use bzrlib API. |
242 |
parent = branch_b.get_parent() |
6404.6.1
by Vincent Ladeuil
Tests passing for a first rough version of a cached branch config store. The changes here are too invasive and several parallel proposals have been made. |
243 |
branch_b = branch.Branch.open('branch_b') |
244 |
branch_b.lock_write() |
|
6404.6.6
by Vincent Ladeuil
Use idioms coherently and add comments to make their purpose clearer. |
245 |
try: |
246 |
branch_b.set_parent(None) |
|
247 |
finally: |
|
248 |
branch_b.unlock() |
|
1614.2.16
by Olaf Conradi
Modified blackbox test cases to use bzrlib API. |
249 |
self.assertEqual(None, branch_b.get_parent()) |
1614.2.8
by Olaf Conradi
Added testcases for using pull with --remember. Moved remember code to |
250 |
# test pull for failure without parent set
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
251 |
out = self.run_bzr('pull', retcode=3, working_dir='branch_b') |
2738.2.4
by Daniel Watkins
Changed assertEquals to assertEqual. |
252 |
self.assertEqual(out, |
1614.2.8
by Olaf Conradi
Added testcases for using pull with --remember. Moved remember code to |
253 |
('','bzr: ERROR: No pull location known or specified.\n')) |
254 |
# test implicit --remember when no parent set, this pull conflicts
|
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
255 |
self.build_tree(['branch_b/d']) |
1614.2.16
by Olaf Conradi
Modified blackbox test cases to use bzrlib API. |
256 |
tree_b.add('d') |
257 |
tree_b.commit('commit d') |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
258 |
out = self.run_bzr('pull ../branch_a', retcode=3, |
259 |
working_dir='branch_b') |
|
2738.2.4
by Daniel Watkins
Changed assertEquals to assertEqual. |
260 |
self.assertEqual(out, |
2221.5.13
by Dmitry Vasiliev
Fixed expected message in test |
261 |
('','bzr: ERROR: These branches have diverged.' |
4297.3.3
by Jelmer Vernooij
Fix pull --remember test. |
262 |
' Use the missing command to see how.\n' |
263 |
'Use the merge command to reconcile them.\n')) |
|
6404.6.5
by Vincent Ladeuil
Missed fallouts from the previous trunk merge. |
264 |
tree_b = tree_b.bzrdir.open_workingtree() |
265 |
branch_b = tree_b.branch |
|
6404.6.1
by Vincent Ladeuil
Tests passing for a first rough version of a cached branch config store. The changes here are too invasive and several parallel proposals have been made. |
266 |
self.assertEqual(parent, branch_b.get_parent()) |
1614.2.8
by Olaf Conradi
Added testcases for using pull with --remember. Moved remember code to |
267 |
# test implicit --remember after resolving previous failure
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
268 |
uncommit.uncommit(branch=branch_b, tree=tree_b) |
269 |
t.delete('branch_b/d') |
|
270 |
self.run_bzr('pull', working_dir='branch_b') |
|
6404.6.6
by Vincent Ladeuil
Use idioms coherently and add comments to make their purpose clearer. |
271 |
# Refresh the branch object as 'pull' modified it
|
6404.6.5
by Vincent Ladeuil
Missed fallouts from the previous trunk merge. |
272 |
branch_b = branch_b.bzrdir.open_branch() |
2738.2.4
by Daniel Watkins
Changed assertEquals to assertEqual. |
273 |
self.assertEqual(branch_b.get_parent(), parent) |
1614.2.8
by Olaf Conradi
Added testcases for using pull with --remember. Moved remember code to |
274 |
# test explicit --remember
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
275 |
self.run_bzr('pull ../branch_c --remember', working_dir='branch_b') |
6404.6.6
by Vincent Ladeuil
Use idioms coherently and add comments to make their purpose clearer. |
276 |
# Refresh the branch object as 'pull' modified it
|
6404.6.5
by Vincent Ladeuil
Missed fallouts from the previous trunk merge. |
277 |
branch_b = branch_b.bzrdir.open_branch() |
6404.6.1
by Vincent Ladeuil
Tests passing for a first rough version of a cached branch config store. The changes here are too invasive and several parallel proposals have been made. |
278 |
self.assertEqual(branch_c.bzrdir.root_transport.base, |
279 |
branch_b.get_parent()) |
|
1711.3.3
by John Arbash Meinel
Allow pull to use a bundle as a target, |
280 |
|
281 |
def test_pull_bundle(self): |
|
282 |
from bzrlib.testament import Testament |
|
283 |
# Build up 2 trees and prepare for a pull
|
|
284 |
tree_a = self.make_branch_and_tree('branch_a') |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
285 |
with open('branch_a/a', 'wb') as f: |
286 |
f.write('hello') |
|
1711.3.3
by John Arbash Meinel
Allow pull to use a bundle as a target, |
287 |
tree_a.add('a') |
288 |
tree_a.commit('message') |
|
289 |
||
290 |
tree_b = tree_a.bzrdir.sprout('branch_b').open_workingtree() |
|
291 |
||
292 |
# Make a change to 'a' that 'b' can pull
|
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
293 |
with open('branch_a/a', 'wb') as f: |
294 |
f.write('hey there') |
|
1711.3.3
by John Arbash Meinel
Allow pull to use a bundle as a target, |
295 |
tree_a.commit('message') |
296 |
||
297 |
# Create the bundle for 'b' to pull
|
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
298 |
self.run_bzr('bundle ../branch_b -o ../bundle', working_dir='branch_a') |
1711.3.3
by John Arbash Meinel
Allow pull to use a bundle as a target, |
299 |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
300 |
out, err = self.run_bzr('pull ../bundle', working_dir='branch_b') |
2220.2.39
by Martin Pool
Pull also merges tags and warns if they conflict |
301 |
self.assertEqual(out, |
302 |
'Now on revision 2.\n') |
|
303 |
self.assertEqual(err, |
|
304 |
' M a\nAll changes applied successfully.\n') |
|
1711.3.3
by John Arbash Meinel
Allow pull to use a bundle as a target, |
305 |
|
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
306 |
self.assertEqualDiff(tree_a.branch.last_revision(), |
307 |
tree_b.branch.last_revision()) |
|
1711.3.3
by John Arbash Meinel
Allow pull to use a bundle as a target, |
308 |
|
1908.7.6
by Robert Collins
Deprecate WorkingTree.last_revision. |
309 |
testament_a = Testament.from_revision(tree_a.branch.repository, |
310 |
tree_a.get_parent_ids()[0]) |
|
1711.3.3
by John Arbash Meinel
Allow pull to use a bundle as a target, |
311 |
testament_b = Testament.from_revision(tree_b.branch.repository, |
1908.7.6
by Robert Collins
Deprecate WorkingTree.last_revision. |
312 |
tree_b.get_parent_ids()[0]) |
1711.3.3
by John Arbash Meinel
Allow pull to use a bundle as a target, |
313 |
self.assertEqualDiff(testament_a.as_text(), |
314 |
testament_b.as_text()) |
|
315 |
||
316 |
# it is legal to attempt to pull an already-merged bundle
|
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
317 |
out, err = self.run_bzr('pull ../bundle', working_dir='branch_b') |
2220.2.39
by Martin Pool
Pull also merges tags and warns if they conflict |
318 |
self.assertEqual(err, '') |
6112.4.1
by Jelmer Vernooij
Show how many tags have been updated in bzr pull. |
319 |
self.assertEqual(out, 'No revisions or tags to pull.\n') |
1551.17.2
by Aaron Bentley
Stop showing deltas in pull -v output |
320 |
|
321 |
def test_pull_verbose_no_files(self): |
|
322 |
"""Pull --verbose should not list modified files"""
|
|
323 |
tree_a = self.make_branch_and_tree('tree_a') |
|
324 |
self.build_tree(['tree_a/foo']) |
|
325 |
tree_a.add('foo') |
|
326 |
tree_a.commit('bar') |
|
327 |
tree_b = self.make_branch_and_tree('tree_b') |
|
328 |
out = self.run_bzr('pull --verbose -d tree_b tree_a')[0] |
|
329 |
self.assertContainsRe(out, 'bar') |
|
330 |
self.assertNotContainsRe(out, 'added:') |
|
331 |
self.assertNotContainsRe(out, 'foo') |
|
3200.1.1
by James Westby
Make pull --quiet more quiet. Fixes #185907. |
332 |
|
333 |
def test_pull_quiet(self): |
|
334 |
"""Check that bzr pull --quiet does not print anything"""
|
|
335 |
tree_a = self.make_branch_and_tree('tree_a') |
|
336 |
self.build_tree(['tree_a/foo']) |
|
337 |
tree_a.add('foo') |
|
3200.1.2
by James Westby
Check that the pull succeeds even when printing nothing. |
338 |
revision_id = tree_a.commit('bar') |
3200.1.1
by James Westby
Make pull --quiet more quiet. Fixes #185907. |
339 |
tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree() |
340 |
out, err = self.run_bzr('pull --quiet -d tree_b') |
|
341 |
self.assertEqual(out, '') |
|
342 |
self.assertEqual(err, '') |
|
3200.1.2
by James Westby
Check that the pull succeeds even when printing nothing. |
343 |
self.assertEqual(tree_b.last_revision(), revision_id) |
3200.1.1
by James Westby
Make pull --quiet more quiet. Fixes #185907. |
344 |
self.build_tree(['tree_a/moo']) |
345 |
tree_a.add('moo') |
|
3200.1.2
by James Westby
Check that the pull succeeds even when printing nothing. |
346 |
revision_id = tree_a.commit('quack') |
3200.1.1
by James Westby
Make pull --quiet more quiet. Fixes #185907. |
347 |
out, err = self.run_bzr('pull --quiet -d tree_b') |
348 |
self.assertEqual(out, '') |
|
349 |
self.assertEqual(err, '') |
|
3200.1.2
by James Westby
Check that the pull succeeds even when printing nothing. |
350 |
self.assertEqual(tree_b.last_revision(), revision_id) |
3251.4.10
by Aaron Bentley
Pull of launchpad locations works (abentley, #181945) |
351 |
|
3251.4.12
by Aaron Bentley
Updates from review |
352 |
def test_pull_from_directory_service(self): |
3251.4.10
by Aaron Bentley
Pull of launchpad locations works (abentley, #181945) |
353 |
source = self.make_branch_and_tree('source') |
354 |
source.commit('commit 1') |
|
355 |
target = source.bzrdir.sprout('target').open_workingtree() |
|
356 |
source_last = source.commit('commit 2') |
|
357 |
class FooService(object): |
|
358 |
"""A directory service that always returns source"""
|
|
359 |
||
360 |
def look_up(self, name, url): |
|
361 |
return 'source' |
|
3251.4.12
by Aaron Bentley
Updates from review |
362 |
directories.register('foo:', FooService, 'Testing directory service') |
4985.2.1
by Vincent Ladeuil
Deploy addAttrCleanup on the whole test suite. |
363 |
self.addCleanup(directories.remove, 'foo:') |
3251.4.10
by Aaron Bentley
Pull of launchpad locations works (abentley, #181945) |
364 |
self.run_bzr('pull foo:bar -d target') |
365 |
self.assertEqual(source_last, target.last_revision()) |
|
3848.1.1
by Aaron Bentley
Use default log format in pull -v |
366 |
|
367 |
def test_pull_verbose_defaults_to_long(self): |
|
368 |
tree = self.example_branch('source') |
|
369 |
target = self.make_branch_and_tree('target') |
|
370 |
out = self.run_bzr('pull -v source -d target')[0] |
|
371 |
self.assertContainsRe(out, |
|
372 |
r'revno: 1\ncommitter: .*\nbranch nick: source') |
|
3848.1.5
by Aaron Bentley
Updates from review |
373 |
self.assertNotContainsRe(out, r'\n {4}1 .*\n {6}setup\n') |
3848.1.1
by Aaron Bentley
Use default log format in pull -v |
374 |
|
375 |
def test_pull_verbose_uses_default_log(self): |
|
376 |
tree = self.example_branch('source') |
|
377 |
target = self.make_branch_and_tree('target') |
|
6404.6.2
by Vincent Ladeuil
Merge trunk resolving conflicts and fixing more test failures related to |
378 |
target.branch.lock_write() |
379 |
try: |
|
380 |
target.branch.get_config_stack().set('log_format', 'short') |
|
381 |
finally: |
|
382 |
target.branch.unlock() |
|
3848.1.1
by Aaron Bentley
Use default log format in pull -v |
383 |
out = self.run_bzr('pull -v source -d target')[0] |
384 |
self.assertContainsRe(out, r'\n {4}1 .*\n {6}setup\n') |
|
3848.1.5
by Aaron Bentley
Updates from review |
385 |
self.assertNotContainsRe( |
386 |
out, r'revno: 1\ncommitter: .*\nbranch nick: source') |
|
4419.1.1
by Andrew Bennetts
Failing blackbox acceptance test for bug 380314. |
387 |
|
6110.1.1
by John Arbash Meinel
Merge MvG's bugfix for #483661. Needs a couple small tweaks. |
388 |
def test_pull_smart_bound_branch(self): |
6105.2.1
by Martin von Gagern
Added blackbox testcase for pull to bound branch over smart medium. |
389 |
self.setup_smart_server_with_call_log() |
390 |
parent = self.make_branch_and_tree('parent') |
|
391 |
parent.commit(message='first commit') |
|
392 |
child = parent.bzrdir.sprout('child').open_workingtree() |
|
393 |
child.commit(message='second commit') |
|
394 |
checkout = parent.branch.create_checkout('checkout') |
|
395 |
self.run_bzr(['pull', self.get_url('child')], working_dir='checkout') |
|
396 |
||
4419.1.1
by Andrew Bennetts
Failing blackbox acceptance test for bug 380314. |
397 |
def test_pull_smart_stacked_streaming_acceptance(self): |
4419.1.6
by Andrew Bennetts
Add comments requested by Martin's review. |
398 |
"""'bzr pull -r 123' works on stacked, smart branches, even when the
|
399 |
revision specified by the revno is only present in the fallback
|
|
400 |
repository.
|
|
401 |
||
402 |
See <https://launchpad.net/bugs/380314>
|
|
403 |
"""
|
|
4419.1.1
by Andrew Bennetts
Failing blackbox acceptance test for bug 380314. |
404 |
self.setup_smart_server_with_call_log() |
4419.2.4
by Andrew Bennetts
Add Repository.get_rev_id_for_revno RPC, removes VFS calls from 'pull -r 123' case. |
405 |
# Make a stacked-on branch with two commits so that the
|
406 |
# revision-history can't be determined just by looking at the parent
|
|
407 |
# field in the revision in the stacked repo.
|
|
4419.1.1
by Andrew Bennetts
Failing blackbox acceptance test for bug 380314. |
408 |
parent = self.make_branch_and_tree('parent', format='1.9') |
409 |
parent.commit(message='first commit') |
|
4419.2.4
by Andrew Bennetts
Add Repository.get_rev_id_for_revno RPC, removes VFS calls from 'pull -r 123' case. |
410 |
parent.commit(message='second commit') |
4419.1.1
by Andrew Bennetts
Failing blackbox acceptance test for bug 380314. |
411 |
local = parent.bzrdir.sprout('local').open_workingtree() |
412 |
local.commit(message='local commit') |
|
413 |
local.branch.create_clone_on_transport( |
|
414 |
self.get_transport('stacked'), stacked_on=self.get_url('parent')) |
|
415 |
empty = self.make_branch_and_tree('empty', format='1.9') |
|
416 |
self.reset_smart_call_log() |
|
417 |
self.run_bzr(['pull', '-r', '1', self.get_url('stacked')], |
|
418 |
working_dir='empty') |
|
419 |
# This figure represent the amount of work to perform this use case. It
|
|
420 |
# is entirely ok to reduce this number if a test fails due to rpc_count
|
|
421 |
# being too low. If rpc_count increases, more network roundtrips have
|
|
422 |
# become necessary for this use case. Please do not adjust this number
|
|
423 |
# upwards without agreement from bzr's network support maintainers.
|
|
6015.15.7
by John Arbash Meinel
Fix the 11 tests that still failed. |
424 |
self.assertLength(19, self.hpss_calls) |
6366.1.4
by Jelmer Vernooij
Test connection count calls for most blackbox commands. |
425 |
self.assertLength(1, self.hpss_connections) |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
426 |
remote = branch.Branch.open('stacked') |
4419.1.1
by Andrew Bennetts
Failing blackbox acceptance test for bug 380314. |
427 |
self.assertEndsWith(remote.get_stacked_on_url(), '/parent') |
6175.2.4
by Vincent Ladeuil
Add script tests and documentation. |
428 |
|
4634.124.2
by Martin Pool
Add a test and news for warning about local cross-forrmat fetch |
429 |
def test_pull_cross_format_warning(self): |
430 |
"""You get a warning for probably slow cross-format pulls.
|
|
431 |
"""
|
|
4634.124.3
by Martin Pool
Give a warning from pulling across the network from a different format |
432 |
# this is assumed to be going through InterDifferingSerializer
|
4634.124.2
by Martin Pool
Add a test and news for warning about local cross-forrmat fetch |
433 |
from_tree = self.make_branch_and_tree('from', format='2a') |
434 |
to_tree = self.make_branch_and_tree('to', format='1.14-rich-root') |
|
435 |
from_tree.commit(message='first commit') |
|
436 |
out, err = self.run_bzr(['pull', '-d', 'to', 'from']) |
|
437 |
self.assertContainsRe(err, |
|
4634.124.4
by Martin Pool
Centralize warning about cross-format fetch into UIFactory |
438 |
"(?m)Doing on-the-fly conversion") |
4634.124.3
by Martin Pool
Give a warning from pulling across the network from a different format |
439 |
|
440 |
def test_pull_cross_format_warning_no_IDS(self): |
|
441 |
"""You get a warning for probably slow cross-format pulls.
|
|
442 |
"""
|
|
443 |
# this simulates what would happen across the network, where
|
|
444 |
# interdifferingserializer is not active
|
|
445 |
||
446 |
debug.debug_flags.add('IDS_never') |
|
447 |
# TestCase take care of restoring them
|
|
448 |
||
449 |
from_tree = self.make_branch_and_tree('from', format='2a') |
|
450 |
to_tree = self.make_branch_and_tree('to', format='1.14-rich-root') |
|
451 |
from_tree.commit(message='first commit') |
|
452 |
out, err = self.run_bzr(['pull', '-d', 'to', 'from']) |
|
453 |
self.assertContainsRe(err, |
|
4634.124.4
by Martin Pool
Centralize warning about cross-format fetch into UIFactory |
454 |
"(?m)Doing on-the-fly conversion") |
4634.124.3
by Martin Pool
Give a warning from pulling across the network from a different format |
455 |
|
456 |
def test_pull_cross_format_from_network(self): |
|
457 |
self.setup_smart_server_with_call_log() |
|
458 |
from_tree = self.make_branch_and_tree('from', format='2a') |
|
459 |
to_tree = self.make_branch_and_tree('to', format='1.14-rich-root') |
|
460 |
self.assertIsInstance(from_tree.branch, remote.RemoteBranch) |
|
461 |
from_tree.commit(message='first commit') |
|
462 |
out, err = self.run_bzr(['pull', '-d', 'to', |
|
463 |
from_tree.branch.bzrdir.root_transport.base]) |
|
464 |
self.assertContainsRe(err, |
|
4634.124.4
by Martin Pool
Centralize warning about cross-format fetch into UIFactory |
465 |
"(?m)Doing on-the-fly conversion") |
4988.9.2
by Jelmer Vernooij
Add warning when attempting to fetch into experimental formats. |
466 |
|
467 |
def test_pull_to_experimental_format_warning(self): |
|
468 |
"""You get a warning for pulling into experimental formats.
|
|
469 |
"""
|
|
470 |
from_tree = self.make_branch_and_tree('from', format='development-subtree') |
|
471 |
to_tree = self.make_branch_and_tree('to', format='development-subtree') |
|
472 |
from_tree.commit(message='first commit') |
|
473 |
out, err = self.run_bzr(['pull', '-d', 'to', 'from']) |
|
474 |
self.assertContainsRe(err, |
|
475 |
"(?m)Fetching into experimental format") |
|
476 |
||
477 |
def test_pull_cross_to_experimental_format_warning(self): |
|
478 |
"""You get a warning for pulling into experimental formats.
|
|
479 |
"""
|
|
480 |
from_tree = self.make_branch_and_tree('from', format='2a') |
|
481 |
to_tree = self.make_branch_and_tree('to', format='development-subtree') |
|
482 |
from_tree.commit(message='first commit') |
|
483 |
out, err = self.run_bzr(['pull', '-d', 'to', 'from']) |
|
484 |
self.assertContainsRe(err, |
|
485 |
"(?m)Fetching into experimental format") |
|
5430.7.1
by Rory Yorke
Added --show-base to pull and update (bug 202374). |
486 |
|
487 |
def test_pull_show_base(self): |
|
488 |
"""bzr pull supports --show-base
|
|
489 |
||
490 |
see https://bugs.launchpad.net/bzr/+bug/202374"""
|
|
491 |
# create two trees with conflicts, setup conflict, check that
|
|
492 |
# conflicted file looks correct
|
|
493 |
a_tree = self.example_branch('a') |
|
494 |
b_tree = a_tree.bzrdir.sprout('b').open_workingtree() |
|
495 |
||
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
496 |
with open(osutils.pathjoin('a', 'hello'),'wt') as f: |
497 |
f.write('fee') |
|
5430.7.1
by Rory Yorke
Added --show-base to pull and update (bug 202374). |
498 |
a_tree.commit('fee') |
5430.7.2
by Rory Yorke
Changes as per Martin [gz]'s review. |
499 |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
500 |
with open(osutils.pathjoin('b', 'hello'),'wt') as f: |
501 |
f.write('fie') |
|
5430.7.1
by Rory Yorke
Added --show-base to pull and update (bug 202374). |
502 |
|
503 |
out,err=self.run_bzr(['pull','-d','b','a','--show-base']) |
|
504 |
||
505 |
# check for message here
|
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
506 |
self.assertEqual( |
507 |
err, |
|
508 |
' M hello\nText conflict in hello\n1 conflicts encountered.\n') |
|
5430.7.1
by Rory Yorke
Added --show-base to pull and update (bug 202374). |
509 |
|
510 |
self.assertEqualDiff('<<<<<<< TREE\n' |
|
511 |
'fie||||||| BASE-REVISION\n' |
|
512 |
'foo=======\n' |
|
513 |
'fee>>>>>>> MERGE-SOURCE\n', |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
514 |
open(osutils.pathjoin('b', 'hello')).read()) |
5430.7.1
by Rory Yorke
Added --show-base to pull and update (bug 202374). |
515 |
|
516 |
def test_pull_show_base_working_tree_only(self): |
|
517 |
"""--show-base only allowed if there's a working tree
|
|
518 |
||
519 |
see https://bugs.launchpad.net/bzr/+bug/202374"""
|
|
520 |
# create a branch, see that --show-base fails
|
|
521 |
self.make_branch('from') |
|
522 |
self.make_branch('to') |
|
523 |
out=self.run_bzr(['pull','-d','to','from','--show-base'],retcode=3) |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
524 |
self.assertEqual( |
525 |
out, ('','bzr: ERROR: Need working tree for --show-base.\n')) |
|
5430.7.1
by Rory Yorke
Added --show-base to pull and update (bug 202374). |
526 |
|
5616.6.1
by Jelmer Vernooij
Exit with 1 if there were tag conflicts during pull. |
527 |
def test_pull_tag_conflicts(self): |
528 |
"""pulling tags with conflicts will change the exit code"""
|
|
529 |
# create a branch, see that --show-base fails
|
|
530 |
from_tree = self.make_branch_and_tree('from') |
|
531 |
from_tree.branch.tags.set_tag("mytag", "somerevid") |
|
532 |
to_tree = self.make_branch_and_tree('to') |
|
533 |
to_tree.branch.tags.set_tag("mytag", "anotherrevid") |
|
534 |
out = self.run_bzr(['pull','-d','to','from'],retcode=1) |
|
535 |
self.assertEqual(out, |
|
536 |
('No revisions to pull.\nConflicting tags:\n mytag\n', '')) |
|
6112.4.1
by Jelmer Vernooij
Show how many tags have been updated in bzr pull. |
537 |
|
538 |
def test_pull_tag_notification(self): |
|
539 |
"""pulling tags with conflicts will change the exit code"""
|
|
540 |
# create a branch, see that --show-base fails
|
|
541 |
from_tree = self.make_branch_and_tree('from') |
|
542 |
from_tree.branch.tags.set_tag("mytag", "somerevid") |
|
543 |
to_tree = self.make_branch_and_tree('to') |
|
544 |
out = self.run_bzr(['pull', '-d', 'to', 'from']) |
|
545 |
self.assertEqual(out, |
|
546 |
('1 tag(s) updated.\n', '')) |
|
6156.1.1
by Jelmer Vernooij
Don't report all tags as changed when --overwrite is specified. |
547 |
|
548 |
def test_pull_tag_overwrite(self): |
|
549 |
"""pulling tags with --overwrite only reports changed tags."""
|
|
550 |
# create a branch, see that --show-base fails
|
|
551 |
from_tree = self.make_branch_and_tree('from') |
|
552 |
from_tree.branch.tags.set_tag("mytag", "somerevid") |
|
553 |
to_tree = self.make_branch_and_tree('to') |
|
554 |
to_tree.branch.tags.set_tag("mytag", "somerevid") |
|
555 |
out = self.run_bzr(['pull', '--overwrite', '-d', 'to', 'from']) |
|
556 |
self.assertEqual(out, |
|
557 |
('No revisions or tags to pull.\n', '')) |
|
6175.2.4
by Vincent Ladeuil
Add script tests and documentation. |
558 |
|
559 |
||
560 |
class TestPullOutput(script.TestCaseWithTransportAndScript): |
|
561 |
||
562 |
def test_pull_log_format(self): |
|
563 |
self.run_script(""" |
|
564 |
$ bzr init trunk
|
|
565 |
Created a standalone tree (format: 2a)
|
|
566 |
$ cd trunk
|
|
567 |
$ echo foo > file
|
|
568 |
$ bzr add
|
|
569 |
adding file
|
|
570 |
$ bzr commit -m 'we need some foo'
|
|
571 |
2>Committing to:...trunk/
|
|
572 |
2>added file
|
|
573 |
2>Committed revision 1.
|
|
574 |
$ cd ..
|
|
575 |
$ bzr init feature
|
|
576 |
Created a standalone tree (format: 2a)
|
|
577 |
$ cd feature
|
|
578 |
$ bzr pull -v ../trunk -Olog_format=line
|
|
579 |
Now on revision 1.
|
|
580 |
Added Revisions:
|
|
581 |
1: jrandom@example.com ...we need some foo
|
|
582 |
2>+N file
|
|
583 |
2>All changes applied successfully.
|
|
584 |
""") |