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-2011, 2016 Canonical Ltd
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
|
1115
by Martin Pool
- split fetch tests into a separate file |
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 |
#
|
|
1115
by Martin Pool
- split fetch tests into a separate file |
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 |
#
|
|
1115
by Martin Pool
- split fetch tests into a separate file |
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
|
|
1238
by Martin Pool
- remove a lot of dead code from fetch |
16 |
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
17 |
from .. import ( |
|
2323.8.2
by Aaron Bentley
Give a nicer error on fetch when repos are in incompatible formats |
18 |
errors, |
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
19 |
osutils, |
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
20 |
revision as _mod_revision, |
|
6670.4.1
by Jelmer Vernooij
Update imports. |
21 |
)
|
22 |
from ..bzr import ( |
|
23 |
bzrdir, |
|
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
24 |
versionedfile, |
|
2323.8.2
by Aaron Bentley
Give a nicer error on fetch when repos are in incompatible formats |
25 |
)
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
26 |
from ..branch import Branch |
|
6670.4.5
by Jelmer Vernooij
Move breezy.repofmt contents to breezy.bzr. |
27 |
from ..bzr import knitrepo |
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
28 |
from . import TestCaseWithTransport |
29 |
from .test_revision import make_branches |
|
30 |
from ..upgrade import Convert |
|
31 |
from ..workingtree import WorkingTree |
|
|
1185.1.41
by Robert Collins
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid |
32 |
|
|
2696.3.3
by Martin Pool
Start setting the default format to dirstate-tags |
33 |
# These tests are a bit old; please instead add new tests into
|
|
4523.1.3
by Martin Pool
Rename to per_interrepository |
34 |
# per_interrepository/ so they'll run on all relevant
|
|
2696.3.3
by Martin Pool
Start setting the default format to dirstate-tags |
35 |
# combinations.
|
36 |
||
|
1115
by Martin Pool
- split fetch tests into a separate file |
37 |
|
|
1238
by Martin Pool
- remove a lot of dead code from fetch |
38 |
def has_revision(branch, revision_id): |
|
1534.4.41
by Robert Collins
Branch now uses BzrDir reasonably sanely. |
39 |
return branch.repository.has_revision(revision_id) |
|
1534.4.5
by Robert Collins
Turn branch format.open into a factory. |
40 |
|
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
41 |
|
42 |
def revision_history(branch): |
|
|
6165.4.28
by Jelmer Vernooij
Fix last locking issues. |
43 |
branch.lock_read() |
44 |
try: |
|
45 |
graph = branch.repository.get_graph() |
|
46 |
history = list(graph.iter_lefthand_ancestry(branch.last_revision(), |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
47 |
[_mod_revision.NULL_REVISION])) |
|
6165.4.28
by Jelmer Vernooij
Fix last locking issues. |
48 |
finally: |
49 |
branch.unlock() |
|
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
50 |
history.reverse() |
51 |
return history |
|
52 |
||
53 |
||
|
1393
by Robert Collins
reenable remotebranch tests |
54 |
def fetch_steps(self, br_a, br_b, writable_a): |
55 |
"""A foreign test method for testing fetch locally and remotely.""" |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
56 |
|
|
1534.4.41
by Robert Collins
Branch now uses BzrDir reasonably sanely. |
57 |
# TODO RBC 20060201 make this a repository test.
|
58 |
repo_b = br_b.repository |
|
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
59 |
self.assertFalse(repo_b.has_revision(revision_history(br_a)[3])) |
60 |
self.assertTrue(repo_b.has_revision(revision_history(br_a)[2])) |
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
61 |
self.assertEqual(len(revision_history(br_b)), 7) |
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
62 |
br_b.fetch(br_a, revision_history(br_a)[2]) |
|
1534.1.31
by Robert Collins
Deprecated fetch.fetch and fetch.greedy_fetch for branch.fetch, and move the Repository.fetch internals to InterRepo and InterWeaveRepo. |
63 |
# branch.fetch is not supposed to alter the revision history
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
64 |
self.assertEqual(len(revision_history(br_b)), 7) |
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
65 |
self.assertFalse(repo_b.has_revision(revision_history(br_a)[3])) |
|
1393
by Robert Collins
reenable remotebranch tests |
66 |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
67 |
# fetching the next revision up in sample data copies one revision
|
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
68 |
br_b.fetch(br_a, revision_history(br_a)[3]) |
69 |
self.assertTrue(repo_b.has_revision(revision_history(br_a)[3])) |
|
70 |
self.assertFalse(has_revision(br_a, revision_history(br_b)[6])) |
|
71 |
self.assertTrue(br_a.repository.has_revision(revision_history(br_b)[5])) |
|
|
1393
by Robert Collins
reenable remotebranch tests |
72 |
|
|
1092.2.28
by Robert Collins
reenable test of fetching a branch with ghosts |
73 |
# When a non-branch ancestor is missing, it should be unlisted...
|
|
1415
by Robert Collins
remove the ancestry weave file |
74 |
# as its not reference from the inventory weave.
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
75 |
br_b4 = self.make_branch('br_4') |
|
4065.1.1
by Robert Collins
Change the return value of fetch() to None. |
76 |
br_b4.fetch(br_b) |
|
1393
by Robert Collins
reenable remotebranch tests |
77 |
|
|
4065.1.1
by Robert Collins
Change the return value of fetch() to None. |
78 |
writable_a.fetch(br_b) |
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
79 |
self.assertTrue(has_revision(br_a, revision_history(br_b)[3])) |
80 |
self.assertTrue(has_revision(br_a, revision_history(br_b)[4])) |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
81 |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
82 |
br_b2 = self.make_branch('br_b2') |
|
4065.1.1
by Robert Collins
Change the return value of fetch() to None. |
83 |
br_b2.fetch(br_b) |
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
84 |
self.assertTrue(has_revision(br_b2, revision_history(br_b)[4])) |
85 |
self.assertTrue(has_revision(br_b2, revision_history(br_a)[2])) |
|
86 |
self.assertFalse(has_revision(br_b2, revision_history(br_a)[3])) |
|
|
1393
by Robert Collins
reenable remotebranch tests |
87 |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
88 |
br_a2 = self.make_branch('br_a2') |
|
4065.1.1
by Robert Collins
Change the return value of fetch() to None. |
89 |
br_a2.fetch(br_a) |
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
90 |
self.assertTrue(has_revision(br_a2, revision_history(br_b)[4])) |
91 |
self.assertTrue(has_revision(br_a2, revision_history(br_a)[3])) |
|
92 |
self.assertTrue(has_revision(br_a2, revision_history(br_a)[2])) |
|
|
1393
by Robert Collins
reenable remotebranch tests |
93 |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
94 |
br_a3 = self.make_branch('br_a3') |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
95 |
# pulling a branch with no revisions grabs nothing, regardless of
|
|
1534.4.41
by Robert Collins
Branch now uses BzrDir reasonably sanely. |
96 |
# whats in the inventory.
|
|
4065.1.1
by Robert Collins
Change the return value of fetch() to None. |
97 |
br_a3.fetch(br_a2) |
|
1393
by Robert Collins
reenable remotebranch tests |
98 |
for revno in range(4): |
|
1534.4.41
by Robert Collins
Branch now uses BzrDir reasonably sanely. |
99 |
self.assertFalse( |
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
100 |
br_a3.repository.has_revision(revision_history(br_a)[revno])) |
101 |
br_a3.fetch(br_a2, revision_history(br_a)[2]) |
|
|
1534.4.41
by Robert Collins
Branch now uses BzrDir reasonably sanely. |
102 |
# pull the 3 revisions introduced by a@u-0-3
|
|
6165.4.25
by Jelmer Vernooij
Fix plugin use of revision_history. |
103 |
br_a3.fetch(br_a2, revision_history(br_a)[3]) |
|
4316.1.1
by Jonathan Lange
Don't raise InstallFailed from fetch. Instead let the search_missing_revision_ids error bubble up. |
104 |
# NoSuchRevision should be raised if the branch is missing the revision
|
|
1393
by Robert Collins
reenable remotebranch tests |
105 |
# that was requested.
|
|
4316.1.1
by Jonathan Lange
Don't raise InstallFailed from fetch. Instead let the search_missing_revision_ids error bubble up. |
106 |
self.assertRaises(errors.NoSuchRevision, br_a3.fetch, br_a2, 'pizza') |
|
2697.2.2
by Martin Pool
deprecate Branch.append_revision |
107 |
|
|
2697.2.5
by Martin Pool
Kill off append_revision |
108 |
# TODO: Test trying to fetch from a branch that points to a revision not
|
109 |
# actually present in its repository. Not every branch format allows you
|
|
110 |
# to directly point to such revisions, so it's a bit complicated to
|
|
111 |
# construct. One way would be to uncommit and gc the revision, but not
|
|
112 |
# every branch supports that. -- mbp 20070814
|
|
|
1638.1.2
by Robert Collins
Change the basis-inventory file to not have the revision-id in the file name. |
113 |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
114 |
# TODO: test that fetch correctly does reweaving when needed. RBC 20051008
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
115 |
# Note that this means - updating the weave when ghosts are filled in to
|
|
1534.4.41
by Robert Collins
Branch now uses BzrDir reasonably sanely. |
116 |
# add the right parents.
|
117 |
||
|
1185.13.4
by Robert Collins
make reweave visible as a weave method, and quickly integrate into fetch |
118 |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
119 |
class TestFetch(TestCaseWithTransport): |
|
1392
by Robert Collins
reinstate testfetch test case |
120 |
|
121 |
def test_fetch(self): |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
122 |
# highest indices a: 5, b: 7
|
|
2696.3.3
by Martin Pool
Start setting the default format to dirstate-tags |
123 |
br_a, br_b = make_branches(self, format='dirstate-tags') |
|
1393
by Robert Collins
reenable remotebranch tests |
124 |
fetch_steps(self, br_a, br_b, br_a) |
|
1404
by Robert Collins
only pull remote text weaves once per fetch operation |
125 |
|
|
1558.4.11
by Aaron Bentley
Allow merge against self, make fetching self a noop |
126 |
def test_fetch_self(self): |
127 |
wt = self.make_branch_and_tree('br') |
|
|
4065.1.1
by Robert Collins
Change the return value of fetch() to None. |
128 |
wt.branch.fetch(wt.branch) |
|
1558.4.11
by Aaron Bentley
Allow merge against self, make fetching self a noop |
129 |
|
|
1551.8.42
by Aaron Bentley
Ensure that fetch properly updates inventory root knit |
130 |
def test_fetch_root_knit(self): |
|
1551.8.43
by Aaron Bentley
Update from reviews |
131 |
"""Ensure that knit2.fetch() updates the root knit |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
132 |
|
|
1551.8.43
by Aaron Bentley
Update from reviews |
133 |
This tests the case where the root has a new revision, but there are no
|
134 |
corresponding filename, parent, contents or other changes.
|
|
|
1551.8.42
by Aaron Bentley
Ensure that fetch properly updates inventory root knit |
135 |
"""
|
|
1551.8.43
by Aaron Bentley
Update from reviews |
136 |
knit1_format = bzrdir.BzrDirMetaFormat1() |
|
2241.1.6
by Martin Pool
Move Knit repositories into the submodule bzrlib.repofmt.knitrepo and |
137 |
knit1_format.repository_format = knitrepo.RepositoryFormatKnit1() |
|
1551.8.43
by Aaron Bentley
Update from reviews |
138 |
knit2_format = bzrdir.BzrDirMetaFormat1() |
|
2255.2.211
by Robert Collins
Remove knit2 repository format- it has never been supported. |
139 |
knit2_format.repository_format = knitrepo.RepositoryFormatKnit3() |
|
1551.8.43
by Aaron Bentley
Update from reviews |
140 |
# we start with a knit1 repository because that causes the
|
141 |
# root revision to change for each commit, even though the content,
|
|
142 |
# parent, name, and other attributes are unchanged.
|
|
143 |
tree = self.make_branch_and_tree('tree', knit1_format) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
144 |
tree.set_root_id(b'tree-root') |
145 |
tree.commit('rev1', rev_id=b'rev1') |
|
146 |
tree.commit('rev2', rev_id=b'rev2') |
|
|
1551.8.43
by Aaron Bentley
Update from reviews |
147 |
|
148 |
# Now we convert it to a knit2 repository so that it has a root knit
|
|
149 |
Convert(tree.basedir, knit2_format) |
|
|
1551.8.42
by Aaron Bentley
Ensure that fetch properly updates inventory root knit |
150 |
tree = WorkingTree.open(tree.basedir) |
|
1551.8.43
by Aaron Bentley
Update from reviews |
151 |
branch = self.make_branch('branch', format=knit2_format) |
|
6973.6.2
by Jelmer Vernooij
Fix more tests. |
152 |
branch.pull(tree.branch, stop_revision=b'rev1') |
|
1551.8.42
by Aaron Bentley
Ensure that fetch properly updates inventory root knit |
153 |
repo = branch.repository |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
154 |
repo.lock_read() |
155 |
try: |
|
156 |
# Make sure fetch retrieved only what we requested
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
157 |
self.assertEqual({(b'tree-root', b'rev1'): ()}, |
158 |
repo.texts.get_parent_map( |
|
159 |
[(b'tree-root', b'rev1'), (b'tree-root', b'rev2')])) |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
160 |
finally: |
161 |
repo.unlock() |
|
|
1551.8.42
by Aaron Bentley
Ensure that fetch properly updates inventory root knit |
162 |
branch.pull(tree.branch) |
|
1551.8.43
by Aaron Bentley
Update from reviews |
163 |
# Make sure that the next revision in the root knit was retrieved,
|
164 |
# even though the text, name, parent_id, etc., were unchanged.
|
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
165 |
repo.lock_read() |
166 |
try: |
|
167 |
# Make sure fetch retrieved only what we requested
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
168 |
self.assertEqual({(b'tree-root', b'rev2'): ((b'tree-root', b'rev1'),)}, |
169 |
repo.texts.get_parent_map([(b'tree-root', b'rev2')])) |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
170 |
finally: |
171 |
repo.unlock() |
|
|
1551.8.42
by Aaron Bentley
Ensure that fetch properly updates inventory root knit |
172 |
|
|
2323.8.2
by Aaron Bentley
Give a nicer error on fetch when repos are in incompatible formats |
173 |
def test_fetch_incompatible(self): |
174 |
knit_tree = self.make_branch_and_tree('knit', format='knit') |
|
175 |
knit3_tree = self.make_branch_and_tree('knit3', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
176 |
format='dirstate-with-subtree') |
|
2323.8.2
by Aaron Bentley
Give a nicer error on fetch when repos are in incompatible formats |
177 |
knit3_tree.commit('blah') |
|
3582.1.2
by Martin Pool
Default InterRepository.fetch raises IncompatibleRepositories |
178 |
e = self.assertRaises(errors.IncompatibleRepositories, |
179 |
knit_tree.branch.fetch, knit3_tree.branch) |
|
180 |
self.assertContainsRe(str(e), |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
181 |
r"(?m).*/knit.*\nis not compatible with\n.*/knit3/.*\n" |
182 |
r"different rich-root support") |
|
|
2323.8.2
by Aaron Bentley
Give a nicer error on fetch when repos are in incompatible formats |
183 |
|
|
1185.16.96
by mbp at sourcefrog
More merge/fetch tests |
184 |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
185 |
class TestMergeFetch(TestCaseWithTransport): |
|
1185.16.96
by mbp at sourcefrog
More merge/fetch tests |
186 |
|
187 |
def test_merge_fetches_unrelated(self): |
|
188 |
"""Merge brings across history from unrelated source""" |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
189 |
wt1 = self.make_branch_and_tree('br1') |
190 |
br1 = wt1.branch |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
191 |
wt1.commit(message='rev 1-1', rev_id=b'1-1') |
192 |
wt1.commit(message='rev 1-2', rev_id=b'1-2') |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
193 |
wt2 = self.make_branch_and_tree('br2') |
194 |
br2 = wt2.branch |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
195 |
wt2.commit(message='rev 2-1', rev_id=b'2-1') |
|
6973.12.3
by Jelmer Vernooij
Fixes. |
196 |
wt2.merge_from_branch(br1, from_revision=b'null:') |
|
1185.16.96
by mbp at sourcefrog
More merge/fetch tests |
197 |
self._check_revs_present(br2) |
198 |
||
|
1185.16.94
by mbp at sourcefrog
New test that merge fetches revisions from source |
199 |
def test_merge_fetches(self): |
200 |
"""Merge brings across history from source""" |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
201 |
wt1 = self.make_branch_and_tree('br1') |
202 |
br1 = wt1.branch |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
203 |
wt1.commit(message='rev 1-1', rev_id=b'1-1') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
204 |
dir_2 = br1.controldir.sprout('br2') |
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
205 |
br2 = dir_2.open_branch() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
206 |
wt1.commit(message='rev 1-2', rev_id=b'1-2') |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
207 |
wt2 = dir_2.open_workingtree() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
208 |
wt2.commit(message='rev 2-1', rev_id=b'2-1') |
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
209 |
wt2.merge_from_branch(br1) |
|
1185.16.96
by mbp at sourcefrog
More merge/fetch tests |
210 |
self._check_revs_present(br2) |
211 |
||
212 |
def _check_revs_present(self, br2): |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
213 |
for rev_id in [b'1-1', b'1-2', b'2-1']: |
|
1185.67.2
by Aaron Bentley
Renamed Branch.storage to Branch.repository |
214 |
self.assertTrue(br2.repository.has_revision(rev_id)) |
215 |
rev = br2.repository.get_revision(rev_id) |
|
|
1185.16.94
by mbp at sourcefrog
New test that merge fetches revisions from source |
216 |
self.assertEqual(rev.revision_id, rev_id) |
|
1185.67.2
by Aaron Bentley
Renamed Branch.storage to Branch.repository |
217 |
self.assertTrue(br2.repository.get_inventory(rev_id)) |
|
1185.16.94
by mbp at sourcefrog
New test that merge fetches revisions from source |
218 |
|
|
1185.16.96
by mbp at sourcefrog
More merge/fetch tests |
219 |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
220 |
class TestMergeFileHistory(TestCaseWithTransport): |
221 |
||
|
1185.16.96
by mbp at sourcefrog
More merge/fetch tests |
222 |
def setUp(self): |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
223 |
super(TestMergeFileHistory, self).setUp() |
224 |
wt1 = self.make_branch_and_tree('br1') |
|
225 |
br1 = wt1.branch |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
226 |
self.build_tree_contents([('br1/file', b'original contents\n')]) |
227 |
wt1.add('file', b'this-file-id') |
|
228 |
wt1.commit(message='rev 1-1', rev_id=b'1-1') |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
229 |
dir_2 = br1.controldir.sprout('br2') |
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
230 |
br2 = dir_2.open_branch() |
231 |
wt2 = dir_2.open_workingtree() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
232 |
self.build_tree_contents([('br1/file', b'original from 1\n')]) |
233 |
wt1.commit(message='rev 1-2', rev_id=b'1-2') |
|
234 |
self.build_tree_contents([('br1/file', b'agreement\n')]) |
|
235 |
wt1.commit(message='rev 1-3', rev_id=b'1-3') |
|
236 |
self.build_tree_contents([('br2/file', b'contents in 2\n')]) |
|
237 |
wt2.commit(message='rev 2-1', rev_id=b'2-1') |
|
238 |
self.build_tree_contents([('br2/file', b'agreement\n')]) |
|
239 |
wt2.commit(message='rev 2-2', rev_id=b'2-2') |
|
|
1185.16.96
by mbp at sourcefrog
More merge/fetch tests |
240 |
|
241 |
def test_merge_fetches_file_history(self): |
|
242 |
"""Merge brings across file histories""" |
|
243 |
br2 = Branch.open('br2') |
|
|
1551.15.70
by Aaron Bentley
Avoid using builtins.merge |
244 |
br1 = Branch.open('br1') |
245 |
wt2 = WorkingTree.open('br2').merge_from_branch(br1) |
|
|
3010.1.4
by Robert Collins
Make the knit specific fetch tests knit specific, and lock the branch when looking at historical texts in test_fetch. |
246 |
br2.lock_read() |
247 |
self.addCleanup(br2.unlock) |
|
|
6973.7.3
by Jelmer Vernooij
Fix some more tests. |
248 |
for rev_id, text in [(b'1-2', b'original from 1\n'), |
249 |
(b'1-3', b'agreement\n'), |
|
250 |
(b'2-1', b'contents in 2\n'), |
|
251 |
(b'2-2', b'agreement\n')]: |
|
|
1185.65.1
by Aaron Bentley
Refactored out ControlFiles and RevisionStore from _Branch |
252 |
self.assertEqualDiff( |
|
1185.67.2
by Aaron Bentley
Renamed Branch.storage to Branch.repository |
253 |
br2.repository.revision_tree( |
|
6809.4.5
by Jelmer Vernooij
Swap arguments for get_file_*. |
254 |
rev_id).get_file_text('file'), text) |
|
1185.16.96
by mbp at sourcefrog
More merge/fetch tests |
255 |
|
256 |
||
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
257 |
class TestKnitToPackFetch(TestCaseWithTransport): |
258 |
||
|
4098.4.3
by Robert Collins
Change fetch effort tests to reflect the new change to read the adjacent inventories to ensure accurate fetching. |
259 |
def find_get_record_stream(self, calls, expected_count=1): |
260 |
"""In a list of calls, find the last 'get_record_stream'. |
|
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
261 |
|
|
4098.4.3
by Robert Collins
Change fetch effort tests to reflect the new change to read the adjacent inventories to ensure accurate fetching. |
262 |
:param expected_count: The number of calls we should exepect to find.
|
263 |
If a different number is found, an assertion is raised.
|
|
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
264 |
"""
|
265 |
get_record_call = None |
|
|
4098.4.3
by Robert Collins
Change fetch effort tests to reflect the new change to read the adjacent inventories to ensure accurate fetching. |
266 |
call_count = 0 |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
267 |
for call in calls: |
268 |
if call[0] == 'get_record_stream': |
|
|
4098.4.3
by Robert Collins
Change fetch effort tests to reflect the new change to read the adjacent inventories to ensure accurate fetching. |
269 |
call_count += 1 |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
270 |
get_record_call = call |
|
4098.4.3
by Robert Collins
Change fetch effort tests to reflect the new change to read the adjacent inventories to ensure accurate fetching. |
271 |
self.assertEqual(expected_count, call_count) |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
272 |
return get_record_call |
273 |
||
274 |
def test_fetch_with_deltas_no_delta_closure(self): |
|
275 |
tree = self.make_branch_and_tree('source', format='dirstate') |
|
276 |
target = self.make_repository('target', format='pack-0.92') |
|
277 |
self.build_tree(['source/file']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
278 |
tree.set_root_id(b'root-id') |
279 |
tree.add('file', b'file-id') |
|
280 |
tree.commit('one', rev_id=b'rev-one') |
|
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
281 |
source = tree.branch.repository |
282 |
source.texts = versionedfile.RecordingVersionedFilesDecorator( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
283 |
source.texts) |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
284 |
source.signatures = versionedfile.RecordingVersionedFilesDecorator( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
285 |
source.signatures) |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
286 |
source.revisions = versionedfile.RecordingVersionedFilesDecorator( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
287 |
source.revisions) |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
288 |
source.inventories = versionedfile.RecordingVersionedFilesDecorator( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
289 |
source.inventories) |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
290 |
# precondition
|
|
4053.1.4
by Robert Collins
Move the fetch control attributes from Repository to RepositoryFormat. |
291 |
self.assertTrue(target._format._fetch_uses_deltas) |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
292 |
target.fetch(source, revision_id=b'rev-one') |
|
6973.12.3
by Jelmer Vernooij
Fixes. |
293 |
self.assertEqual(('get_record_stream', [(b'file-id', b'rev-one')], |
|
4053.1.4
by Robert Collins
Move the fetch control attributes from Repository to RepositoryFormat. |
294 |
target._format._fetch_order, False), |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
295 |
self.find_get_record_stream(source.texts.calls)) |
|
6973.12.3
by Jelmer Vernooij
Fixes. |
296 |
self.assertEqual(('get_record_stream', [(b'rev-one',)], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
297 |
target._format._fetch_order, False), |
298 |
self.find_get_record_stream(source.inventories.calls, 2)) |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
299 |
self.assertEqual(('get_record_stream', [(b'rev-one',)], |
|
4053.1.4
by Robert Collins
Move the fetch control attributes from Repository to RepositoryFormat. |
300 |
target._format._fetch_order, False), |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
301 |
self.find_get_record_stream(source.revisions.calls)) |
302 |
# XXX: Signatures is special, and slightly broken. The
|
|
303 |
# standard item_keys_introduced_by actually does a lookup for every
|
|
304 |
# signature to see if it exists, rather than waiting to do them all at
|
|
305 |
# once at the end. The fetch code then does an all-at-once and just
|
|
306 |
# allows for some of them to be missing.
|
|
307 |
# So we know there will be extra calls, but the *last* one is the one
|
|
308 |
# we care about.
|
|
309 |
signature_calls = source.signatures.calls[-1:] |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
310 |
self.assertEqual(('get_record_stream', [(b'rev-one',)], |
|
4053.1.4
by Robert Collins
Move the fetch control attributes from Repository to RepositoryFormat. |
311 |
target._format._fetch_order, False), |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
312 |
self.find_get_record_stream(signature_calls)) |
313 |
||
314 |
def test_fetch_no_deltas_with_delta_closure(self): |
|
315 |
tree = self.make_branch_and_tree('source', format='dirstate') |
|
316 |
target = self.make_repository('target', format='pack-0.92') |
|
317 |
self.build_tree(['source/file']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
318 |
tree.set_root_id(b'root-id') |
319 |
tree.add('file', b'file-id') |
|
320 |
tree.commit('one', rev_id=b'rev-one') |
|
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
321 |
source = tree.branch.repository |
322 |
source.texts = versionedfile.RecordingVersionedFilesDecorator( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
323 |
source.texts) |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
324 |
source.signatures = versionedfile.RecordingVersionedFilesDecorator( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
325 |
source.signatures) |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
326 |
source.revisions = versionedfile.RecordingVersionedFilesDecorator( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
327 |
source.revisions) |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
328 |
source.inventories = versionedfile.RecordingVersionedFilesDecorator( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
329 |
source.inventories) |
|
4053.1.4
by Robert Collins
Move the fetch control attributes from Repository to RepositoryFormat. |
330 |
# XXX: This won't work in general, but for the dirstate format it does.
|
|
4985.1.5
by Vincent Ladeuil
Deploying the new overrideAttr facility further reduces the complexity |
331 |
self.overrideAttr(target._format, '_fetch_uses_deltas', False) |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
332 |
target.fetch(source, revision_id=b'rev-one') |
|
6973.12.3
by Jelmer Vernooij
Fixes. |
333 |
self.assertEqual(('get_record_stream', [(b'file-id', b'rev-one')], |
|
4053.1.4
by Robert Collins
Move the fetch control attributes from Repository to RepositoryFormat. |
334 |
target._format._fetch_order, True), |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
335 |
self.find_get_record_stream(source.texts.calls)) |
|
6973.12.3
by Jelmer Vernooij
Fixes. |
336 |
self.assertEqual(('get_record_stream', [(b'rev-one',)], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
337 |
target._format._fetch_order, True), |
338 |
self.find_get_record_stream(source.inventories.calls, 2)) |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
339 |
self.assertEqual(('get_record_stream', [(b'rev-one',)], |
|
4053.1.4
by Robert Collins
Move the fetch control attributes from Repository to RepositoryFormat. |
340 |
target._format._fetch_order, True), |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
341 |
self.find_get_record_stream(source.revisions.calls)) |
342 |
# XXX: Signatures is special, and slightly broken. The
|
|
343 |
# standard item_keys_introduced_by actually does a lookup for every
|
|
344 |
# signature to see if it exists, rather than waiting to do them all at
|
|
345 |
# once at the end. The fetch code then does an all-at-once and just
|
|
346 |
# allows for some of them to be missing.
|
|
347 |
# So we know there will be extra calls, but the *last* one is the one
|
|
348 |
# we care about.
|
|
349 |
signature_calls = source.signatures.calls[-1:] |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
350 |
self.assertEqual(('get_record_stream', [(b'rev-one',)], |
|
4053.1.4
by Robert Collins
Move the fetch control attributes from Repository to RepositoryFormat. |
351 |
target._format._fetch_order, True), |
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
352 |
self.find_get_record_stream(signature_calls)) |
353 |
||
|
3849.3.1
by John Arbash Meinel
Part of bug #300289, stop requiring plain fulltexts for revisions. |
354 |
def test_fetch_revisions_with_deltas_into_pack(self): |
355 |
# See BUG #261339, dev versions of bzr could accidentally create deltas
|
|
356 |
# in revision texts in knit branches (when fetching from packs). So we
|
|
357 |
# ensure that *if* a knit repository has a delta in revisions, that it
|
|
358 |
# gets properly expanded back into a fulltext when stored in the pack
|
|
359 |
# file.
|
|
360 |
tree = self.make_branch_and_tree('source', format='dirstate') |
|
361 |
target = self.make_repository('target', format='pack-0.92') |
|
362 |
self.build_tree(['source/file']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
363 |
tree.set_root_id(b'root-id') |
364 |
tree.add('file', b'file-id') |
|
365 |
tree.commit('one', rev_id=b'rev-one') |
|
|
3849.3.1
by John Arbash Meinel
Part of bug #300289, stop requiring plain fulltexts for revisions. |
366 |
# Hack the KVF for revisions so that it "accidentally" allows a delta
|
367 |
tree.branch.repository.revisions._max_delta_chain = 200 |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
368 |
tree.commit('two', rev_id=b'rev-two') |
|
3849.3.1
by John Arbash Meinel
Part of bug #300289, stop requiring plain fulltexts for revisions. |
369 |
source = tree.branch.repository |
370 |
# Ensure that we stored a delta
|
|
371 |
source.lock_read() |
|
372 |
self.addCleanup(source.unlock) |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
373 |
record = next(source.revisions.get_record_stream([(b'rev-two',)], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
374 |
'unordered', False)) |
|
3849.3.1
by John Arbash Meinel
Part of bug #300289, stop requiring plain fulltexts for revisions. |
375 |
self.assertEqual('knit-delta-gz', record.storage_kind) |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
376 |
target.fetch(tree.branch.repository, revision_id=b'rev-two') |
|
3849.3.1
by John Arbash Meinel
Part of bug #300289, stop requiring plain fulltexts for revisions. |
377 |
# The record should get expanded back to a fulltext
|
378 |
target.lock_read() |
|
379 |
self.addCleanup(target.unlock) |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
380 |
record = next(target.revisions.get_record_stream([(b'rev-two',)], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
381 |
'unordered', False)) |
|
3849.3.1
by John Arbash Meinel
Part of bug #300289, stop requiring plain fulltexts for revisions. |
382 |
self.assertEqual('knit-ft-gz', record.storage_kind) |
383 |
||
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
384 |
def test_fetch_with_fallback_and_merge(self): |
385 |
builder = self.make_branch_builder('source', format='pack-0.92') |
|
386 |
builder.start_series() |
|
387 |
# graph
|
|
388 |
# A
|
|
389 |
# |\
|
|
390 |
# B C
|
|
391 |
# | |
|
|
392 |
# | D
|
|
393 |
# | |
|
|
394 |
# | E
|
|
395 |
# \|
|
|
396 |
# F
|
|
397 |
# A & B are present in the base (stacked-on) repository, A-E are
|
|
398 |
# present in the source.
|
|
|
3871.4.4
by John Arbash Meinel
Another fix for bug #304841. As a broad-spectrum solution, |
399 |
# This reproduces bug #304841
|
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
400 |
# We need a large enough inventory that total size of compressed deltas
|
401 |
# is shorter than the size of a compressed fulltext. We have to use
|
|
402 |
# random ids because otherwise the inventory fulltext compresses too
|
|
403 |
# well and the deltas get bigger.
|
|
404 |
to_add = [ |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
405 |
('add', ('', b'TREE_ROOT', 'directory', None))] |
|
6651.2.2
by Martin
Apply 2to3 xrange fix and fix up with sixish range |
406 |
for i in range(10): |
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
407 |
fname = 'file%03d' % (i,) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
408 |
fileid = ('%s-%s' % |
409 |
(fname, osutils.rand_chars(64))).encode('ascii') |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
410 |
to_add.append(('add', (fname, fileid, 'file', b'content\n'))) |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
411 |
builder.build_snapshot(None, to_add, revision_id=b'A') |
|
6973.12.3
by Jelmer Vernooij
Fixes. |
412 |
builder.build_snapshot([b'A'], [], revision_id=b'B') |
413 |
builder.build_snapshot([b'A'], [], revision_id=b'C') |
|
414 |
builder.build_snapshot([b'C'], [], revision_id=b'D') |
|
415 |
builder.build_snapshot([b'D'], [], revision_id=b'E') |
|
416 |
builder.build_snapshot([b'E', b'B'], [], revision_id=b'F') |
|
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
417 |
builder.finish_series() |
418 |
source_branch = builder.get_branch() |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
419 |
source_branch.controldir.sprout('base', revision_id=b'B') |
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
420 |
target_branch = self.make_branch('target', format='1.6') |
421 |
target_branch.set_stacked_on_url('../base') |
|
422 |
source = source_branch.repository |
|
423 |
source.lock_read() |
|
424 |
self.addCleanup(source.unlock) |
|
425 |
source.inventories = versionedfile.OrderingVersionedFilesDecorator( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
426 |
source.inventories, |
427 |
key_priority={(b'E',): 1, (b'D',): 2, (b'C',): 4, |
|
428 |
(b'F',): 3}) |
|
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
429 |
# Ensure that the content is yielded in the proper order, and given as
|
430 |
# the expected kinds
|
|
431 |
records = [(record.key, record.storage_kind) |
|
432 |
for record in source.inventories.get_record_stream( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
433 |
[(b'D',), (b'C',), (b'E',), (b'F',)], 'unordered', False)] |
|
6973.12.3
by Jelmer Vernooij
Fixes. |
434 |
self.assertEqual([((b'E',), 'knit-delta-gz'), ((b'D',), 'knit-delta-gz'), |
435 |
((b'F',), 'knit-delta-gz'), ((b'C',), 'knit-delta-gz')], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
436 |
records) |
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
437 |
|
438 |
target_branch.lock_write() |
|
439 |
self.addCleanup(target_branch.unlock) |
|
440 |
target = target_branch.repository |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
441 |
target.fetch(source, revision_id=b'F') |
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
442 |
# 'C' should be expanded to a fulltext, but D and E should still be
|
443 |
# deltas
|
|
444 |
stream = target.inventories.get_record_stream( |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
445 |
[(b'C',), (b'D',), (b'E',), (b'F',)], |
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
446 |
'unordered', False) |
447 |
kinds = dict((record.key, record.storage_kind) for record in stream) |
|
|
6973.12.3
by Jelmer Vernooij
Fixes. |
448 |
self.assertEqual({(b'C',): 'knit-ft-gz', (b'D',): 'knit-delta-gz', |
449 |
(b'E',): 'knit-delta-gz', (b'F',): 'knit-delta-gz'}, |
|
|
3871.4.2
by John Arbash Meinel
Finally a test case that reproduces bug #304841 |
450 |
kinds) |
|
3849.3.1
by John Arbash Meinel
Part of bug #300289, stop requiring plain fulltexts for revisions. |
451 |
|
|
3606.7.7
by John Arbash Meinel
Add tests for the fetching behavior. |
452 |
|
|
3380.1.1
by Aaron Bentley
Fix inventory insertion to work in topological order |
453 |
class Test1To2Fetch(TestCaseWithTransport): |
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
454 |
"""Tests for Model1To2 failure modes""" |
|
3380.1.1
by Aaron Bentley
Fix inventory insertion to work in topological order |
455 |
|
|
3380.2.4
by Aaron Bentley
Updates from review |
456 |
def make_tree_and_repo(self): |
457 |
self.tree = self.make_branch_and_tree('tree', format='pack-0.92') |
|
458 |
self.repo = self.make_repository('rich-repo', format='rich-root-pack') |
|
459 |
self.repo.lock_write() |
|
460 |
self.addCleanup(self.repo.unlock) |
|
461 |
||
462 |
def do_fetch_order_test(self, first, second): |
|
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
463 |
"""Test that fetch works no matter what the set order of revision is. |
|
3380.1.1
by Aaron Bentley
Fix inventory insertion to work in topological order |
464 |
|
465 |
This test depends on the order of items in a set, which is
|
|
466 |
implementation-dependant, so we test A, B and then B, A.
|
|
467 |
"""
|
|
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
468 |
self.make_tree_and_repo() |
469 |
self.tree.commit('Commit 1', rev_id=first) |
|
470 |
self.tree.commit('Commit 2', rev_id=second) |
|
471 |
self.repo.fetch(self.tree.branch.repository, second) |
|
472 |
||
|
3380.2.4
by Aaron Bentley
Updates from review |
473 |
def test_fetch_order_AB(self): |
|
3380.2.7
by Aaron Bentley
Update docs |
474 |
"""See do_fetch_order_test""" |
|
6973.12.3
by Jelmer Vernooij
Fixes. |
475 |
self.do_fetch_order_test(b'A', b'B') |
|
3380.2.4
by Aaron Bentley
Updates from review |
476 |
|
477 |
def test_fetch_order_BA(self): |
|
|
3380.2.7
by Aaron Bentley
Update docs |
478 |
"""See do_fetch_order_test""" |
|
6973.12.3
by Jelmer Vernooij
Fixes. |
479 |
self.do_fetch_order_test(b'B', b'A') |
|
3380.2.4
by Aaron Bentley
Updates from review |
480 |
|
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
481 |
def get_parents(self, file_id, revision_id): |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
482 |
self.repo.lock_read() |
483 |
try: |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
484 |
parent_map = self.repo.texts.get_parent_map( |
485 |
[(file_id, revision_id)]) |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
486 |
return parent_map[(file_id, revision_id)] |
487 |
finally: |
|
488 |
self.repo.unlock() |
|
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
489 |
|
|
3380.1.2
by Aaron Bentley
Improve handling ghosts and changing root_ids |
490 |
def test_fetch_ghosts(self): |
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
491 |
self.make_tree_and_repo() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
492 |
self.tree.commit('first commit', rev_id=b'left-parent') |
|
6973.10.4
by Jelmer Vernooij
Update python3.passing. |
493 |
self.tree.add_parent_tree_id(b'ghost-parent') |
494 |
fork = self.tree.controldir.sprout('fork', b'null:').open_workingtree() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
495 |
fork.commit('not a ghost', rev_id=b'not-ghost-parent') |
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
496 |
self.tree.branch.repository.fetch(fork.branch.repository, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
497 |
b'not-ghost-parent') |
|
6973.10.4
by Jelmer Vernooij
Update python3.passing. |
498 |
self.tree.add_parent_tree_id(b'not-ghost-parent') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
499 |
self.tree.commit('second commit', rev_id=b'second-id') |
|
6973.10.4
by Jelmer Vernooij
Update python3.passing. |
500 |
self.repo.fetch(self.tree.branch.repository, b'second-id') |
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
501 |
root_id = self.tree.get_root_id() |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
502 |
self.assertEqual( |
|
6973.10.4
by Jelmer Vernooij
Update python3.passing. |
503 |
((root_id, b'left-parent'), (root_id, b'not-ghost-parent')), |
504 |
self.get_parents(root_id, b'second-id')) |
|
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
505 |
|
506 |
def make_two_commits(self, change_root, fetch_twice): |
|
507 |
self.make_tree_and_repo() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
508 |
self.tree.commit('first commit', rev_id=b'first-id') |
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
509 |
if change_root: |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
510 |
self.tree.set_root_id(b'unique-id') |
511 |
self.tree.commit('second commit', rev_id=b'second-id') |
|
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
512 |
if fetch_twice: |
|
6973.10.4
by Jelmer Vernooij
Update python3.passing. |
513 |
self.repo.fetch(self.tree.branch.repository, b'first-id') |
514 |
self.repo.fetch(self.tree.branch.repository, b'second-id') |
|
|
3380.1.2
by Aaron Bentley
Improve handling ghosts and changing root_ids |
515 |
|
516 |
def test_fetch_changed_root(self): |
|
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
517 |
self.make_two_commits(change_root=True, fetch_twice=False) |
|
6973.10.4
by Jelmer Vernooij
Update python3.passing. |
518 |
self.assertEqual((), self.get_parents(b'unique-id', b'second-id')) |
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
519 |
|
520 |
def test_two_fetch_changed_root(self): |
|
521 |
self.make_two_commits(change_root=True, fetch_twice=True) |
|
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
522 |
self.assertEqual((), self.get_parents(b'unique-id', b'second-id')) |
|
3380.1.3
by Aaron Bentley
Fix model-change fetching with ghosts and when fetch is resumed |
523 |
|
524 |
def test_two_fetches(self): |
|
525 |
self.make_two_commits(change_root=False, fetch_twice=True) |
|
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
526 |
self.assertEqual(((b'TREE_ROOT', b'first-id'),), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
527 |
self.get_parents(b'TREE_ROOT', b'second-id')) |