bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
4988.10.5
by John Arbash Meinel
Merge bzr.dev 5021 to resolve NEWS |
1 |
# Copyright (C) 2005-2010 Canonical Ltd
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
|
1540.1.7
by John Arbash Meinel
Added copyright statement to test_fileid_involved, and minor pep8 cleanup. |
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 |
#
|
|
1540.1.7
by John Arbash Meinel
Added copyright statement to test_fileid_involved, and minor pep8 cleanup. |
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 |
#
|
|
1540.1.7
by John Arbash Meinel
Added copyright statement to test_fileid_involved, and minor pep8 cleanup. |
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.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
16 |
|
|
1711.7.29
by John Arbash Meinel
Switch to using TestSkipped for fileid_involved tests. |
17 |
import sys |
|
4343.3.23
by John Arbash Meinel
Change RepositoryCHK1.fileids_altered_by to handle ghosts the way XML does. |
18 |
import time |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
19 |
|
|
4343.3.23
by John Arbash Meinel
Change RepositoryCHK1.fileids_altered_by to handle ghosts the way XML does. |
20 |
from bzrlib import ( |
|
4634.35.16
by Andrew Bennetts
Fix more test fallout. |
21 |
errors, |
|
4634.35.22
by Andrew Bennetts
Use monkey patching to avoid skipping (mostly) tests that try to create damaged repos on 2a. |
22 |
remote, |
|
4343.3.23
by John Arbash Meinel
Change RepositoryCHK1.fileids_altered_by to handle ghosts the way XML does. |
23 |
revision as _mod_revision, |
|
4343.3.24
by John Arbash Meinel
Add a test that file_ids goes to fallbacks appropriately. |
24 |
tests, |
|
5010.2.25
by Vincent Ladeuil
Fix imports in per_repository/test_fileid_involved.py. |
25 |
transform, |
|
4343.3.23
by John Arbash Meinel
Change RepositoryCHK1.fileids_altered_by to handle ghosts the way XML does. |
26 |
)
|
|
5010.2.25
by Vincent Ladeuil
Fix imports in per_repository/test_fileid_involved.py. |
27 |
from bzrlib.tests import per_repository |
28 |
||
29 |
||
30 |
class FileIdInvolvedBase(per_repository.TestCaseWithRepository): |
|
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
31 |
|
|
2018.5.96
by Andrew Bennetts
Merge from bzr.dev, resolving the worst of the semantic conflicts, but there's |
32 |
def touch(self, tree, filename): |
|
2381.1.3
by Robert Collins
Review feedback. |
33 |
# use the trees transport to not depend on the tree's location or type.
|
|
2018.5.96
by Andrew Bennetts
Merge from bzr.dev, resolving the worst of the semantic conflicts, but there's |
34 |
tree.bzrdir.root_transport.append_bytes(filename, "appended line\n") |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
35 |
|
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
36 |
def compare_tree_fileids(self, branch, old_rev, new_rev): |
37 |
old_tree = self.branch.repository.revision_tree(old_rev) |
|
38 |
new_tree = self.branch.repository.revision_tree(new_rev) |
|
|
1852.10.3
by Robert Collins
Remove all uses of compare_trees and replace with Tree.changes_from throughout bzrlib. |
39 |
delta = new_tree.changes_from(old_tree) |
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
40 |
|
41 |
l2 = [id for path, id, kind in delta.added] + \ |
|
42 |
[id for oldpath, newpath, id, kind, text_modified, \ |
|
43 |
meta_modified in delta.renamed] + \ |
|
44 |
[id for path, id, kind, text_modified, meta_modified in \ |
|
45 |
delta.modified] |
|
46 |
return set(l2) |
|
47 |
||
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
48 |
|
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
49 |
class TestFileIdInvolved(FileIdInvolvedBase): |
50 |
||
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
51 |
def setUp(self): |
|
1185.64.9
by Goffredo Baroncelli
renamed test_file_involved -> test_fileid_involved |
52 |
super(TestFileIdInvolved, self).setUp() |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
53 |
# create three branches, and merge it
|
54 |
#
|
|
|
4343.3.23
by John Arbash Meinel
Change RepositoryCHK1.fileids_altered_by to handle ghosts the way XML does. |
55 |
# ,-->J------>K (branch2)
|
56 |
# / \
|
|
57 |
# A --->B --->C---->D-->G (main)
|
|
58 |
# \ / /
|
|
59 |
# '--->E---+---->F (branch1)
|
|
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
60 |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
61 |
# A changes:
|
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
62 |
# B changes: 'a-file-id-2006-01-01-abcd'
|
63 |
# C changes: Nothing (perfect merge)
|
|
64 |
# D changes: 'b-file-id-2006-01-01-defg'
|
|
65 |
# E changes: 'file-d'
|
|
66 |
# F changes: 'file-d'
|
|
67 |
# G changes: 'b-file-id-2006-01-01-defg'
|
|
68 |
# J changes: 'b-file-id-2006-01-01-defg'
|
|
|
2670.1.1
by Robert Collins
Remove the use of file_ids with spaces in the fileid_involved tests. |
69 |
# K changes: 'c-funky<file-id>quiji%bo'
|
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
70 |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
71 |
main_wt = self.make_branch_and_tree('main') |
72 |
main_branch = main_wt.branch |
|
|
2381.1.3
by Robert Collins
Review feedback. |
73 |
self.build_tree(["main/a","main/b","main/c"]) |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
74 |
|
75 |
main_wt.add(['a', 'b', 'c'], ['a-file-id-2006-01-01-abcd', |
|
|
1540.1.6
by John Arbash Meinel
fileid_involved needs to unescape the file id and revision id |
76 |
'b-file-id-2006-01-01-defg', |
|
2670.1.1
by Robert Collins
Remove the use of file_ids with spaces in the fileid_involved tests. |
77 |
'c-funky<file-id>quiji%bo']) |
|
1551.2.55
by abentley
Fix fileid involed tests on win32 (by skipping them for unescaped weave formats) |
78 |
try: |
79 |
main_wt.commit("Commit one", rev_id="rev-A") |
|
|
5010.2.25
by Vincent Ladeuil
Fix imports in per_repository/test_fileid_involved.py. |
80 |
except errors.IllegalPath: |
|
1711.7.29
by John Arbash Meinel
Switch to using TestSkipped for fileid_involved tests. |
81 |
# TODO: jam 20060701 Consider raising a different exception
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
82 |
# newer formats do support this, and nothin can done to
|
|
1711.7.29
by John Arbash Meinel
Switch to using TestSkipped for fileid_involved tests. |
83 |
# correct this test - its not a bug.
|
84 |
if sys.platform == 'win32': |
|
|
5010.2.25
by Vincent Ladeuil
Fix imports in per_repository/test_fileid_involved.py. |
85 |
raise tests.TestSkipped('Old repository formats do not' |
86 |
' support file ids with <> on win32') |
|
|
1711.7.29
by John Arbash Meinel
Switch to using TestSkipped for fileid_involved tests. |
87 |
# This is not a known error condition
|
88 |
raise
|
|
89 |
||
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
90 |
#-------- end A -----------
|
91 |
||
|
2018.14.1
by Andrew Bennetts
Update to current hpss branch? Fix lots of test failures. |
92 |
bt1 = self.make_branch_and_tree('branch1') |
93 |
bt1.pull(main_branch) |
|
94 |
b1 = bt1.branch |
|
|
2381.1.3
by Robert Collins
Review feedback. |
95 |
self.build_tree(["branch1/d"]) |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
96 |
bt1.add(['d'], ['file-d']) |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
97 |
bt1.commit("branch1, Commit one", rev_id="rev-E") |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
98 |
|
99 |
#-------- end E -----------
|
|
100 |
||
|
2018.5.96
by Andrew Bennetts
Merge from bzr.dev, resolving the worst of the semantic conflicts, but there's |
101 |
self.touch(main_wt, "a") |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
102 |
main_wt.commit("Commit two", rev_id="rev-B") |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
103 |
|
104 |
#-------- end B -----------
|
|
105 |
||
|
2018.14.1
by Andrew Bennetts
Update to current hpss branch? Fix lots of test failures. |
106 |
bt2 = self.make_branch_and_tree('branch2') |
107 |
bt2.pull(main_branch) |
|
108 |
branch2_branch = bt2.branch |
|
|
1711.7.4
by John Arbash Meinel
Fix test_fileid_involved so it uses TreeTransform to set the executable bits rather than chmod() |
109 |
set_executability(bt2, 'b', True) |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
110 |
bt2.commit("branch2, Commit one", rev_id="rev-J") |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
111 |
|
112 |
#-------- end J -----------
|
|
113 |
||
|
1979.2.1
by Robert Collins
(robertc) adds a convenience method "merge_from_branch" to WorkingTree. |
114 |
main_wt.merge_from_branch(b1) |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
115 |
main_wt.commit("merge branch1, rev-11", rev_id="rev-C") |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
116 |
|
117 |
#-------- end C -----------
|
|
118 |
||
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
119 |
bt1.rename_one("d","e") |
120 |
bt1.commit("branch1, commit two", rev_id="rev-F") |
|
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
121 |
|
122 |
#-------- end F -----------
|
|
123 |
||
|
2018.5.96
by Andrew Bennetts
Merge from bzr.dev, resolving the worst of the semantic conflicts, but there's |
124 |
self.touch(bt2, "c") |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
125 |
bt2.commit("branch2, commit two", rev_id="rev-K") |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
126 |
|
127 |
#-------- end K -----------
|
|
128 |
||
|
1979.2.1
by Robert Collins
(robertc) adds a convenience method "merge_from_branch" to WorkingTree. |
129 |
main_wt.merge_from_branch(b1) |
|
2018.5.96
by Andrew Bennetts
Merge from bzr.dev, resolving the worst of the semantic conflicts, but there's |
130 |
self.touch(main_wt, "b") |
|
1540.1.6
by John Arbash Meinel
fileid_involved needs to unescape the file id and revision id |
131 |
# D gets some funky characters to make sure the unescaping works
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
132 |
main_wt.commit("merge branch1, rev-12", rev_id="rev-<D>") |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
133 |
|
134 |
# end D
|
|
135 |
||
|
1979.2.1
by Robert Collins
(robertc) adds a convenience method "merge_from_branch" to WorkingTree. |
136 |
main_wt.merge_from_branch(branch2_branch) |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
137 |
main_wt.commit("merge branch1, rev-22", rev_id="rev-G") |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
138 |
|
139 |
# end G
|
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
140 |
self.branch = main_branch |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
141 |
|
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
142 |
def test_fileids_altered_between_two_revs(self): |
|
2592.3.214
by Robert Collins
Merge bzr.dev. |
143 |
self.branch.lock_read() |
144 |
self.addCleanup(self.branch.unlock) |
|
|
4098.4.2
by Robert Collins
Weaves were reporting way too many lines altered... fix so that the fetch changes actually emit the right revisions and tests pass. |
145 |
self.branch.repository.fileids_altered_by_revision_ids(["rev-J","rev-K"]) |
|
1711.7.16
by John Arbash Meinel
remove assertDictsEqual |
146 |
self.assertEqual( |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
147 |
{'b-file-id-2006-01-01-defg':set(['rev-J']), |
|
2670.1.1
by Robert Collins
Remove the use of file_ids with spaces in the fileid_involved tests. |
148 |
'c-funky<file-id>quiji%bo':set(['rev-K']) |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
149 |
},
|
150 |
self.branch.repository.fileids_altered_by_revision_ids(["rev-J","rev-K"])) |
|
151 |
||
|
1711.7.16
by John Arbash Meinel
remove assertDictsEqual |
152 |
self.assertEqual( |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
153 |
{'b-file-id-2006-01-01-defg': set(['rev-<D>']), |
154 |
'file-d': set(['rev-F']), |
|
155 |
},
|
|
156 |
self.branch.repository.fileids_altered_by_revision_ids(['rev-<D>', 'rev-F'])) |
|
157 |
||
|
1711.7.16
by John Arbash Meinel
remove assertDictsEqual |
158 |
self.assertEqual( |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
159 |
{
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
160 |
'b-file-id-2006-01-01-defg': set(['rev-<D>', 'rev-G', 'rev-J']), |
|
2670.1.1
by Robert Collins
Remove the use of file_ids with spaces in the fileid_involved tests. |
161 |
'c-funky<file-id>quiji%bo': set(['rev-K']), |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
162 |
'file-d': set(['rev-F']), |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
163 |
},
|
164 |
self.branch.repository.fileids_altered_by_revision_ids( |
|
165 |
['rev-<D>', 'rev-G', 'rev-F', 'rev-K', 'rev-J'])) |
|
166 |
||
|
1711.7.16
by John Arbash Meinel
remove assertDictsEqual |
167 |
self.assertEqual( |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
168 |
{'a-file-id-2006-01-01-abcd': set(['rev-B']), |
169 |
'b-file-id-2006-01-01-defg': set(['rev-<D>', 'rev-G', 'rev-J']), |
|
|
2670.1.1
by Robert Collins
Remove the use of file_ids with spaces in the fileid_involved tests. |
170 |
'c-funky<file-id>quiji%bo': set(['rev-K']), |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
171 |
'file-d': set(['rev-F']), |
172 |
},
|
|
173 |
self.branch.repository.fileids_altered_by_revision_ids( |
|
174 |
['rev-G', 'rev-F', 'rev-C', 'rev-B', 'rev-<D>', 'rev-K', 'rev-J'])) |
|
175 |
||
|
1910.2.24
by Aaron Bentley
Got intra-repository fetch working between model1 and 2 for all types |
176 |
def fileids_altered_by_revision_ids(self, revision_ids): |
177 |
"""This is a wrapper to strip TREE_ROOT if it occurs""" |
|
178 |
repo = self.branch.repository |
|
|
2946.3.3
by John Arbash Meinel
Prefer tree.get_root_id() as more explicit than tree.path2id('') |
179 |
root_id = self.branch.basis_tree().get_root_id() |
|
1910.2.24
by Aaron Bentley
Got intra-repository fetch working between model1 and 2 for all types |
180 |
result = repo.fileids_altered_by_revision_ids(revision_ids) |
|
1731.1.49
by Aaron Bentley
Merge bzr.dev |
181 |
if root_id in result: |
182 |
del result[root_id] |
|
|
1910.2.24
by Aaron Bentley
Got intra-repository fetch working between model1 and 2 for all types |
183 |
return result |
184 |
||
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
185 |
def test_fileids_altered_by_revision_ids(self): |
|
2592.3.214
by Robert Collins
Merge bzr.dev. |
186 |
self.branch.lock_read() |
187 |
self.addCleanup(self.branch.unlock) |
|
|
1711.7.16
by John Arbash Meinel
remove assertDictsEqual |
188 |
self.assertEqual( |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
189 |
{'a-file-id-2006-01-01-abcd':set(['rev-A']), |
190 |
'b-file-id-2006-01-01-defg': set(['rev-A']), |
|
|
2670.1.1
by Robert Collins
Remove the use of file_ids with spaces in the fileid_involved tests. |
191 |
'c-funky<file-id>quiji%bo': set(['rev-A']), |
|
2592.3.214
by Robert Collins
Merge bzr.dev. |
192 |
},
|
|
1910.2.24
by Aaron Bentley
Got intra-repository fetch working between model1 and 2 for all types |
193 |
self.fileids_altered_by_revision_ids(["rev-A"])) |
|
1711.7.16
by John Arbash Meinel
remove assertDictsEqual |
194 |
self.assertEqual( |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
195 |
{'a-file-id-2006-01-01-abcd':set(['rev-B']) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
196 |
},
|
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
197 |
self.branch.repository.fileids_altered_by_revision_ids(["rev-B"])) |
|
1711.7.16
by John Arbash Meinel
remove assertDictsEqual |
198 |
self.assertEqual( |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
199 |
{'b-file-id-2006-01-01-defg':set(['rev-<D>']) |
200 |
},
|
|
201 |
self.branch.repository.fileids_altered_by_revision_ids(["rev-<D>"])) |
|
202 |
||
203 |
def test_fileids_involved_full_compare(self): |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
204 |
# this tests that the result of each fileid_involved calculation
|
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
205 |
# along a revision history selects only the fileids selected by
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
206 |
# comparing the trees - no less, and no more. This is correct
|
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
207 |
# because in our sample data we do not revert any file ids along
|
208 |
# the revision history.
|
|
|
2592.3.214
by Robert Collins
Merge bzr.dev. |
209 |
self.branch.lock_read() |
210 |
self.addCleanup(self.branch.unlock) |
|
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
211 |
pp=[] |
212 |
history = self.branch.revision_history( ) |
|
213 |
||
214 |
if len(history) < 2: return |
|
215 |
||
216 |
for start in range(0,len(history)-1): |
|
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
217 |
start_id = history[start] |
|
1185.64.7
by Goffredo Baroncelli
added test for function fileid_involved |
218 |
for end in range(start+1,len(history)): |
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
219 |
end_id = history[end] |
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
220 |
old_revs = set(self.branch.repository.get_ancestry(start_id)) |
221 |
new_revs = set(self.branch.repository.get_ancestry(end_id)) |
|
222 |
l1 = self.branch.repository.fileids_altered_by_revision_ids( |
|
223 |
new_revs.difference(old_revs)) |
|
224 |
l1 = set(l1.keys()) |
|
225 |
||
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
226 |
l2 = self.compare_tree_fileids(self.branch, start_id, end_id) |
227 |
self.assertEquals(l1, l2) |
|
228 |
||
229 |
||
|
2294.1.2
by John Arbash Meinel
Track down and add tests that all tree.commit() can handle |
230 |
class TestFileIdInvolvedNonAscii(FileIdInvolvedBase): |
231 |
||
232 |
def test_utf8_file_ids_and_revision_ids(self): |
|
233 |
main_wt = self.make_branch_and_tree('main') |
|
234 |
main_branch = main_wt.branch |
|
|
2381.1.3
by Robert Collins
Review feedback. |
235 |
self.build_tree(["main/a"]) |
|
2294.1.2
by John Arbash Meinel
Track down and add tests that all tree.commit() can handle |
236 |
|
|
2294.1.10
by John Arbash Meinel
Switch all apis over to utf8 file ids. All tests pass |
237 |
file_id = u'a-f\xedle-id'.encode('utf8') |
|
2294.1.2
by John Arbash Meinel
Track down and add tests that all tree.commit() can handle |
238 |
main_wt.add(['a'], [file_id]) |
239 |
revision_id = u'r\xe9v-a'.encode('utf8') |
|
240 |
try: |
|
241 |
main_wt.commit('a', rev_id=revision_id) |
|
|
5010.2.25
by Vincent Ladeuil
Fix imports in per_repository/test_fileid_involved.py. |
242 |
except errors.NonAsciiRevisionId: |
243 |
raise tests.TestSkipped('non-ascii revision ids not supported by %s' |
|
244 |
% self.repository_format) |
|
|
2294.1.2
by John Arbash Meinel
Track down and add tests that all tree.commit() can handle |
245 |
|
246 |
repo = main_wt.branch.repository |
|
|
2592.3.214
by Robert Collins
Merge bzr.dev. |
247 |
repo.lock_read() |
248 |
self.addCleanup(repo.unlock) |
|
|
2294.1.2
by John Arbash Meinel
Track down and add tests that all tree.commit() can handle |
249 |
file_ids = repo.fileids_altered_by_revision_ids([revision_id]) |
|
2946.3.3
by John Arbash Meinel
Prefer tree.get_root_id() as more explicit than tree.path2id('') |
250 |
root_id = main_wt.basis_tree().get_root_id() |
|
2294.1.2
by John Arbash Meinel
Track down and add tests that all tree.commit() can handle |
251 |
if root_id in file_ids: |
252 |
self.assertEqual({file_id:set([revision_id]), |
|
253 |
root_id:set([revision_id]) |
|
254 |
}, file_ids) |
|
255 |
else: |
|
256 |
self.assertEqual({file_id:set([revision_id])}, file_ids) |
|
257 |
||
258 |
||
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
259 |
class TestFileIdInvolvedSuperset(FileIdInvolvedBase): |
260 |
||
261 |
def setUp(self): |
|
262 |
super(TestFileIdInvolvedSuperset, self).setUp() |
|
263 |
||
|
1711.7.4
by John Arbash Meinel
Fix test_fileid_involved so it uses TreeTransform to set the executable bits rather than chmod() |
264 |
self.branch = None |
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
265 |
main_wt = self.make_branch_and_tree('main') |
266 |
main_branch = main_wt.branch |
|
|
2381.1.3
by Robert Collins
Review feedback. |
267 |
self.build_tree(["main/a","main/b","main/c"]) |
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
268 |
|
269 |
main_wt.add(['a', 'b', 'c'], ['a-file-id-2006-01-01-abcd', |
|
270 |
'b-file-id-2006-01-01-defg', |
|
|
2670.1.1
by Robert Collins
Remove the use of file_ids with spaces in the fileid_involved tests. |
271 |
'c-funky<file-id>quiji\'"%bo']) |
|
1551.2.55
by abentley
Fix fileid involed tests on win32 (by skipping them for unescaped weave formats) |
272 |
try: |
273 |
main_wt.commit("Commit one", rev_id="rev-A") |
|
|
5010.2.25
by Vincent Ladeuil
Fix imports in per_repository/test_fileid_involved.py. |
274 |
except errors.IllegalPath: |
|
1711.7.29
by John Arbash Meinel
Switch to using TestSkipped for fileid_involved tests. |
275 |
# TODO: jam 20060701 Consider raising a different exception
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
276 |
# newer formats do support this, and nothin can done to
|
|
1711.7.29
by John Arbash Meinel
Switch to using TestSkipped for fileid_involved tests. |
277 |
# correct this test - its not a bug.
|
278 |
if sys.platform == 'win32': |
|
|
5010.2.25
by Vincent Ladeuil
Fix imports in per_repository/test_fileid_involved.py. |
279 |
raise tests.TestSkipped('Old repository formats do not' |
280 |
' support file ids with <> on win32') |
|
|
1711.7.29
by John Arbash Meinel
Switch to using TestSkipped for fileid_involved tests. |
281 |
# This is not a known error condition
|
282 |
raise
|
|
|
1910.2.29
by Aaron Bentley
Fix up sprout, nuke workaround |
283 |
|
|
2018.14.1
by Andrew Bennetts
Update to current hpss branch? Fix lots of test failures. |
284 |
branch2_wt = self.make_branch_and_tree('branch2') |
285 |
branch2_wt.pull(main_branch) |
|
286 |
branch2_bzrdir = branch2_wt.bzrdir |
|
|
1534.5.3
by Robert Collins
Make format 4/5/6 branches share a single LockableFiles instance across wt/branch/repository. |
287 |
branch2_branch = branch2_bzrdir.open_branch() |
|
1711.7.4
by John Arbash Meinel
Fix test_fileid_involved so it uses TreeTransform to set the executable bits rather than chmod() |
288 |
set_executability(branch2_wt, 'b', True) |
|
1534.5.3
by Robert Collins
Make format 4/5/6 branches share a single LockableFiles instance across wt/branch/repository. |
289 |
branch2_wt.commit("branch2, Commit one", rev_id="rev-J") |
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
290 |
|
|
1979.2.1
by Robert Collins
(robertc) adds a convenience method "merge_from_branch" to WorkingTree. |
291 |
main_wt.merge_from_branch(branch2_branch) |
|
1711.7.15
by John Arbash Meinel
Properly handle the case when you want to turn off executability. |
292 |
set_executability(main_wt, 'b', False) |
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
293 |
main_wt.commit("merge branch1, rev-22", rev_id="rev-G") |
294 |
||
295 |
# end G
|
|
296 |
self.branch = main_branch |
|
297 |
||
298 |
def test_fileid_involved_full_compare2(self): |
|
|
4343.3.24
by John Arbash Meinel
Add a test that file_ids goes to fallbacks appropriately. |
299 |
# this tests that fileids_altered_by_revision_ids returns
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
300 |
# more information than compare_tree can, because it
|
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
301 |
# sees each change rather than the aggregate delta.
|
|
2592.3.214
by Robert Collins
Merge bzr.dev. |
302 |
self.branch.lock_read() |
303 |
self.addCleanup(self.branch.unlock) |
|
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
304 |
history = self.branch.revision_history() |
305 |
old_rev = history[0] |
|
306 |
new_rev = history[1] |
|
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
307 |
old_revs = set(self.branch.repository.get_ancestry(old_rev)) |
308 |
new_revs = set(self.branch.repository.get_ancestry(new_rev)) |
|
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
309 |
|
|
1694.2.6
by Martin Pool
[merge] bzr.dev |
310 |
l1 = self.branch.repository.fileids_altered_by_revision_ids( |
311 |
new_revs.difference(old_revs)) |
|
312 |
l1 = set(l1.keys()) |
|
|
1551.2.7
by Aaron Bentley
Test case for discrepancy between fileid_involved and compare_tree [recommit] |
313 |
|
314 |
l2 = self.compare_tree_fileids(self.branch, old_rev, new_rev) |
|
315 |
self.assertNotEqual(l2, l1) |
|
|
1553.5.28
by Martin Pool
[merge] from bzr.dev before integration |
316 |
self.assertSubset(l2, l1) |
|
1711.7.4
by John Arbash Meinel
Fix test_fileid_involved so it uses TreeTransform to set the executable bits rather than chmod() |
317 |
|
318 |
||
|
5010.2.25
by Vincent Ladeuil
Fix imports in per_repository/test_fileid_involved.py. |
319 |
class FileIdInvolvedWGhosts(per_repository.TestCaseWithRepository): |
|
4343.3.23
by John Arbash Meinel
Change RepositoryCHK1.fileids_altered_by to handle ghosts the way XML does. |
320 |
|
321 |
def create_branch_with_ghost_text(self): |
|
322 |
builder = self.make_branch_builder('ghost') |
|
323 |
builder.build_snapshot('A-id', None, [ |
|
324 |
('add', ('', 'root-id', 'directory', None)), |
|
325 |
('add', ('a', 'a-file-id', 'file', 'some content\n'))]) |
|
326 |
b = builder.get_branch() |
|
327 |
old_rt = b.repository.revision_tree('A-id') |
|
328 |
new_inv = old_rt.inventory._get_mutable_inventory() |
|
329 |
new_inv.revision_id = 'B-id' |
|
330 |
new_inv['a-file-id'].revision = 'ghost-id' |
|
331 |
new_rev = _mod_revision.Revision('B-id', |
|
332 |
timestamp=time.time(), |
|
333 |
timezone=0, |
|
334 |
message='Committing against a ghost', |
|
335 |
committer='Joe Foo <joe@foo.com>', |
|
336 |
properties={}, |
|
337 |
parent_ids=('A-id', 'ghost-id'), |
|
338 |
)
|
|
339 |
b.lock_write() |
|
340 |
self.addCleanup(b.unlock) |
|
341 |
b.repository.start_write_group() |
|
342 |
b.repository.add_revision('B-id', new_rev, new_inv) |
|
|
4634.35.22
by Andrew Bennetts
Use monkey patching to avoid skipping (mostly) tests that try to create damaged repos on 2a. |
343 |
self.disable_commit_write_group_paranoia(b.repository) |
344 |
b.repository.commit_write_group() |
|
345 |
return b |
|
346 |
||
347 |
def disable_commit_write_group_paranoia(self, repo): |
|
348 |
if isinstance(repo, remote.RemoteRepository): |
|
349 |
# We can't easily disable the checks in a remote repo.
|
|
350 |
repo.abort_write_group() |
|
|
5010.2.25
by Vincent Ladeuil
Fix imports in per_repository/test_fileid_involved.py. |
351 |
raise tests.TestSkipped( |
|
4634.35.16
by Andrew Bennetts
Fix more test fallout. |
352 |
"repository format does not support storing revisions with "
|
353 |
"missing texts.") |
|
|
4634.35.22
by Andrew Bennetts
Use monkey patching to avoid skipping (mostly) tests that try to create damaged repos on 2a. |
354 |
pack_coll = getattr(repo, '_pack_collection', None) |
355 |
if pack_coll is not None: |
|
356 |
# Monkey-patch the pack collection instance to allow storing
|
|
357 |
# incomplete revisions.
|
|
358 |
pack_coll._check_new_inventories = lambda: [] |
|
|
4343.3.23
by John Arbash Meinel
Change RepositoryCHK1.fileids_altered_by to handle ghosts the way XML does. |
359 |
|
360 |
def test_file_ids_include_ghosts(self): |
|
361 |
b = self.create_branch_with_ghost_text() |
|
362 |
repo = b.repository |
|
363 |
self.assertEqual( |
|
364 |
{'a-file-id':set(['ghost-id'])}, |
|
365 |
repo.fileids_altered_by_revision_ids(['B-id'])) |
|
366 |
||
|
4343.3.24
by John Arbash Meinel
Add a test that file_ids goes to fallbacks appropriately. |
367 |
def test_file_ids_uses_fallbacks(self): |
368 |
builder = self.make_branch_builder('source', |
|
369 |
format=self.bzrdir_format) |
|
370 |
repo = builder.get_branch().repository |
|
371 |
if not repo._format.supports_external_lookups: |
|
372 |
raise tests.TestNotApplicable('format does not support stacking') |
|
|
4343.3.31
by John Arbash Meinel
Fix the test_fileid_involved test so that we don't take a write lock if we are going to skip the test. |
373 |
builder.start_series() |
|
4343.3.24
by John Arbash Meinel
Add a test that file_ids goes to fallbacks appropriately. |
374 |
builder.build_snapshot('A-id', None, [ |
375 |
('add', ('', 'root-id', 'directory', None)), |
|
376 |
('add', ('file', 'file-id', 'file', 'contents\n'))]) |
|
377 |
builder.build_snapshot('B-id', ['A-id'], [ |
|
378 |
('modify', ('file-id', 'new-content\n'))]) |
|
379 |
builder.build_snapshot('C-id', ['B-id'], [ |
|
380 |
('modify', ('file-id', 'yet more content\n'))]) |
|
381 |
builder.finish_series() |
|
382 |
source_b = builder.get_branch() |
|
383 |
source_b.lock_read() |
|
384 |
self.addCleanup(source_b.unlock) |
|
385 |
base = self.make_branch('base') |
|
386 |
base.pull(source_b, stop_revision='B-id') |
|
387 |
stacked = self.make_branch('stacked') |
|
388 |
stacked.set_stacked_on_url('../base') |
|
389 |
stacked.pull(source_b, stop_revision='C-id') |
|
390 |
||
391 |
stacked.lock_read() |
|
392 |
self.addCleanup(stacked.unlock) |
|
393 |
repo = stacked.repository |
|
394 |
keys = {'file-id': set(['A-id'])} |
|
395 |
if stacked.repository.supports_rich_root(): |
|
396 |
keys['root-id'] = set(['A-id']) |
|
397 |
self.assertEqual(keys, repo.fileids_altered_by_revision_ids(['A-id'])) |
|
|
4343.3.23
by John Arbash Meinel
Change RepositoryCHK1.fileids_altered_by to handle ghosts the way XML does. |
398 |
|
399 |
||
|
1711.7.4
by John Arbash Meinel
Fix test_fileid_involved so it uses TreeTransform to set the executable bits rather than chmod() |
400 |
def set_executability(wt, path, executable=True): |
401 |
"""Set the executable bit for the file at path in the working tree |
|
402 |
||
403 |
os.chmod() doesn't work on windows. But TreeTransform can mark or
|
|
404 |
unmark a file as executable.
|
|
405 |
"""
|
|
406 |
file_id = wt.path2id(path) |
|
|
5010.2.25
by Vincent Ladeuil
Fix imports in per_repository/test_fileid_involved.py. |
407 |
tt = transform.TreeTransform(wt) |
|
1711.7.5
by John Arbash Meinel
Call finalize() though it doesn't help to release resources to allow cleanup. |
408 |
try: |
|
1711.7.15
by John Arbash Meinel
Properly handle the case when you want to turn off executability. |
409 |
tt.set_executability(executable, tt.trans_id_tree_file_id(file_id)) |
|
1711.7.5
by John Arbash Meinel
Call finalize() though it doesn't help to release resources to allow cleanup. |
410 |
tt.apply() |
411 |
finally: |
|
412 |
tt.finalize() |