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