bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.65.4
by James Westby
Make the rename handling more robust. |
1 |
# Copyright (C) 2008 Canonical Ltd
|
2 |
#
|
|
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.
|
|
7 |
#
|
|
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.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
|
0.64.334
by Jelmer Vernooij
Remove old FSF address. Thanks Dan Callaghan. |
14 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
0.65.4
by James Westby
Make the rename handling more robust. |
15 |
|
|
6628.1.2
by Jelmer Vernooij
Fix imports, move exporter.py, drop explorer metadata. |
16 |
from __future__ import absolute_import |
17 |
||
|
0.65.4
by James Westby
Make the rename handling more robust. |
18 |
import time |
19 |
||
|
6628.1.2
by Jelmer Vernooij
Fix imports, move exporter.py, drop explorer metadata. |
20 |
from .... import ( |
|
0.65.4
by James Westby
Make the rename handling more robust. |
21 |
tests, |
22 |
)
|
|
|
6628.1.2
by Jelmer Vernooij
Fix imports, move exporter.py, drop explorer metadata. |
23 |
from ..helpers import ( |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
24 |
kind_to_mode, |
25 |
)
|
|
|
6628.1.2
by Jelmer Vernooij
Fix imports, move exporter.py, drop explorer metadata. |
26 |
from . import ( |
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
27 |
FastimportFeature, |
|
0.65.4
by James Westby
Make the rename handling more robust. |
28 |
)
|
29 |
||
|
0.123.14
by Jelmer Vernooij
Simplify imports in case fastimport is not installed. |
30 |
try: |
31 |
from fastimport import commands |
|
32 |
except ImportError: |
|
33 |
commands = object() |
|
34 |
||
|
0.65.4
by James Westby
Make the rename handling more robust. |
35 |
|
|
6631.1.1
by Martin
Fix test failures and issues with run with python -Werror |
36 |
def load_tests(loader, standard_tests, pattern): |
|
0.115.2
by John Arbash Meinel
Change to multiplying tests rather than manually. |
37 |
"""Parameterize tests for all versions of groupcompress.""" |
38 |
scenarios = [ |
|
39 |
('pack-0.92', {'branch_format': 'pack-0.92'}), |
|
40 |
('1.9-rich-root', {'branch_format': '1.9-rich-root'}), |
|
41 |
]
|
|
42 |
try: |
|
|
6670.4.5
by Jelmer Vernooij
Move breezy.repofmt contents to breezy.bzr. |
43 |
from ....bzr.groupcompress_repo import RepositoryFormat2a |
|
0.115.2
by John Arbash Meinel
Change to multiplying tests rather than manually. |
44 |
scenarios.append(('2a', {'branch_format': '2a'})) |
45 |
except ImportError: |
|
46 |
pass
|
|
47 |
suite = loader.suiteClass() |
|
48 |
result = tests.multiply_tests(standard_tests, scenarios, suite) |
|
49 |
return result |
|
50 |
||
51 |
||
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
52 |
class TestCaseForGenericProcessor(tests.TestCaseWithTransport): |
|
0.65.4
by James Westby
Make the rename handling more robust. |
53 |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
54 |
_test_needs_features = [FastimportFeature] |
55 |
||
|
0.85.1
by Ian Clatworthy
extend tests to test the chk code path |
56 |
branch_format = "pack-0.92" |
57 |
||
|
0.65.4
by James Westby
Make the rename handling more robust. |
58 |
def get_handler(self): |
|
6628.1.2
by Jelmer Vernooij
Fix imports, move exporter.py, drop explorer metadata. |
59 |
from ..processors import ( |
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
60 |
generic_processor, |
61 |
)
|
|
|
0.85.1
by Ian Clatworthy
extend tests to test the chk code path |
62 |
branch = self.make_branch('.', format=self.branch_format) |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
63 |
handler = generic_processor.GenericProcessor(branch.controldir) |
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
64 |
return handler, branch |
|
0.65.4
by James Westby
Make the rename handling more robust. |
65 |
|
66 |
# FIXME: [] as a default is bad, as it is mutable, but I want
|
|
67 |
# to use None to mean "don't check this".
|
|
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
68 |
def assertChanges(self, branch, revno, expected_added=[], |
69 |
expected_removed=[], expected_modified=[], |
|
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
70 |
expected_renamed=[], expected_kind_changed=[]): |
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
71 |
"""Check the changes introduced in a revision of a branch. |
72 |
||
73 |
This method checks that a revision introduces expected changes.
|
|
74 |
The required changes are passed in as a list, where
|
|
75 |
each entry contains the needed information about the change.
|
|
76 |
||
77 |
If you do not wish to assert anything about a particular
|
|
78 |
category then pass None instead.
|
|
79 |
||
80 |
branch: The branch.
|
|
81 |
revno: revision number of revision to check.
|
|
82 |
expected_added: a list of (filename,) tuples that must have
|
|
83 |
been added in the delta.
|
|
84 |
expected_removed: a list of (filename,) tuples that must have
|
|
85 |
been removed in the delta.
|
|
86 |
expected_modified: a list of (filename,) tuples that must have
|
|
87 |
been modified in the delta.
|
|
88 |
expected_renamed: a list of (old_path, new_path) tuples that
|
|
89 |
must have been renamed in the delta.
|
|
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
90 |
expected_kind_changed: a list of (path, old_kind, new_kind) tuples
|
91 |
that must have been changed in the delta.
|
|
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
92 |
:return: revtree1, revtree2
|
93 |
"""
|
|
94 |
repo = branch.repository |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
95 |
revtree1 = repo.revision_tree(branch.get_rev_id(revno - 1)) |
96 |
revtree2 = repo.revision_tree(branch.get_rev_id(revno)) |
|
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
97 |
changes = revtree2.changes_from(revtree1) |
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
98 |
self._check_changes(changes, expected_added, expected_removed, |
99 |
expected_modified, expected_renamed, expected_kind_changed) |
|
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
100 |
return revtree1, revtree2 |
101 |
||
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
102 |
def _check_changes(self, changes, expected_added=[], |
|
0.65.4
by James Westby
Make the rename handling more robust. |
103 |
expected_removed=[], expected_modified=[], |
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
104 |
expected_renamed=[], expected_kind_changed=[]): |
|
0.65.4
by James Westby
Make the rename handling more robust. |
105 |
"""Check the changes in a TreeDelta |
106 |
||
107 |
This method checks that the TreeDelta contains the expected
|
|
108 |
modifications between the two trees that were used to generate
|
|
109 |
it. The required changes are passed in as a list, where
|
|
110 |
each entry contains the needed information about the change.
|
|
111 |
||
112 |
If you do not wish to assert anything about a particular
|
|
113 |
category then pass None instead.
|
|
114 |
||
115 |
changes: The TreeDelta to check.
|
|
116 |
expected_added: a list of (filename,) tuples that must have
|
|
117 |
been added in the delta.
|
|
118 |
expected_removed: a list of (filename,) tuples that must have
|
|
119 |
been removed in the delta.
|
|
120 |
expected_modified: a list of (filename,) tuples that must have
|
|
121 |
been modified in the delta.
|
|
122 |
expected_renamed: a list of (old_path, new_path) tuples that
|
|
123 |
must have been renamed in the delta.
|
|
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
124 |
expected_kind_changed: a list of (path, old_kind, new_kind) tuples
|
125 |
that must have been changed in the delta.
|
|
|
0.65.4
by James Westby
Make the rename handling more robust. |
126 |
"""
|
127 |
renamed = changes.renamed |
|
128 |
added = changes.added |
|
129 |
removed = changes.removed |
|
130 |
modified = changes.modified |
|
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
131 |
kind_changed = changes.kind_changed |
|
0.65.4
by James Westby
Make the rename handling more robust. |
132 |
if expected_renamed is not None: |
133 |
self.assertEquals(len(renamed), len(expected_renamed), |
|
|
0.74.1
by John Arbash Meinel
Change the rename code to create a new text entry. |
134 |
"%s is renamed, expected %s" % (renamed, expected_renamed)) |
|
0.65.4
by James Westby
Make the rename handling more robust. |
135 |
renamed_files = [(item[0], item[1]) for item in renamed] |
136 |
for expected_renamed_entry in expected_renamed: |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
137 |
expected_renamed_entry = ( |
138 |
expected_renamed_entry[0].decode('utf-8'), |
|
139 |
expected_renamed_entry[1].decode('utf-8')) |
|
|
0.65.4
by James Westby
Make the rename handling more robust. |
140 |
self.assertTrue(expected_renamed_entry in renamed_files, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
141 |
"%s is not renamed, %s are" % (expected_renamed_entry, |
|
0.65.4
by James Westby
Make the rename handling more robust. |
142 |
renamed_files)) |
143 |
if expected_added is not None: |
|
144 |
self.assertEquals(len(added), len(expected_added), |
|
145 |
"%s is added" % str(added)) |
|
146 |
added_files = [(item[0],) for item in added] |
|
147 |
for expected_added_entry in expected_added: |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
148 |
expected_added_entry = (expected_added_entry[0].decode('utf-8'), ) |
|
0.65.4
by James Westby
Make the rename handling more robust. |
149 |
self.assertTrue(expected_added_entry in added_files, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
150 |
"%s is not added, %s are" % (expected_added_entry, |
|
0.65.4
by James Westby
Make the rename handling more robust. |
151 |
added_files)) |
152 |
if expected_removed is not None: |
|
153 |
self.assertEquals(len(removed), len(expected_removed), |
|
154 |
"%s is removed" % str(removed)) |
|
155 |
removed_files = [(item[0],) for item in removed] |
|
156 |
for expected_removed_entry in expected_removed: |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
157 |
expected_removed_entry = (expected_removed_entry[0].decode('utf-8'), ) |
|
0.65.4
by James Westby
Make the rename handling more robust. |
158 |
self.assertTrue(expected_removed_entry in removed_files, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
159 |
"%s is not removed, %s are" % (expected_removed_entry, |
|
0.65.4
by James Westby
Make the rename handling more robust. |
160 |
removed_files)) |
161 |
if expected_modified is not None: |
|
162 |
self.assertEquals(len(modified), len(expected_modified), |
|
163 |
"%s is modified" % str(modified)) |
|
164 |
modified_files = [(item[0],) for item in modified] |
|
165 |
for expected_modified_entry in expected_modified: |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
166 |
expected_modified_entry = (expected_modified_entry[0].decode('utf-8'), ) |
|
0.65.4
by James Westby
Make the rename handling more robust. |
167 |
self.assertTrue(expected_modified_entry in modified_files, |
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
168 |
"%s is not modified, %s are" % ( |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
169 |
expected_modified_entry, modified_files)) |
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
170 |
if expected_kind_changed is not None: |
171 |
self.assertEquals(len(kind_changed), len(expected_kind_changed), |
|
172 |
"%s is kind-changed, expected %s" % (kind_changed, |
|
173 |
expected_kind_changed)) |
|
174 |
kind_changed_files = [(item[0], item[2], item[3]) |
|
175 |
for item in kind_changed] |
|
176 |
for expected_kind_changed_entry in expected_kind_changed: |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
177 |
expected_kind_changed_entry = ( |
178 |
expected_kind_changed_entry[0].decode('utf-8'), ) + expected_kind_changed_entry[1:] |
|
179 |
self.assertTrue(expected_kind_changed_entry in |
|
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
180 |
kind_changed_files, "%s is not kind-changed, %s are" % ( |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
181 |
expected_kind_changed_entry, kind_changed_files)) |
|
0.65.4
by James Westby
Make the rename handling more robust. |
182 |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
183 |
def assertContent(self, branch, tree, path, content): |
|
6754.8.4
by Jelmer Vernooij
Use new context stuff. |
184 |
with branch.lock_read(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
185 |
self.assertEqual(tree.get_file_text(path.decode('utf-8')), content) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
186 |
|
187 |
def assertSymlinkTarget(self, branch, tree, path, target): |
|
|
6754.8.4
by Jelmer Vernooij
Use new context stuff. |
188 |
with branch.lock_read(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
189 |
self.assertEqual(tree.get_symlink_target(path.decode('utf-8')), target) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
190 |
|
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
191 |
def assertExecutable(self, branch, tree, path, executable): |
|
6754.8.4
by Jelmer Vernooij
Use new context stuff. |
192 |
with branch.lock_read(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
193 |
self.assertEqual(tree.is_executable(path.decode('utf-8')), executable) |
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
194 |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
195 |
def assertRevisionRoot(self, revtree, path): |
196 |
self.assertEqual(revtree.get_revision_id(), |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
197 |
revtree.get_file_revision(path.decode('utf-8'))) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
198 |
|
199 |
||
|
0.132.1
by Samuel Bronson
Add test for bug #401249. |
200 |
class TestImportToPackTag(TestCaseForGenericProcessor): |
201 |
||
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
202 |
def file_command_iter(self, path, kind='file', content=b'aaa', |
203 |
executable=False, to_kind=None, to_content=b'bbb', to_executable=None): |
|
|
0.132.1
by Samuel Bronson
Add test for bug #401249. |
204 |
# Revno 1: create a file or symlink
|
205 |
# Revno 2: modify it
|
|
206 |
if to_kind is None: |
|
207 |
to_kind = kind |
|
208 |
if to_executable is None: |
|
209 |
to_executable = executable |
|
210 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
211 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
212 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.132.1
by Samuel Bronson
Add test for bug #401249. |
213 |
def files_one(): |
|
0.64.317
by Jelmer Vernooij
Merge test for bug 410249. |
214 |
yield commands.FileModifyCommand(path, |
215 |
kind_to_mode(kind, executable), None, content) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
216 |
yield commands.CommitCommand(b'head', b'1', author, |
217 |
committer, b"commit 1", None, [], files_one) |
|
|
0.132.1
by Samuel Bronson
Add test for bug #401249. |
218 |
def files_two(): |
|
0.64.317
by Jelmer Vernooij
Merge test for bug 410249. |
219 |
yield commands.FileModifyCommand(path, |
220 |
kind_to_mode(to_kind, to_executable), None, to_content) |
|
|
0.132.3
by Samuel Bronson
It looks like #401249 also applies to "branch ... from <refname>". |
221 |
|
222 |
# pass "head" for from_ to show that #401249 is worse than I knew
|
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
223 |
yield commands.CommitCommand(b'head', b'2', author, |
224 |
committer, b"commit 2", b"head", [], files_two) |
|
|
0.132.3
by Samuel Bronson
It looks like #401249 also applies to "branch ... from <refname>". |
225 |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
226 |
yield commands.TagCommand(b'tag1', b':1', committer, b"tag 1") |
|
0.132.3
by Samuel Bronson
It looks like #401249 also applies to "branch ... from <refname>". |
227 |
|
228 |
# pass "head" for from_ to demonstrate #401249
|
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
229 |
yield commands.TagCommand(b'tag2', b'head', committer, b"tag 2") |
|
0.132.1
by Samuel Bronson
Add test for bug #401249. |
230 |
return command_list |
231 |
||
232 |
def test_tag(self): |
|
233 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
234 |
path = b'a' |
|
0.64.317
by Jelmer Vernooij
Merge test for bug 410249. |
235 |
raise tests.KnownFailure("non-mark committish not yet supported" |
236 |
"- bug #410249") |
|
|
0.132.1
by Samuel Bronson
Add test for bug #401249. |
237 |
handler.process(self.file_command_iter(path)) |
238 |
||
|
0.64.317
by Jelmer Vernooij
Merge test for bug 410249. |
239 |
|
|
6846.3.1
by Jelmer Vernooij
Support '0' marker in fastimport plugin. |
240 |
class TestImportZeroMarker(TestCaseForGenericProcessor): |
241 |
||
242 |
def test_tag(self): |
|
243 |
handler, branch = self.get_handler() |
|
244 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
245 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
246 |
yield commands.TagCommand(b'tag1', b':0', committer, b"tag 1") |
|
|
6846.3.1
by Jelmer Vernooij
Support '0' marker in fastimport plugin. |
247 |
handler.process(command_list) |
248 |
||
249 |
||
|
0.85.1
by Ian Clatworthy
extend tests to test the chk code path |
250 |
class TestImportToPackModify(TestCaseForGenericProcessor): |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
251 |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
252 |
def file_command_iter(self, path, kind='file', content=b'aaa', |
253 |
executable=False, to_kind=None, to_content=b'bbb', to_executable=None): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
254 |
|
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
255 |
# Revno 1: create a file or symlink
|
256 |
# Revno 2: modify it
|
|
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
257 |
if to_kind is None: |
258 |
to_kind = kind |
|
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
259 |
if to_executable is None: |
260 |
to_executable = executable |
|
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
261 |
mode = kind_to_mode(kind, executable) |
262 |
to_mode = kind_to_mode(to_kind, to_executable) |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
263 |
def command_list(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
264 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
265 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
266 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
267 |
yield commands.FileModifyCommand(path, mode, None, content) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
268 |
yield commands.CommitCommand(b'head', b'1', author, |
269 |
committer, b"commit 1", None, [], files_one) |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
270 |
def files_two(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
271 |
yield commands.FileModifyCommand(path, to_mode, None, to_content) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
272 |
yield commands.CommitCommand(b'head', b'2', author, |
273 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
274 |
return command_list |
275 |
||
276 |
def test_modify_file_in_root(self): |
|
277 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
278 |
path = b'a' |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
279 |
handler.process(self.file_command_iter(path)) |
280 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
281 |
expected_added=[(path,)]) |
|
282 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
283 |
expected_modified=[(path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
284 |
self.assertContent(branch, revtree1, path, b"aaa") |
285 |
self.assertContent(branch, revtree2, path, b"bbb") |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
286 |
self.assertRevisionRoot(revtree1, path) |
287 |
self.assertRevisionRoot(revtree2, path) |
|
288 |
||
289 |
def test_modify_file_in_subdir(self): |
|
290 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
291 |
path = b'a/a' |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
292 |
handler.process(self.file_command_iter(path)) |
293 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
294 |
expected_added=[(b'a',), (path,)]) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
295 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
296 |
expected_modified=[(path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
297 |
self.assertContent(branch, revtree1, path, b"aaa") |
298 |
self.assertContent(branch, revtree2, path, b"bbb") |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
299 |
|
300 |
def test_modify_symlink_in_root(self): |
|
301 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
302 |
path = b'a' |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
303 |
handler.process(self.file_command_iter(path, kind='symlink')) |
304 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
305 |
expected_modified=[(path,)]) |
|
306 |
self.assertSymlinkTarget(branch, revtree1, path, "aaa") |
|
307 |
self.assertSymlinkTarget(branch, revtree2, path, "bbb") |
|
308 |
self.assertRevisionRoot(revtree1, path) |
|
309 |
self.assertRevisionRoot(revtree2, path) |
|
310 |
||
311 |
def test_modify_symlink_in_subdir(self): |
|
312 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
313 |
path = b'a/a' |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
314 |
handler.process(self.file_command_iter(path, kind='symlink')) |
315 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
316 |
expected_added=[(b'a',), (path,)]) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
317 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
318 |
expected_modified=[(path,)]) |
|
319 |
self.assertSymlinkTarget(branch, revtree1, path, "aaa") |
|
320 |
self.assertSymlinkTarget(branch, revtree2, path, "bbb") |
|
321 |
||
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
322 |
def test_modify_file_becomes_symlink(self): |
323 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
324 |
path = b'a/a' |
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
325 |
handler.process(self.file_command_iter(path, |
326 |
kind='file', to_kind='symlink')) |
|
327 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
328 |
expected_added=[(b'a',), (path,)]) |
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
329 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
330 |
expected_kind_changed=[(path, 'file', 'symlink')]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
331 |
self.assertContent(branch, revtree1, path, b"aaa") |
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
332 |
self.assertSymlinkTarget(branch, revtree2, path, "bbb") |
333 |
||
334 |
def test_modify_symlink_becomes_file(self): |
|
335 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
336 |
path = b'a/a' |
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
337 |
handler.process(self.file_command_iter(path, |
338 |
kind='symlink', to_kind='file')) |
|
339 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
340 |
expected_added=[(b'a',), (path,)]) |
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
341 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
342 |
expected_kind_changed=[(path, 'symlink', 'file')]) |
|
343 |
self.assertSymlinkTarget(branch, revtree1, path, "aaa") |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
344 |
self.assertContent(branch, revtree2, path, b"bbb") |
|
0.80.3
by Ian Clatworthy
file <-> symlink change tests |
345 |
|
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
346 |
def test_modify_file_now_executable(self): |
347 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
348 |
path = b'a/a' |
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
349 |
handler.process(self.file_command_iter(path, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
350 |
executable=False, to_executable=True, to_content=b'aaa')) |
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
351 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
352 |
expected_added=[(b'a',), (path,)]) |
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
353 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
354 |
expected_modified=[(path,)]) |
|
355 |
self.assertExecutable(branch, revtree1, path, False) |
|
356 |
self.assertExecutable(branch, revtree2, path, True) |
|
357 |
||
358 |
def test_modify_file_no_longer_executable(self): |
|
359 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
360 |
path = b'a/a' |
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
361 |
handler.process(self.file_command_iter(path, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
362 |
executable=True, to_executable=False, to_content=b'aaa')) |
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
363 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
364 |
expected_added=[(b'a',), (path,)]) |
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
365 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
366 |
expected_modified=[(path,)]) |
|
367 |
self.assertExecutable(branch, revtree1, path, True) |
|
368 |
self.assertExecutable(branch, revtree2, path, False) |
|
369 |
||
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
370 |
|
|
0.99.5
by Ian Clatworthy
handle adding the same file twice in the one commit |
371 |
class TestImportToPackModifyTwice(TestCaseForGenericProcessor): |
372 |
"""This tests when the same file is modified twice in the one commit. |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
373 |
|
|
0.99.5
by Ian Clatworthy
handle adding the same file twice in the one commit |
374 |
Note: hg-fast-export produces data like this on occasions.
|
375 |
"""
|
|
376 |
||
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
377 |
def file_command_iter(self, path, kind='file', content=b'aaa', |
378 |
executable=False, to_kind=None, to_content=b'bbb', to_executable=None): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
379 |
|
|
0.99.5
by Ian Clatworthy
handle adding the same file twice in the one commit |
380 |
# Revno 1: create a file twice
|
381 |
if to_kind is None: |
|
382 |
to_kind = kind |
|
383 |
if to_executable is None: |
|
384 |
to_executable = executable |
|
385 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
386 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
387 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.5
by Ian Clatworthy
handle adding the same file twice in the one commit |
388 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
389 |
yield commands.FileModifyCommand(path, kind_to_mode(kind, executable), |
|
0.99.5
by Ian Clatworthy
handle adding the same file twice in the one commit |
390 |
None, content) |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
391 |
yield commands.FileModifyCommand(path, kind_to_mode(to_kind, to_executable), |
|
0.99.5
by Ian Clatworthy
handle adding the same file twice in the one commit |
392 |
None, to_content) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
393 |
yield commands.CommitCommand(b'head', b'1', author, |
394 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.5
by Ian Clatworthy
handle adding the same file twice in the one commit |
395 |
return command_list |
396 |
||
397 |
def test_modify_file_twice_in_root(self): |
|
398 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
399 |
path = b'a' |
|
0.99.5
by Ian Clatworthy
handle adding the same file twice in the one commit |
400 |
handler.process(self.file_command_iter(path)) |
401 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
402 |
expected_added=[(path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
403 |
self.assertContent(branch, revtree1, path, b"aaa") |
|
0.99.5
by Ian Clatworthy
handle adding the same file twice in the one commit |
404 |
self.assertRevisionRoot(revtree1, path) |
405 |
||
406 |
||
|
0.85.1
by Ian Clatworthy
extend tests to test the chk code path |
407 |
class TestImportToPackModifyTricky(TestCaseForGenericProcessor): |
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
408 |
|
409 |
def file_command_iter(self, path1, path2, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
410 |
|
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
411 |
# Revno 1: create a file or symlink in a directory
|
412 |
# Revno 2: create a second file that implicitly deletes the
|
|
413 |
# first one because either:
|
|
414 |
# * the new file is a in directory with the old file name
|
|
415 |
# * the new file has the same name as the directory of the first
|
|
416 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
417 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
418 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
419 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
420 |
yield commands.FileModifyCommand(path1, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
421 |
None, b"aaa") |
422 |
yield commands.CommitCommand(b'head', b'1', author, |
|
423 |
committer, b"commit 1", None, [], files_one) |
|
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
424 |
def files_two(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
425 |
yield commands.FileModifyCommand(path2, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
426 |
None, b"bbb") |
427 |
yield commands.CommitCommand(b'head', b'2', author, |
|
428 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
429 |
return command_list |
430 |
||
431 |
def test_modify_file_becomes_directory(self): |
|
432 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
433 |
path1 = b'a/b' |
434 |
path2 = b'a/b/c' |
|
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
435 |
handler.process(self.file_command_iter(path1, path2)) |
436 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
437 |
expected_added=[(b'a',), (path1,)]) |
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
438 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
439 |
expected_added=[(path2,)], |
|
440 |
expected_kind_changed=[(path1, 'file', 'directory')]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
441 |
self.assertContent(branch, revtree1, path1, b"aaa") |
442 |
self.assertContent(branch, revtree2, path2, b"bbb") |
|
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
443 |
|
444 |
def test_modify_directory_becomes_file(self): |
|
445 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
446 |
path1 = b'a/b/c' |
447 |
path2 = b'a/b' |
|
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
448 |
handler.process(self.file_command_iter(path1, path2)) |
449 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
450 |
expected_added=[(b'a',), (b'a/b',), (path1,)]) |
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
451 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
452 |
expected_removed=[(path1,),], |
|
453 |
expected_kind_changed=[(path2, 'directory', 'file')]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
454 |
self.assertContent(branch, revtree1, path1, b"aaa") |
455 |
self.assertContent(branch, revtree2, path2, b"bbb") |
|
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
456 |
|
457 |
def test_modify_symlink_becomes_directory(self): |
|
458 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
459 |
path1 = b'a/b' |
460 |
path2 = b'a/b/c' |
|
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
461 |
handler.process(self.file_command_iter(path1, path2, 'symlink')) |
462 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
463 |
expected_added=[(b'a',), (path1,)]) |
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
464 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
465 |
expected_added=[(path2,)], |
|
466 |
expected_kind_changed=[(path1, 'symlink', 'directory')]) |
|
467 |
self.assertSymlinkTarget(branch, revtree1, path1, "aaa") |
|
468 |
self.assertSymlinkTarget(branch, revtree2, path2, "bbb") |
|
469 |
||
470 |
def test_modify_directory_becomes_symlink(self): |
|
471 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
472 |
path1 = b'a/b/c' |
473 |
path2 = b'a/b' |
|
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
474 |
handler.process(self.file_command_iter(path1, path2, 'symlink')) |
475 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
476 |
expected_added=[(b'a',), (b'a/b',), (path1,)]) |
|
0.80.5
by Ian Clatworthy
file/symlink <-> directory change tests & fix |
477 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
478 |
expected_removed=[(path1,),], |
|
479 |
expected_kind_changed=[(path2, 'directory', 'symlink')]) |
|
480 |
self.assertSymlinkTarget(branch, revtree1, path1, "aaa") |
|
481 |
self.assertSymlinkTarget(branch, revtree2, path2, "bbb") |
|
482 |
||
483 |
||
|
0.85.1
by Ian Clatworthy
extend tests to test the chk code path |
484 |
class TestImportToPackDelete(TestCaseForGenericProcessor): |
|
0.80.2
by Ian Clatworthy
basic delete tests |
485 |
|
486 |
def file_command_iter(self, path, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
487 |
|
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
488 |
# Revno 1: create a file or symlink
|
489 |
# Revno 2: delete it
|
|
|
0.80.2
by Ian Clatworthy
basic delete tests |
490 |
def command_list(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
491 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
492 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.80.2
by Ian Clatworthy
basic delete tests |
493 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
494 |
yield commands.FileModifyCommand(path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
495 |
None, b"aaa") |
496 |
yield commands.CommitCommand(b'head', b'1', author, |
|
497 |
committer, b"commit 1", None, [], files_one) |
|
|
0.80.2
by Ian Clatworthy
basic delete tests |
498 |
def files_two(): |
499 |
yield commands.FileDeleteCommand(path) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
500 |
yield commands.CommitCommand(b'head', b'2', author, |
501 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.80.2
by Ian Clatworthy
basic delete tests |
502 |
return command_list |
503 |
||
504 |
def test_delete_file_in_root(self): |
|
505 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
506 |
path = b'a' |
|
0.80.2
by Ian Clatworthy
basic delete tests |
507 |
handler.process(self.file_command_iter(path)) |
508 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
509 |
expected_added=[(path,)]) |
|
510 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
511 |
expected_removed=[(path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
512 |
self.assertContent(branch, revtree1, path, b"aaa") |
|
0.80.2
by Ian Clatworthy
basic delete tests |
513 |
self.assertRevisionRoot(revtree1, path) |
514 |
||
515 |
def test_delete_file_in_subdir(self): |
|
516 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
517 |
path = b'a/a' |
|
0.80.2
by Ian Clatworthy
basic delete tests |
518 |
handler.process(self.file_command_iter(path)) |
519 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
520 |
expected_added=[(b'a',), (path,)]) |
|
0.80.2
by Ian Clatworthy
basic delete tests |
521 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
522 |
expected_removed=[(b'a',), (path,)]) |
523 |
self.assertContent(branch, revtree1, path, b"aaa") |
|
|
0.80.2
by Ian Clatworthy
basic delete tests |
524 |
|
525 |
def test_delete_symlink_in_root(self): |
|
526 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
527 |
path = b'a' |
|
0.80.2
by Ian Clatworthy
basic delete tests |
528 |
handler.process(self.file_command_iter(path, kind='symlink')) |
529 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
530 |
expected_removed=[(path,)]) |
|
531 |
self.assertSymlinkTarget(branch, revtree1, path, "aaa") |
|
532 |
self.assertRevisionRoot(revtree1, path) |
|
533 |
||
534 |
def test_delete_symlink_in_subdir(self): |
|
535 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
536 |
path = b'a/a' |
|
0.80.2
by Ian Clatworthy
basic delete tests |
537 |
handler.process(self.file_command_iter(path, kind='symlink')) |
538 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
539 |
expected_added=[(b'a',), (path,)]) |
|
0.80.2
by Ian Clatworthy
basic delete tests |
540 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
541 |
expected_removed=[(b'a',), (path,)]) |
|
0.80.2
by Ian Clatworthy
basic delete tests |
542 |
self.assertSymlinkTarget(branch, revtree1, path, "aaa") |
543 |
||
|
0.96.2
by Ian Clatworthy
test and fix for implicit directory delete recursing up |
544 |
def test_delete_file_in_deep_subdir(self): |
545 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
546 |
path = b'a/b/c/d' |
|
0.96.2
by Ian Clatworthy
test and fix for implicit directory delete recursing up |
547 |
handler.process(self.file_command_iter(path)) |
548 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
549 |
expected_added=[(b'a',), (b'a/b',), (b'a/b/c',), (path,)]) |
|
0.96.2
by Ian Clatworthy
test and fix for implicit directory delete recursing up |
550 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
551 |
expected_removed=[(b'a',), (b'a/b',), (b'a/b/c',), (path,)]) |
552 |
self.assertContent(branch, revtree1, path, b"aaa") |
|
|
0.96.2
by Ian Clatworthy
test and fix for implicit directory delete recursing up |
553 |
|
|
0.80.2
by Ian Clatworthy
basic delete tests |
554 |
|
|
0.99.7
by Ian Clatworthy
handle a delete of a newly added file |
555 |
class TestImportToPackDeleteNew(TestCaseForGenericProcessor): |
556 |
"""Test deletion of a newly added file.""" |
|
557 |
||
558 |
def file_command_iter(self, path, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
559 |
|
|
0.99.7
by Ian Clatworthy
handle a delete of a newly added file |
560 |
# Revno 1: create a file or symlink then delete it
|
561 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
562 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
563 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.7
by Ian Clatworthy
handle a delete of a newly added file |
564 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
565 |
yield commands.FileModifyCommand(path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
566 |
None, b"aaa") |
|
0.99.7
by Ian Clatworthy
handle a delete of a newly added file |
567 |
yield commands.FileDeleteCommand(path) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
568 |
yield commands.CommitCommand(b'head', b'1', author, |
569 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.7
by Ian Clatworthy
handle a delete of a newly added file |
570 |
return command_list |
571 |
||
572 |
def test_delete_new_file_in_root(self): |
|
573 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
574 |
path = b'a' |
|
0.99.7
by Ian Clatworthy
handle a delete of a newly added file |
575 |
handler.process(self.file_command_iter(path)) |
576 |
revtree0, revtree1 = self.assertChanges(branch, 1,) |
|
577 |
||
578 |
def test_delete_new_file_in_subdir(self): |
|
579 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
580 |
path = b'a/a' |
|
0.99.7
by Ian Clatworthy
handle a delete of a newly added file |
581 |
handler.process(self.file_command_iter(path)) |
582 |
revtree0, revtree1 = self.assertChanges(branch, 1,) |
|
583 |
||
584 |
def test_delete_new_symlink_in_root(self): |
|
585 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
586 |
path = b'a' |
|
0.99.7
by Ian Clatworthy
handle a delete of a newly added file |
587 |
handler.process(self.file_command_iter(path, kind='symlink')) |
588 |
revtree0, revtree1 = self.assertChanges(branch, 1,) |
|
589 |
||
590 |
def test_delete_new_symlink_in_subdir(self): |
|
591 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
592 |
path = b'a/a' |
|
0.99.7
by Ian Clatworthy
handle a delete of a newly added file |
593 |
handler.process(self.file_command_iter(path, kind='symlink')) |
594 |
revtree0, revtree1 = self.assertChanges(branch, 1,) |
|
595 |
||
596 |
def test_delete_new_file_in_deep_subdir(self): |
|
597 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
598 |
path = b'a/b/c/d' |
|
0.99.7
by Ian Clatworthy
handle a delete of a newly added file |
599 |
handler.process(self.file_command_iter(path)) |
600 |
revtree0, revtree1 = self.assertChanges(branch, 1,) |
|
601 |
||
602 |
||
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
603 |
class TestImportToPackDeleteMultiLevel(TestCaseForGenericProcessor): |
604 |
||
605 |
def file_command_iter(self, paths, paths_to_delete): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
606 |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
607 |
# Revno 1: create multiple files
|
608 |
# Revno 2: delete multiple files
|
|
609 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
610 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
611 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
612 |
def files_one(): |
613 |
for i, path in enumerate(paths): |
|
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
614 |
yield commands.FileModifyCommand(path, kind_to_mode('file', False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
615 |
None, b"aaa%d" % i) |
616 |
yield commands.CommitCommand(b'head', b'1', author, |
|
617 |
committer, b"commit 1", None, [], files_one) |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
618 |
def files_two(): |
619 |
for path in paths_to_delete: |
|
620 |
yield commands.FileDeleteCommand(path) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
621 |
yield commands.CommitCommand(b'head', b'2', author, |
622 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
623 |
return command_list |
624 |
||
625 |
def test_delete_files_in_multiple_levels(self): |
|
626 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
627 |
paths = [b'a/b/c', b'a/b/d/e'] |
628 |
paths_to_delete = [b'a/b/c', b'a/b/d/e'] |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
629 |
handler.process(self.file_command_iter(paths, paths_to_delete)) |
630 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
631 |
expected_added=[ |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
632 |
(b'a',), (b'a/b',), (b'a/b/c',), |
633 |
(b'a/b/d',), (b'a/b/d/e',), |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
634 |
])
|
635 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
636 |
expected_removed=[ |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
637 |
(b'a',), (b'a/b',), (b'a/b/c',), |
638 |
(b'a/b/d',), (b'a/b/d/e',), |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
639 |
])
|
640 |
||
641 |
def test_delete_file_single_level(self): |
|
642 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
643 |
paths = [b'a/b/c', b'a/b/d/e'] |
644 |
paths_to_delete = [b'a/b/d/e'] |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
645 |
handler.process(self.file_command_iter(paths, paths_to_delete)) |
646 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
647 |
expected_added=[ |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
648 |
(b'a',), (b'a/b',), (b'a/b/c',), |
649 |
(b'a/b/d',), (b'a/b/d/e',), |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
650 |
])
|
651 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
652 |
expected_removed=[ |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
653 |
(b'a/b/d',), (b'a/b/d/e',), |
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
654 |
])
|
655 |
||
656 |
def test_delete_file_complex_level(self): |
|
657 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
658 |
paths = [b'a/b/c', b'a/b/d/e', b'a/f/g', b'a/h', b'a/b/d/i/j'] |
659 |
paths_to_delete = [b'a/b/c', b'a/b/d/e', b'a/f/g', b'a/b/d/i/j'] |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
660 |
handler.process(self.file_command_iter(paths, paths_to_delete)) |
661 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
662 |
expected_added=[ |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
663 |
(b'a',), (b'a/b',), (b'a/b/c',), |
664 |
(b'a/b/d',), (b'a/b/d/e',), |
|
665 |
(b'a/f',), (b'a/f/g',), |
|
666 |
(b'a/h',), |
|
667 |
(b'a/b/d/i',), (b'a/b/d/i/j',), |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
668 |
])
|
669 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
670 |
expected_removed=[ |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
671 |
(b'a/b',), (b'a/b/c',), |
672 |
(b'a/b/d',), (b'a/b/d/e',), |
|
673 |
(b'a/f',), (b'a/f/g',), |
|
674 |
(b'a/b/d/i',), (b'a/b/d/i/j',), |
|
|
0.101.1
by Tom Widmer
Add test cases to check deletions from multiple levels in a tree still cause pruning of empty dirs to happen correctly. |
675 |
])
|
676 |
||
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
677 |
class TestImportToPackDeleteThenAdd(TestCaseForGenericProcessor): |
678 |
"""Test delete followed by an add. Merges can cause this.""" |
|
679 |
||
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
680 |
def file_command_iter(self, path, kind='file', content=b'aaa', |
681 |
executable=False, to_kind=None, to_content=b'bbb', to_executable=None): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
682 |
|
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
683 |
# Revno 1: create a file or symlink
|
684 |
# Revno 2: delete it and add it
|
|
685 |
if to_kind is None: |
|
686 |
to_kind = kind |
|
687 |
if to_executable is None: |
|
688 |
to_executable = executable |
|
689 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
690 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
691 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
692 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
693 |
yield commands.FileModifyCommand(path, kind_to_mode(kind, executable), |
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
694 |
None, content) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
695 |
yield commands.CommitCommand(b'head', b'1', author, |
696 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
697 |
def files_two(): |
698 |
yield commands.FileDeleteCommand(path) |
|
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
699 |
yield commands.FileModifyCommand(path, kind_to_mode(to_kind, to_executable), |
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
700 |
None, to_content) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
701 |
yield commands.CommitCommand(b'head', b'2', author, |
702 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
703 |
return command_list |
704 |
||
705 |
def test_delete_then_add_file_in_root(self): |
|
706 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
707 |
path = b'a' |
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
708 |
handler.process(self.file_command_iter(path)) |
709 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
710 |
expected_added=[(path,)]) |
|
711 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
712 |
expected_removed=[(path,)], |
|
713 |
expected_added=[(path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
714 |
self.assertContent(branch, revtree1, path, b"aaa") |
715 |
self.assertContent(branch, revtree2, path, b"bbb") |
|
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
716 |
self.assertRevisionRoot(revtree1, path) |
717 |
self.assertRevisionRoot(revtree2, path) |
|
718 |
||
719 |
def test_delete_then_add_file_in_subdir(self): |
|
720 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
721 |
path = b'a/a' |
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
722 |
handler.process(self.file_command_iter(path)) |
723 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
724 |
expected_added=[(b'a',), (path,)]) |
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
725 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
726 |
expected_removed=[(path,)], |
|
727 |
expected_added=[(path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
728 |
self.assertContent(branch, revtree1, path, b"aaa") |
729 |
self.assertContent(branch, revtree2, path, b"bbb") |
|
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
730 |
|
731 |
def test_delete_then_add_symlink_in_root(self): |
|
732 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
733 |
path = b'a' |
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
734 |
handler.process(self.file_command_iter(path, kind='symlink')) |
735 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
736 |
expected_removed=[(path,)], |
|
737 |
expected_added=[(path,)]) |
|
738 |
self.assertSymlinkTarget(branch, revtree1, path, "aaa") |
|
739 |
self.assertSymlinkTarget(branch, revtree2, path, "bbb") |
|
740 |
self.assertRevisionRoot(revtree1, path) |
|
741 |
self.assertRevisionRoot(revtree2, path) |
|
742 |
||
743 |
def test_delete_then_add_symlink_in_subdir(self): |
|
744 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
745 |
path = b'a/a' |
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
746 |
handler.process(self.file_command_iter(path, kind='symlink')) |
747 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
748 |
expected_added=[(b'a',), (path,)]) |
|
0.99.13
by Ian Clatworthy
Handle delete then add of a file/symlink in the one commit |
749 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
750 |
expected_removed=[(path,)], |
|
751 |
expected_added=[(path,)]) |
|
752 |
self.assertSymlinkTarget(branch, revtree1, path, "aaa") |
|
753 |
self.assertSymlinkTarget(branch, revtree2, path, "bbb") |
|
754 |
||
755 |
||
|
0.85.1
by Ian Clatworthy
extend tests to test the chk code path |
756 |
class TestImportToPackDeleteDirectory(TestCaseForGenericProcessor): |
|
0.80.7
by Ian Clatworthy
add directory delete test |
757 |
|
758 |
def file_command_iter(self, paths, dir): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
759 |
|
|
0.80.7
by Ian Clatworthy
add directory delete test |
760 |
# Revno 1: create multiple files
|
761 |
# Revno 2: delete a directory holding those files
|
|
762 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
763 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
764 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.80.7
by Ian Clatworthy
add directory delete test |
765 |
def files_one(): |
766 |
for i, path in enumerate(paths): |
|
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
767 |
yield commands.FileModifyCommand(path, kind_to_mode('file', False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
768 |
None, b"aaa%d" % i) |
769 |
yield commands.CommitCommand(b'head', b'1', author, |
|
770 |
committer, b"commit 1", None, [], files_one) |
|
|
0.80.7
by Ian Clatworthy
add directory delete test |
771 |
def files_two(): |
772 |
yield commands.FileDeleteCommand(dir) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
773 |
yield commands.CommitCommand(b'head', b'2', author, |
774 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.80.7
by Ian Clatworthy
add directory delete test |
775 |
return command_list |
776 |
||
777 |
def test_delete_dir(self): |
|
778 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
779 |
paths = [b'a/b/c', b'a/b/d', b'a/b/e/f', b'a/g'] |
780 |
dir = b'a/b' |
|
|
0.80.7
by Ian Clatworthy
add directory delete test |
781 |
handler.process(self.file_command_iter(paths, dir)) |
782 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
783 |
expected_added=[ |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
784 |
(b'a',), (b'a/b',), (b'a/b/c',), |
785 |
(b'a/b/d',), |
|
786 |
(b'a/b/e',), (b'a/b/e/f',), |
|
787 |
(b'a/g',), |
|
|
0.80.7
by Ian Clatworthy
add directory delete test |
788 |
])
|
789 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
790 |
expected_removed=[ |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
791 |
(b'a/b',), (b'a/b/c',), |
792 |
(b'a/b/d',), |
|
793 |
(b'a/b/e',), (b'a/b/e/f',), |
|
|
0.80.7
by Ian Clatworthy
add directory delete test |
794 |
])
|
795 |
||
796 |
||
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
797 |
class TestImportToPackDeleteDirectoryThenAddFile(TestCaseForGenericProcessor): |
798 |
"""Test deleting a directory then adding a file in the same commit.""" |
|
799 |
||
800 |
def file_command_iter(self, paths, dir, new_path, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
801 |
|
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
802 |
# Revno 1: create files in a directory
|
803 |
# Revno 2: delete the directory then add a file into it
|
|
804 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
805 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
806 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
807 |
def files_one(): |
808 |
for i, path in enumerate(paths): |
|
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
809 |
yield commands.FileModifyCommand(path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
810 |
None, b"aaa%d" % i) |
811 |
yield commands.CommitCommand(b'head', b'1', author, |
|
812 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
813 |
def files_two(): |
814 |
yield commands.FileDeleteCommand(dir) |
|
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
815 |
yield commands.FileModifyCommand(new_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
816 |
None, b"bbb") |
817 |
yield commands.CommitCommand(b'head', b'2', author, |
|
818 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
819 |
return command_list |
820 |
||
821 |
def test_delete_dir_then_add_file(self): |
|
822 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
823 |
paths = [b'a/b/c', b'a/b/d'] |
824 |
dir = b'a/b' |
|
825 |
new_path = b'a/b/z' |
|
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
826 |
handler.process(self.file_command_iter(paths, dir, new_path)) |
827 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
828 |
expected_added=[(b'a',), (b'a/b',), (b'a/b/c',), (b'a/b/d',),]) |
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
829 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
830 |
expected_removed=[(b'a/b',), (b'a/b/c',), (b'a/b/d',)], |
831 |
expected_added=[(b'a/b',), (b'a/b/z',)]) |
|
832 |
self.assertContent(branch, revtree2, new_path, b"bbb") |
|
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
833 |
|
834 |
def test_delete_dir_then_add_symlink(self): |
|
835 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
836 |
paths = [b'a/b/c', b'a/b/d'] |
837 |
dir = b'a/b' |
|
838 |
new_path = b'a/b/z' |
|
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
839 |
handler.process(self.file_command_iter(paths, dir, new_path, 'symlink')) |
840 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
841 |
expected_added=[(b'a',), (b'a/b',), (b'a/b/c',), (b'a/b/d',),]) |
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
842 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
843 |
expected_removed=[(b'a/b',), (b'a/b/c',), (b'a/b/d',)], |
844 |
expected_added=[(b'a/b',), (b'a/b/z',)]) |
|
|
0.99.21
by Ian Clatworthy
Handle deleting a directory then adding a file within it in the same commit |
845 |
self.assertSymlinkTarget(branch, revtree2, new_path, "bbb") |
846 |
||
847 |
||
|
0.85.1
by Ian Clatworthy
extend tests to test the chk code path |
848 |
class TestImportToPackRename(TestCaseForGenericProcessor): |
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
849 |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
850 |
def get_command_iter(self, old_path, new_path, kind='file'): |
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
851 |
|
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
852 |
# Revno 1: create a file or symlink
|
853 |
# Revno 2: rename it
|
|
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
854 |
def command_list(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
855 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
856 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
857 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
858 |
yield commands.FileModifyCommand(old_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
859 |
None, b"aaa") |
860 |
yield commands.CommitCommand(b'head', b'1', author, |
|
861 |
committer, b"commit 1", None, [], files_one) |
|
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
862 |
def files_two(): |
863 |
yield commands.FileRenameCommand(old_path, new_path) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
864 |
yield commands.CommitCommand(b'head', b'2', author, |
865 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
866 |
return command_list |
867 |
||
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
868 |
def test_rename_file_in_root(self): |
869 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
870 |
old_path = b'a' |
871 |
new_path = b'b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
872 |
handler.process(self.get_command_iter(old_path, new_path)) |
873 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
874 |
expected_renamed=[(old_path, new_path)]) |
|
875 |
self.assertRevisionRoot(revtree1, old_path) |
|
876 |
self.assertRevisionRoot(revtree2, new_path) |
|
877 |
||
878 |
def test_rename_symlink_in_root(self): |
|
879 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
880 |
old_path = b'a' |
881 |
new_path = b'b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
882 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
883 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
884 |
expected_renamed=[(old_path, new_path)]) |
|
885 |
self.assertRevisionRoot(revtree1, old_path) |
|
886 |
self.assertRevisionRoot(revtree2, new_path) |
|
887 |
||
888 |
def test_rename_file_in_subdir(self): |
|
889 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
890 |
old_path = b'a/a' |
891 |
new_path = b'a/b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
892 |
handler.process(self.get_command_iter(old_path, new_path)) |
893 |
self.assertChanges(branch, 2, expected_renamed=[(old_path, new_path)]) |
|
894 |
||
895 |
def test_rename_symlink_in_subdir(self): |
|
896 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
897 |
old_path = b'a/a' |
898 |
new_path = b'a/b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
899 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
900 |
self.assertChanges(branch, 2, expected_renamed=[(old_path, new_path)]) |
|
901 |
||
902 |
def test_rename_file_to_new_dir(self): |
|
903 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
904 |
old_path = b'a/a' |
905 |
new_path = b'b/a' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
906 |
handler.process(self.get_command_iter(old_path, new_path)) |
907 |
self.assertChanges(branch, 2, |
|
908 |
expected_renamed=[(old_path, new_path)], |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
909 |
expected_added=[(b'b',)], |
910 |
expected_removed=[(b'a',)]) |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
911 |
|
912 |
def test_rename_symlink_to_new_dir(self): |
|
913 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
914 |
old_path = b'a/a' |
915 |
new_path = b'b/a' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
916 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
|
0.96.1
by Ian Clatworthy
update existing tests to reflect implicit directory pruning bahaviour |
917 |
self.assertChanges(branch, 2, |
918 |
expected_renamed=[(old_path, new_path)], |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
919 |
expected_added=[(b'b',)], |
920 |
expected_removed=[(b'a',)]) |
|
|
0.64.74
by Ian Clatworthy
fix symlink importing |
921 |
|
922 |
||
|
0.99.6
by Ian Clatworthy
Handle rename of a just added file |
923 |
class TestImportToPackRenameNew(TestCaseForGenericProcessor): |
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
924 |
"""Test rename of a newly added file.""" |
|
0.99.6
by Ian Clatworthy
Handle rename of a just added file |
925 |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
926 |
def get_command_iter(self, old_path, new_path, kind='file'): |
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
927 |
|
|
0.99.6
by Ian Clatworthy
Handle rename of a just added file |
928 |
# Revno 1: create a file and rename it
|
929 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
930 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
931 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.6
by Ian Clatworthy
Handle rename of a just added file |
932 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
933 |
yield commands.FileModifyCommand(old_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
934 |
None, b"aaa") |
|
0.99.6
by Ian Clatworthy
Handle rename of a just added file |
935 |
yield commands.FileRenameCommand(old_path, new_path) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
936 |
yield commands.CommitCommand(b'head', b'1', author, |
937 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.6
by Ian Clatworthy
Handle rename of a just added file |
938 |
return command_list |
939 |
||
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
940 |
def test_rename_new_file_in_root(self): |
941 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
942 |
old_path = b'a' |
943 |
new_path = b'b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
944 |
handler.process(self.get_command_iter(old_path, new_path)) |
945 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
946 |
expected_added=[(new_path,)]) |
|
947 |
self.assertRevisionRoot(revtree1, new_path) |
|
948 |
||
949 |
def test_rename_new_symlink_in_root(self): |
|
950 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
951 |
old_path = b'a' |
952 |
new_path = b'b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
953 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
954 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
955 |
expected_added=[(new_path,)]) |
|
956 |
self.assertRevisionRoot(revtree1, new_path) |
|
957 |
||
958 |
def test_rename_new_file_in_subdir(self): |
|
959 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
960 |
old_path = b'a/a' |
961 |
new_path = b'a/b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
962 |
handler.process(self.get_command_iter(old_path, new_path)) |
963 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
964 |
expected_added=[(b'a',), (new_path,)]) |
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
965 |
|
966 |
def test_rename_new_symlink_in_subdir(self): |
|
967 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
968 |
old_path = b'a/a' |
969 |
new_path = b'a/b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
970 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
|
0.99.6
by Ian Clatworthy
Handle rename of a just added file |
971 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
972 |
expected_added=[(b'a',), (new_path,)]) |
|
0.99.6
by Ian Clatworthy
Handle rename of a just added file |
973 |
|
974 |
||
|
0.99.14
by Ian Clatworthy
Add tests for renaming to a deleted destination |
975 |
class TestImportToPackRenameToDeleted(TestCaseForGenericProcessor): |
976 |
"""Test rename to a destination path deleted in this commit.""" |
|
977 |
||
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
978 |
def get_command_iter(self, old_path, new_path, kind='file'): |
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
979 |
|
|
0.99.14
by Ian Clatworthy
Add tests for renaming to a deleted destination |
980 |
# Revno 1: create two files
|
981 |
# Revno 2: delete one, rename the other one to that path
|
|
982 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
983 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
984 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.14
by Ian Clatworthy
Add tests for renaming to a deleted destination |
985 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
986 |
yield commands.FileModifyCommand(old_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
987 |
None, b"aaa") |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
988 |
yield commands.FileModifyCommand(new_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
989 |
None, b"bbb") |
990 |
yield commands.CommitCommand(b'head', b'1', author, |
|
991 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.14
by Ian Clatworthy
Add tests for renaming to a deleted destination |
992 |
def files_two(): |
993 |
yield commands.FileDeleteCommand(new_path) |
|
994 |
yield commands.FileRenameCommand(old_path, new_path) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
995 |
yield commands.CommitCommand(b'head', b'2', author, |
996 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.99.14
by Ian Clatworthy
Add tests for renaming to a deleted destination |
997 |
return command_list |
998 |
||
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
999 |
def test_rename_to_deleted_file_in_root(self): |
1000 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1001 |
old_path = b'a' |
1002 |
new_path = b'b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1003 |
handler.process(self.get_command_iter(old_path, new_path)) |
1004 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1005 |
expected_added=[(old_path,), (new_path,)]) |
|
1006 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1007 |
expected_removed=[(new_path,)], |
|
1008 |
expected_renamed=[(old_path, new_path)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1009 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
1010 |
self.assertContent(branch, revtree1, new_path, b"bbb") |
|
1011 |
self.assertContent(branch, revtree2, new_path, b"aaa") |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1012 |
self.assertRevisionRoot(revtree1, old_path) |
1013 |
self.assertRevisionRoot(revtree1, new_path) |
|
1014 |
||
1015 |
def test_rename_to_deleted_symlink_in_root(self): |
|
1016 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1017 |
old_path = b'a' |
1018 |
new_path = b'b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1019 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1020 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1021 |
expected_added=[(old_path,), (new_path,)]) |
|
1022 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1023 |
expected_removed=[(new_path,)], |
|
1024 |
expected_renamed=[(old_path, new_path)]) |
|
1025 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
|
1026 |
self.assertSymlinkTarget(branch, revtree1, new_path, "bbb") |
|
1027 |
self.assertSymlinkTarget(branch, revtree2, new_path, "aaa") |
|
1028 |
self.assertRevisionRoot(revtree1, old_path) |
|
1029 |
self.assertRevisionRoot(revtree1, new_path) |
|
1030 |
||
1031 |
def test_rename_to_deleted_file_in_subdir(self): |
|
1032 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1033 |
old_path = b'd/a' |
1034 |
new_path = b'd/b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1035 |
handler.process(self.get_command_iter(old_path, new_path)) |
1036 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1037 |
expected_added=[(b'd',), (old_path,), (new_path,)]) |
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1038 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
1039 |
expected_removed=[(new_path,)], |
|
1040 |
expected_renamed=[(old_path, new_path)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1041 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
1042 |
self.assertContent(branch, revtree1, new_path, b"bbb") |
|
1043 |
self.assertContent(branch, revtree2, new_path, b"aaa") |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1044 |
|
1045 |
def test_rename_to_deleted_symlink_in_subdir(self): |
|
1046 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1047 |
old_path = b'd/a' |
1048 |
new_path = b'd/b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1049 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1050 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1051 |
expected_added=[(b'd',), (old_path,), (new_path,)]) |
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1052 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
1053 |
expected_removed=[(new_path,)], |
|
1054 |
expected_renamed=[(old_path, new_path)]) |
|
1055 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
|
1056 |
self.assertSymlinkTarget(branch, revtree1, new_path, "bbb") |
|
1057 |
self.assertSymlinkTarget(branch, revtree2, new_path, "aaa") |
|
1058 |
||
1059 |
def test_rename_to_deleted_file_in_new_dir(self): |
|
1060 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1061 |
old_path = b'd1/a' |
1062 |
new_path = b'd2/b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1063 |
handler.process(self.get_command_iter(old_path, new_path)) |
1064 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1065 |
expected_added=[(b'd1',), (old_path,), (b'd2',), (new_path,)]) |
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1066 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1067 |
expected_removed=[(b'd1',), (new_path,)], |
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1068 |
expected_renamed=[(old_path, new_path)]) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1069 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
1070 |
self.assertContent(branch, revtree1, new_path, b"bbb") |
|
1071 |
self.assertContent(branch, revtree2, new_path, b"aaa") |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1072 |
|
1073 |
def test_rename_to_deleted_symlink_in_new_dir(self): |
|
1074 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1075 |
old_path = b'd1/a' |
1076 |
new_path = b'd2/b' |
|
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1077 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1078 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1079 |
expected_added=[(b'd1',), (old_path,), (b'd2',), (new_path,)]) |
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1080 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1081 |
expected_removed=[(b'd1',), (new_path,)], |
|
0.99.16
by Ian Clatworthy
add tests for symlink renaming |
1082 |
expected_renamed=[(old_path, new_path)]) |
1083 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
|
1084 |
self.assertSymlinkTarget(branch, revtree1, new_path, "bbb") |
|
1085 |
self.assertSymlinkTarget(branch, revtree2, new_path, "aaa") |
|
|
0.99.14
by Ian Clatworthy
Add tests for renaming to a deleted destination |
1086 |
|
1087 |
||
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1088 |
class TestImportToPackRenameModified(TestCaseForGenericProcessor): |
1089 |
"""Test rename of a path previously modified in this commit.""" |
|
1090 |
||
1091 |
def get_command_iter(self, old_path, new_path, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
1092 |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1093 |
# Revno 1: create a file or symlink
|
1094 |
# Revno 2: modify then rename it
|
|
1095 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1096 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
1097 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1098 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1099 |
yield commands.FileModifyCommand(old_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1100 |
None, b"aaa") |
1101 |
yield commands.CommitCommand(b'head', b'1', author, |
|
1102 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1103 |
def files_two(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1104 |
yield commands.FileModifyCommand(old_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1105 |
None, b"bbb") |
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1106 |
yield commands.FileRenameCommand(old_path, new_path) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1107 |
yield commands.CommitCommand(b'head', b'2', author, |
1108 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1109 |
return command_list |
1110 |
||
1111 |
def test_rename_of_modified_file_in_root(self): |
|
1112 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1113 |
old_path = b'a' |
1114 |
new_path = b'b' |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1115 |
handler.process(self.get_command_iter(old_path, new_path)) |
1116 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1117 |
expected_added=[(old_path,)]) |
|
1118 |
# Note: the delta doesn't show the modification?
|
|
1119 |
# The actual new content is validated in the assertions following.
|
|
1120 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1121 |
expected_renamed=[(old_path, new_path)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1122 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
1123 |
self.assertContent(branch, revtree2, new_path, b"bbb") |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1124 |
self.assertRevisionRoot(revtree1, old_path) |
1125 |
self.assertRevisionRoot(revtree2, new_path) |
|
1126 |
||
1127 |
def test_rename_of_modified_symlink_in_root(self): |
|
1128 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1129 |
old_path = b'a' |
1130 |
new_path = b'b' |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1131 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1132 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1133 |
expected_added=[(old_path,)]) |
|
1134 |
# Note: the delta doesn't show the modification?
|
|
1135 |
# The actual new content is validated in the assertions following.
|
|
1136 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1137 |
expected_renamed=[(old_path, new_path)]) |
|
1138 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
|
1139 |
self.assertSymlinkTarget(branch, revtree2, new_path, "bbb") |
|
1140 |
self.assertRevisionRoot(revtree1, old_path) |
|
1141 |
self.assertRevisionRoot(revtree2, new_path) |
|
1142 |
||
1143 |
def test_rename_of_modified_file_in_subdir(self): |
|
1144 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1145 |
old_path = b'd/a' |
1146 |
new_path = b'd/b' |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1147 |
handler.process(self.get_command_iter(old_path, new_path)) |
1148 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1149 |
expected_added=[(b'd',), (old_path,)]) |
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1150 |
# Note: the delta doesn't show the modification?
|
1151 |
# The actual new content is validated in the assertions following.
|
|
1152 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1153 |
expected_renamed=[(old_path, new_path)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1154 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
1155 |
self.assertContent(branch, revtree2, new_path, b"bbb") |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1156 |
|
1157 |
def test_rename_of_modified_symlink_in_subdir(self): |
|
1158 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1159 |
old_path = b'd/a' |
1160 |
new_path = b'd/b' |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1161 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1162 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1163 |
expected_added=[(b'd',), (old_path,)]) |
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1164 |
# Note: the delta doesn't show the modification?
|
1165 |
# The actual new content is validated in the assertions following.
|
|
1166 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1167 |
expected_renamed=[(old_path, new_path)]) |
|
1168 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
|
1169 |
self.assertSymlinkTarget(branch, revtree2, new_path, "bbb") |
|
1170 |
||
1171 |
def test_rename_of_modified_file_to_new_dir(self): |
|
1172 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1173 |
old_path = b'd1/a' |
1174 |
new_path = b'd2/b' |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1175 |
handler.process(self.get_command_iter(old_path, new_path)) |
1176 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1177 |
expected_added=[(b'd1',), (old_path,)]) |
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1178 |
# Note: the delta doesn't show the modification?
|
1179 |
# The actual new content is validated in the assertions following.
|
|
1180 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1181 |
expected_renamed=[(old_path, new_path)], |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1182 |
expected_added=[(b'd2',)], |
1183 |
expected_removed=[(b'd1',)]) |
|
1184 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
|
1185 |
self.assertContent(branch, revtree2, new_path, b"bbb") |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1186 |
|
1187 |
def test_rename_of_modified_symlink_to_new_dir(self): |
|
1188 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1189 |
old_path = b'd1/a' |
1190 |
new_path = b'd2/b' |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1191 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1192 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1193 |
expected_added=[(b'd1',), (old_path,)]) |
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1194 |
# Note: the delta doesn't show the modification?
|
1195 |
# The actual new content is validated in the assertions following.
|
|
1196 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1197 |
expected_renamed=[(old_path, new_path)], |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1198 |
expected_added=[(b'd2',)], |
1199 |
expected_removed=[(b'd1',)]) |
|
|
0.99.17
by Ian Clatworthy
Handle rename of a file/symlink modified already in this commit |
1200 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
1201 |
self.assertSymlinkTarget(branch, revtree2, new_path, "bbb") |
|
1202 |
||
1203 |
||
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1204 |
class TestImportToPackRenameThenModify(TestCaseForGenericProcessor): |
1205 |
"""Test rename of a path then modfy the new-path in the same commit.""" |
|
1206 |
||
1207 |
def get_command_iter(self, old_path, new_path, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
1208 |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1209 |
# Revno 1: create a file or symlink
|
1210 |
# Revno 2: rename it then modify the newly created path
|
|
1211 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1212 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
1213 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1214 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1215 |
yield commands.FileModifyCommand(old_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1216 |
None, b"aaa") |
1217 |
yield commands.CommitCommand(b'head', b'1', author, |
|
1218 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1219 |
def files_two(): |
1220 |
yield commands.FileRenameCommand(old_path, new_path) |
|
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1221 |
yield commands.FileModifyCommand(new_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1222 |
None, b"bbb") |
1223 |
yield commands.CommitCommand(b'head', b'2', author, |
|
1224 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1225 |
return command_list |
1226 |
||
1227 |
def test_rename_then_modify_file_in_root(self): |
|
1228 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1229 |
old_path = b'a' |
1230 |
new_path = b'b' |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1231 |
handler.process(self.get_command_iter(old_path, new_path)) |
1232 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1233 |
expected_added=[(old_path,)]) |
|
1234 |
# Note: the delta doesn't show the modification?
|
|
1235 |
# The actual new content is validated in the assertions following.
|
|
1236 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1237 |
expected_renamed=[(old_path, new_path)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1238 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
1239 |
self.assertContent(branch, revtree2, new_path, b"bbb") |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1240 |
self.assertRevisionRoot(revtree1, old_path) |
1241 |
self.assertRevisionRoot(revtree2, new_path) |
|
1242 |
||
1243 |
def test_rename_then_modify_file_in_subdir(self): |
|
1244 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1245 |
old_path = b'd/a' |
1246 |
new_path = b'd/b' |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1247 |
handler.process(self.get_command_iter(old_path, new_path)) |
1248 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1249 |
expected_added=[(b'd',), (old_path,)]) |
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1250 |
# Note: the delta doesn't show the modification?
|
1251 |
# The actual new content is validated in the assertions following.
|
|
1252 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1253 |
expected_renamed=[(old_path, new_path)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1254 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
1255 |
self.assertContent(branch, revtree2, new_path, b"bbb") |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1256 |
|
1257 |
def test_rename_then_modify_file_in_new_dir(self): |
|
1258 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1259 |
old_path = b'd1/a' |
1260 |
new_path = b'd2/b' |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1261 |
handler.process(self.get_command_iter(old_path, new_path)) |
1262 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1263 |
expected_added=[(b'd1',), (old_path,)]) |
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1264 |
# Note: the delta doesn't show the modification?
|
1265 |
# The actual new content is validated in the assertions following.
|
|
1266 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1267 |
expected_renamed=[(old_path, new_path)], |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1268 |
expected_added=[(b'd2',)], |
1269 |
expected_removed=[(b'd1',)]) |
|
1270 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
|
1271 |
self.assertContent(branch, revtree2, new_path, b"bbb") |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1272 |
|
1273 |
def test_rename_then_modify_symlink_in_root(self): |
|
1274 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1275 |
old_path = b'a' |
1276 |
new_path = b'b' |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1277 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1278 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1279 |
expected_added=[(old_path,)]) |
|
1280 |
# Note: the delta doesn't show the modification?
|
|
1281 |
# The actual new content is validated in the assertions following.
|
|
1282 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1283 |
expected_renamed=[(old_path, new_path)]) |
|
1284 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
|
1285 |
self.assertSymlinkTarget(branch, revtree2, new_path, "bbb") |
|
1286 |
self.assertRevisionRoot(revtree1, old_path) |
|
1287 |
self.assertRevisionRoot(revtree2, new_path) |
|
1288 |
||
1289 |
def test_rename_then_modify_symlink_in_subdir(self): |
|
1290 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1291 |
old_path = b'd/a' |
1292 |
new_path = b'd/b' |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1293 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1294 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1295 |
expected_added=[(b'd',), (old_path,)]) |
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1296 |
# Note: the delta doesn't show the modification?
|
1297 |
# The actual new content is validated in the assertions following.
|
|
1298 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1299 |
expected_renamed=[(old_path, new_path)]) |
|
1300 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
|
1301 |
self.assertSymlinkTarget(branch, revtree2, new_path, "bbb") |
|
1302 |
||
1303 |
def test_rename_then_modify_symlink_in_new_dir(self): |
|
1304 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1305 |
old_path = b'd1/a' |
1306 |
new_path = b'd2/b' |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1307 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1308 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1309 |
expected_added=[(b'd1',), (old_path,)]) |
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1310 |
# Note: the delta doesn't show the modification?
|
1311 |
# The actual new content is validated in the assertions following.
|
|
1312 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1313 |
expected_renamed=[(old_path, new_path)], |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1314 |
expected_added=[(b'd2',)], |
1315 |
expected_removed=[(b'd1',)]) |
|
|
0.99.19
by Ian Clatworthy
Handle rename then modification of the new path |
1316 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
1317 |
self.assertSymlinkTarget(branch, revtree2, new_path, "bbb") |
|
1318 |
||
1319 |
||
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1320 |
class TestImportToPackDeleteRenameThenModify(TestCaseForGenericProcessor): |
1321 |
"""Test rename of to a deleted path then modfy the new-path in the same commit.""" |
|
1322 |
||
1323 |
def get_command_iter(self, old_path, new_path, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
1324 |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1325 |
# Revno 1: create two files or symlinks
|
1326 |
# Revno 2: delete one, rename the other to it then modify the newly created path
|
|
1327 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1328 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
1329 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1330 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1331 |
yield commands.FileModifyCommand(old_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1332 |
None, b"aaa") |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1333 |
yield commands.FileModifyCommand(new_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1334 |
None, b"zzz") |
1335 |
yield commands.CommitCommand(b'head', b'1', author, |
|
1336 |
committer, b"commit 1", None, [], files_one) |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1337 |
def files_two(): |
1338 |
yield commands.FileDeleteCommand(new_path) |
|
1339 |
yield commands.FileRenameCommand(old_path, new_path) |
|
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1340 |
yield commands.FileModifyCommand(new_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1341 |
None, b"bbb") |
1342 |
yield commands.CommitCommand(b'head', b'2', author, |
|
1343 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1344 |
return command_list |
1345 |
||
1346 |
def test_delete_rename_then_modify_file_in_root(self): |
|
1347 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1348 |
old_path = b'a' |
1349 |
new_path = b'b' |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1350 |
handler.process(self.get_command_iter(old_path, new_path)) |
1351 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1352 |
expected_added=[(old_path,), (new_path,)]) |
|
1353 |
# Note: the delta doesn't show the modification?
|
|
1354 |
# The actual new content is validated in the assertions following.
|
|
1355 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1356 |
expected_removed=[(new_path,)], |
|
1357 |
expected_renamed=[(old_path, new_path)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1358 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
1359 |
self.assertContent(branch, revtree1, new_path, b"zzz") |
|
1360 |
self.assertContent(branch, revtree2, new_path, b"bbb") |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1361 |
self.assertRevisionRoot(revtree1, old_path) |
1362 |
self.assertRevisionRoot(revtree1, new_path) |
|
1363 |
self.assertRevisionRoot(revtree2, new_path) |
|
1364 |
||
1365 |
def test_delete_rename_then_modify_file_in_subdir(self): |
|
1366 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1367 |
old_path = b'd/a' |
1368 |
new_path = b'd/b' |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1369 |
handler.process(self.get_command_iter(old_path, new_path)) |
1370 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1371 |
expected_added=[(b'd',), (old_path,), (new_path,)]) |
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1372 |
# Note: the delta doesn't show the modification?
|
1373 |
# The actual new content is validated in the assertions following.
|
|
1374 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1375 |
expected_removed=[(new_path,)], |
|
1376 |
expected_renamed=[(old_path, new_path)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1377 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
1378 |
self.assertContent(branch, revtree1, new_path, b"zzz") |
|
1379 |
self.assertContent(branch, revtree2, new_path, b"bbb") |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1380 |
|
1381 |
def test_delete_rename_then_modify_file_in_new_dir(self): |
|
1382 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1383 |
old_path = b'd1/a' |
1384 |
new_path = b'd2/b' |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1385 |
handler.process(self.get_command_iter(old_path, new_path)) |
1386 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1387 |
expected_added=[(b'd1',), (b'd2',), (old_path,), (new_path,)]) |
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1388 |
# Note: the delta doesn't show the modification?
|
1389 |
# The actual new content is validated in the assertions following.
|
|
1390 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1391 |
expected_removed=[(b'd1',), (new_path,)], |
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1392 |
expected_renamed=[(old_path, new_path)]) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1393 |
self.assertContent(branch, revtree1, old_path, b"aaa") |
1394 |
self.assertContent(branch, revtree1, new_path, b"zzz") |
|
1395 |
self.assertContent(branch, revtree2, new_path, b"bbb") |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1396 |
|
1397 |
def test_delete_rename_then_modify_symlink_in_root(self): |
|
1398 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1399 |
old_path = b'a' |
1400 |
new_path = b'b' |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1401 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1402 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1403 |
expected_added=[(old_path,), (new_path,)]) |
|
1404 |
# Note: the delta doesn't show the modification?
|
|
1405 |
# The actual new content is validated in the assertions following.
|
|
1406 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1407 |
expected_removed=[(new_path,)], |
|
1408 |
expected_renamed=[(old_path, new_path)]) |
|
1409 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
|
1410 |
self.assertSymlinkTarget(branch, revtree1, new_path, "zzz") |
|
1411 |
self.assertSymlinkTarget(branch, revtree2, new_path, "bbb") |
|
1412 |
self.assertRevisionRoot(revtree1, old_path) |
|
1413 |
self.assertRevisionRoot(revtree1, new_path) |
|
1414 |
self.assertRevisionRoot(revtree2, new_path) |
|
1415 |
||
1416 |
def test_delete_rename_then_modify_symlink_in_subdir(self): |
|
1417 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1418 |
old_path = b'd/a' |
1419 |
new_path = b'd/b' |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1420 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1421 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1422 |
expected_added=[(b'd',), (old_path,), (new_path,)]) |
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1423 |
# Note: the delta doesn't show the modification?
|
1424 |
# The actual new content is validated in the assertions following.
|
|
1425 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1426 |
expected_removed=[(new_path,)], |
|
1427 |
expected_renamed=[(old_path, new_path)]) |
|
1428 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
|
1429 |
self.assertSymlinkTarget(branch, revtree1, new_path, "zzz") |
|
1430 |
self.assertSymlinkTarget(branch, revtree2, new_path, "bbb") |
|
1431 |
||
1432 |
def test_delete_rename_then_modify_symlink_in_new_dir(self): |
|
1433 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1434 |
old_path = b'd1/a' |
1435 |
new_path = b'd2/b' |
|
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1436 |
handler.process(self.get_command_iter(old_path, new_path, 'symlink')) |
1437 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1438 |
expected_added=[(b'd1',), (b'd2',), (old_path,), (new_path,)]) |
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1439 |
# Note: the delta doesn't show the modification?
|
1440 |
# The actual new content is validated in the assertions following.
|
|
1441 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1442 |
expected_removed=[(b'd1',), (new_path,)], |
|
0.64.233
by Ian Clatworthy
Handle delete, rename then modify all in the one commit |
1443 |
expected_renamed=[(old_path, new_path)]) |
1444 |
self.assertSymlinkTarget(branch, revtree1, old_path, "aaa") |
|
1445 |
self.assertSymlinkTarget(branch, revtree1, new_path, "zzz") |
|
1446 |
self.assertSymlinkTarget(branch, revtree2, new_path, "bbb") |
|
1447 |
||
1448 |
||
|
0.85.1
by Ian Clatworthy
extend tests to test the chk code path |
1449 |
class TestImportToPackRenameTricky(TestCaseForGenericProcessor): |
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1450 |
|
1451 |
def file_command_iter(self, path1, old_path2, new_path2, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
1452 |
|
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1453 |
# Revno 1: create two files or symlinks in a directory
|
1454 |
# Revno 2: rename the second file so that it implicitly deletes the
|
|
1455 |
# first one because either:
|
|
1456 |
# * the new file is a in directory with the old file name
|
|
1457 |
# * the new file has the same name as the directory of the first
|
|
1458 |
def command_list(): |
|
|
6973.14.12
by Jelmer Vernooij
Merge trunk. |
1459 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
1460 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1461 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1462 |
yield commands.FileModifyCommand(path1, kind_to_mode(kind, False), |
|
6973.14.12
by Jelmer Vernooij
Merge trunk. |
1463 |
None, b"aaa") |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1464 |
yield commands.FileModifyCommand(old_path2, kind_to_mode(kind, False), |
|
6973.14.12
by Jelmer Vernooij
Merge trunk. |
1465 |
None, b"bbb") |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1466 |
yield commands.CommitCommand(b'head', b'1', author, |
1467 |
committer, b"commit 1", None, [], files_one) |
|
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1468 |
def files_two(): |
1469 |
yield commands.FileRenameCommand(old_path2, new_path2) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1470 |
yield commands.CommitCommand(b'head', b'2', author, |
1471 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1472 |
return command_list |
1473 |
||
1474 |
def test_rename_file_becomes_directory(self): |
|
1475 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1476 |
old_path2 = b'foo' |
1477 |
path1 = b'a/b' |
|
1478 |
new_path2 = b'a/b/c' |
|
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1479 |
handler.process(self.file_command_iter(path1, old_path2, new_path2)) |
1480 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1481 |
expected_added=[(b'a',), (path1,), (old_path2,)]) |
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1482 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
1483 |
expected_renamed=[(old_path2, new_path2)], |
|
1484 |
expected_kind_changed=[(path1, 'file', 'directory')]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1485 |
self.assertContent(branch, revtree1, path1, b"aaa") |
1486 |
self.assertContent(branch, revtree2, new_path2, b"bbb") |
|
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1487 |
|
1488 |
def test_rename_directory_becomes_file(self): |
|
1489 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1490 |
old_path2 = b'foo' |
1491 |
path1 = b'a/b/c' |
|
1492 |
new_path2 = b'a/b' |
|
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1493 |
handler.process(self.file_command_iter(path1, old_path2, new_path2)) |
1494 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1495 |
expected_added=[(b'a',), (b'a/b',), (path1,), (old_path2,)]) |
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1496 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
1497 |
expected_renamed=[(old_path2, new_path2)], |
|
1498 |
expected_removed=[(path1,), (new_path2,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1499 |
self.assertContent(branch, revtree1, path1, b"aaa") |
1500 |
self.assertContent(branch, revtree2, new_path2, b"bbb") |
|
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1501 |
|
1502 |
def test_rename_symlink_becomes_directory(self): |
|
1503 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1504 |
old_path2 = b'foo' |
1505 |
path1 = b'a/b' |
|
1506 |
new_path2 = b'a/b/c' |
|
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1507 |
handler.process(self.file_command_iter(path1, old_path2, new_path2, |
1508 |
'symlink')) |
|
1509 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1510 |
expected_added=[(b'a',), (path1,), (old_path2,)]) |
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1511 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
1512 |
expected_renamed=[(old_path2, new_path2)], |
|
1513 |
expected_kind_changed=[(path1, 'symlink', 'directory')]) |
|
1514 |
self.assertSymlinkTarget(branch, revtree1, path1, "aaa") |
|
1515 |
self.assertSymlinkTarget(branch, revtree2, new_path2, "bbb") |
|
1516 |
||
1517 |
def test_rename_directory_becomes_symlink(self): |
|
1518 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1519 |
old_path2 = b'foo' |
1520 |
path1 = b'a/b/c' |
|
1521 |
new_path2 = b'a/b' |
|
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1522 |
handler.process(self.file_command_iter(path1, old_path2, new_path2, |
1523 |
'symlink')) |
|
1524 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1525 |
expected_added=[(b'a',), (b'a/b',), (path1,), (old_path2,)]) |
|
0.80.6
by Ian Clatworthy
file/symlink <-> directory rename tests |
1526 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
1527 |
expected_renamed=[(old_path2, new_path2)], |
|
1528 |
expected_removed=[(path1,), (new_path2,)]) |
|
1529 |
self.assertSymlinkTarget(branch, revtree1, path1, "aaa") |
|
1530 |
self.assertSymlinkTarget(branch, revtree2, new_path2, "bbb") |
|
1531 |
||
1532 |
||
|
0.85.1
by Ian Clatworthy
extend tests to test the chk code path |
1533 |
class TestImportToPackCopy(TestCaseForGenericProcessor): |
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1534 |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1535 |
def file_command_iter(self, src_path, dest_path, kind='file'): |
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
1536 |
|
|
0.80.4
by Ian Clatworthy
file executable off <-> on tests |
1537 |
# Revno 1: create a file or symlink
|
1538 |
# Revno 2: copy it
|
|
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1539 |
def command_list(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1540 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
1541 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1542 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1543 |
yield commands.FileModifyCommand(src_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1544 |
None, b"aaa") |
1545 |
yield commands.CommitCommand(b'head', b'1', author, |
|
1546 |
committer, b"commit 1", None, [], files_one) |
|
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1547 |
def files_two(): |
1548 |
yield commands.FileCopyCommand(src_path, dest_path) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1549 |
yield commands.CommitCommand(b'head', b'2', author, |
1550 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1551 |
return command_list |
1552 |
||
1553 |
def test_copy_file_in_root(self): |
|
1554 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1555 |
src_path = b'a' |
1556 |
dest_path = b'b' |
|
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1557 |
handler.process(self.file_command_iter(src_path, dest_path)) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1558 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1559 |
expected_added=[(dest_path,)]) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1560 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
1561 |
self.assertContent(branch, revtree2, src_path, b"aaa") |
|
1562 |
self.assertContent(branch, revtree2, dest_path, b"aaa") |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1563 |
self.assertRevisionRoot(revtree1, src_path) |
1564 |
self.assertRevisionRoot(revtree2, dest_path) |
|
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1565 |
|
1566 |
def test_copy_file_in_subdir(self): |
|
1567 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1568 |
src_path = b'a/a' |
1569 |
dest_path = b'a/b' |
|
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1570 |
handler.process(self.file_command_iter(src_path, dest_path)) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1571 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1572 |
expected_added=[(dest_path,)]) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1573 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
1574 |
self.assertContent(branch, revtree2, src_path, b"aaa") |
|
1575 |
self.assertContent(branch, revtree2, dest_path, b"aaa") |
|
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1576 |
|
1577 |
def test_copy_file_to_new_dir(self): |
|
1578 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1579 |
src_path = b'a/a' |
1580 |
dest_path = b'b/a' |
|
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1581 |
handler.process(self.file_command_iter(src_path, dest_path)) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1582 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1583 |
expected_added=[(b'b',), (dest_path,)]) |
1584 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
|
1585 |
self.assertContent(branch, revtree2, src_path, b"aaa") |
|
1586 |
self.assertContent(branch, revtree2, dest_path, b"aaa") |
|
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1587 |
|
|
0.76.3
by Ian Clatworthy
symlink copying tests |
1588 |
def test_copy_symlink_in_root(self): |
1589 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1590 |
src_path = b'a' |
1591 |
dest_path = b'b' |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1592 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1593 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
|
0.76.3
by Ian Clatworthy
symlink copying tests |
1594 |
expected_added=[(dest_path,)]) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1595 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
1596 |
self.assertSymlinkTarget(branch, revtree2, src_path, "aaa") |
|
|
0.76.3
by Ian Clatworthy
symlink copying tests |
1597 |
self.assertSymlinkTarget(branch, revtree2, dest_path, "aaa") |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1598 |
self.assertRevisionRoot(revtree1, src_path) |
1599 |
self.assertRevisionRoot(revtree2, dest_path) |
|
|
0.76.3
by Ian Clatworthy
symlink copying tests |
1600 |
|
1601 |
def test_copy_symlink_in_subdir(self): |
|
1602 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1603 |
src_path = b'a/a' |
1604 |
dest_path = b'a/b' |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1605 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1606 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
|
0.76.3
by Ian Clatworthy
symlink copying tests |
1607 |
expected_added=[(dest_path,)]) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1608 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
1609 |
self.assertSymlinkTarget(branch, revtree2, src_path, "aaa") |
|
|
0.76.3
by Ian Clatworthy
symlink copying tests |
1610 |
self.assertSymlinkTarget(branch, revtree2, dest_path, "aaa") |
1611 |
||
1612 |
def test_copy_symlink_to_new_dir(self): |
|
1613 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1614 |
src_path = b'a/a' |
1615 |
dest_path = b'b/a' |
|
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1616 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1617 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1618 |
expected_added=[(b'b',), (dest_path,)]) |
|
0.80.1
by Ian Clatworthy
basic units tests for filemodify |
1619 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
1620 |
self.assertSymlinkTarget(branch, revtree2, src_path, "aaa") |
|
|
0.76.3
by Ian Clatworthy
symlink copying tests |
1621 |
self.assertSymlinkTarget(branch, revtree2, dest_path, "aaa") |
1622 |
||
|
0.76.2
by Ian Clatworthy
code & tests for file copying |
1623 |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1624 |
class TestImportToPackCopyNew(TestCaseForGenericProcessor): |
1625 |
"""Test copy of a newly added file.""" |
|
1626 |
||
1627 |
def file_command_iter(self, src_path, dest_path, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
1628 |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1629 |
# Revno 1: create a file or symlink and copy it
|
1630 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1631 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
1632 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1633 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1634 |
yield commands.FileModifyCommand(src_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1635 |
None, b"aaa") |
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1636 |
yield commands.FileCopyCommand(src_path, dest_path) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1637 |
yield commands.CommitCommand(b'head', b'1', author, |
1638 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1639 |
return command_list |
1640 |
||
1641 |
def test_copy_new_file_in_root(self): |
|
1642 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1643 |
src_path = b'a' |
1644 |
dest_path = b'b' |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1645 |
handler.process(self.file_command_iter(src_path, dest_path)) |
1646 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1647 |
expected_added=[(src_path,), (dest_path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1648 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
1649 |
self.assertContent(branch, revtree1, dest_path, b"aaa") |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1650 |
self.assertRevisionRoot(revtree1, src_path) |
1651 |
self.assertRevisionRoot(revtree1, dest_path) |
|
1652 |
||
1653 |
def test_copy_new_file_in_subdir(self): |
|
1654 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1655 |
src_path = b'a/a' |
1656 |
dest_path = b'a/b' |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1657 |
handler.process(self.file_command_iter(src_path, dest_path)) |
1658 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1659 |
expected_added=[(b'a',), (src_path,), (dest_path,)]) |
1660 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
|
1661 |
self.assertContent(branch, revtree1, dest_path, b"aaa") |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1662 |
|
1663 |
def test_copy_new_file_to_new_dir(self): |
|
1664 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1665 |
src_path = b'a/a' |
1666 |
dest_path = b'b/a' |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1667 |
handler.process(self.file_command_iter(src_path, dest_path)) |
1668 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1669 |
expected_added=[(b'a',), (src_path,), (b'b',), (dest_path,)]) |
1670 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
|
1671 |
self.assertContent(branch, revtree1, dest_path, b"aaa") |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1672 |
|
1673 |
def test_copy_new_symlink_in_root(self): |
|
1674 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1675 |
src_path = b'a' |
1676 |
dest_path = b'b' |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1677 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1678 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1679 |
expected_added=[(src_path,), (dest_path,)]) |
|
1680 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
|
1681 |
self.assertSymlinkTarget(branch, revtree1, dest_path, "aaa") |
|
1682 |
self.assertRevisionRoot(revtree1, src_path) |
|
1683 |
self.assertRevisionRoot(revtree1, dest_path) |
|
1684 |
||
1685 |
def test_copy_new_symlink_in_subdir(self): |
|
1686 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1687 |
src_path = b'a/a' |
1688 |
dest_path = b'a/b' |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1689 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1690 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1691 |
expected_added=[(b'a',), (src_path,), (dest_path,)]) |
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1692 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
1693 |
self.assertSymlinkTarget(branch, revtree1, dest_path, "aaa") |
|
1694 |
||
1695 |
def test_copy_new_symlink_to_new_dir(self): |
|
1696 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1697 |
src_path = b'a/a' |
1698 |
dest_path = b'b/a' |
|
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1699 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1700 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1701 |
expected_added=[(b'a',), (src_path,), (b'b',), (dest_path,)]) |
|
0.99.8
by Ian Clatworthy
handle copy of a newly added file |
1702 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
1703 |
self.assertSymlinkTarget(branch, revtree1, dest_path, "aaa") |
|
1704 |
||
1705 |
||
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1706 |
class TestImportToPackCopyToDeleted(TestCaseForGenericProcessor): |
1707 |
||
1708 |
def file_command_iter(self, src_path, dest_path, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
1709 |
|
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1710 |
# Revno 1: create two files or symlinks
|
1711 |
# Revno 2: delete one and copy the other one to its path
|
|
1712 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1713 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
1714 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1715 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1716 |
yield commands.FileModifyCommand(src_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1717 |
None, b"aaa") |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1718 |
yield commands.FileModifyCommand(dest_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1719 |
None, b"bbb") |
1720 |
yield commands.CommitCommand(b'head', b'1', author, |
|
1721 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1722 |
def files_two(): |
1723 |
yield commands.FileDeleteCommand(dest_path) |
|
1724 |
yield commands.FileCopyCommand(src_path, dest_path) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1725 |
yield commands.CommitCommand(b'head', b'2', author, |
1726 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1727 |
return command_list |
1728 |
||
1729 |
def test_copy_to_deleted_file_in_root(self): |
|
1730 |
handler, branch = self.get_handler() |
|
|
7027.2.6
by Jelmer Vernooij
Fix noeol handling for knits. |
1731 |
src_path = b'a' |
1732 |
dest_path = b'b' |
|
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1733 |
handler.process(self.file_command_iter(src_path, dest_path)) |
1734 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1735 |
expected_added=[(src_path,), (dest_path,)]) |
|
1736 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1737 |
expected_removed=[(dest_path,)], |
|
1738 |
expected_added=[(dest_path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1739 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
1740 |
self.assertContent(branch, revtree1, dest_path, b"bbb") |
|
1741 |
self.assertContent(branch, revtree2, src_path, b"aaa") |
|
1742 |
self.assertContent(branch, revtree2, dest_path, b"aaa") |
|
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1743 |
self.assertRevisionRoot(revtree1, src_path) |
1744 |
self.assertRevisionRoot(revtree1, dest_path) |
|
1745 |
||
1746 |
def test_copy_to_deleted_symlink_in_root(self): |
|
1747 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1748 |
src_path = b'a' |
1749 |
dest_path = b'b' |
|
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1750 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1751 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
1752 |
expected_added=[(src_path,), (dest_path,)]) |
|
1753 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1754 |
expected_removed=[(dest_path,)], |
|
1755 |
expected_added=[(dest_path,)]) |
|
1756 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
|
1757 |
self.assertSymlinkTarget(branch, revtree1, dest_path, "bbb") |
|
1758 |
self.assertSymlinkTarget(branch, revtree2, src_path, "aaa") |
|
1759 |
self.assertSymlinkTarget(branch, revtree2, dest_path, "aaa") |
|
1760 |
self.assertRevisionRoot(revtree1, src_path) |
|
1761 |
self.assertRevisionRoot(revtree1, dest_path) |
|
1762 |
||
1763 |
def test_copy_to_deleted_file_in_subdir(self): |
|
1764 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1765 |
src_path = b'd/a' |
1766 |
dest_path = b'd/b' |
|
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1767 |
handler.process(self.file_command_iter(src_path, dest_path)) |
1768 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1769 |
expected_added=[(b'd',), (src_path,), (dest_path,)]) |
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1770 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
1771 |
expected_removed=[(dest_path,)], |
|
1772 |
expected_added=[(dest_path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1773 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
1774 |
self.assertContent(branch, revtree1, dest_path, b"bbb") |
|
1775 |
self.assertContent(branch, revtree2, src_path, b"aaa") |
|
1776 |
self.assertContent(branch, revtree2, dest_path, b"aaa") |
|
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1777 |
|
1778 |
def test_copy_to_deleted_symlink_in_subdir(self): |
|
1779 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1780 |
src_path = b'd/a' |
1781 |
dest_path = b'd/b' |
|
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1782 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1783 |
revtree0, revtree1 = self.assertChanges(branch, 1, |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1784 |
expected_added=[(b'd',), (src_path,), (dest_path,)]) |
|
0.99.15
by Ian Clatworthy
Add tests for copying to a path deleted in the same commit |
1785 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
1786 |
expected_removed=[(dest_path,)], |
|
1787 |
expected_added=[(dest_path,)]) |
|
1788 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
|
1789 |
self.assertSymlinkTarget(branch, revtree1, dest_path, "bbb") |
|
1790 |
self.assertSymlinkTarget(branch, revtree2, src_path, "aaa") |
|
1791 |
self.assertSymlinkTarget(branch, revtree2, dest_path, "aaa") |
|
1792 |
||
1793 |
||
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1794 |
class TestImportToPackCopyModified(TestCaseForGenericProcessor): |
1795 |
"""Test copy of file/symlink already modified in this commit.""" |
|
1796 |
||
1797 |
def file_command_iter(self, src_path, dest_path, kind='file'): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
1798 |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1799 |
# Revno 1: create a file or symlink
|
1800 |
# Revno 2: modify and copy it
|
|
1801 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1802 |
author = [b'', b'bugs@a.com', time.time(), time.timezone] |
1803 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1804 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1805 |
yield commands.FileModifyCommand(src_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1806 |
None, b"aaa") |
1807 |
yield commands.CommitCommand(b'head', b'1', author, |
|
1808 |
committer, b"commit 1", None, [], files_one) |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1809 |
def files_two(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1810 |
yield commands.FileModifyCommand(src_path, kind_to_mode(kind, False), |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1811 |
None, b"bbb") |
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1812 |
yield commands.FileCopyCommand(src_path, dest_path) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1813 |
yield commands.CommitCommand(b'head', b'2', author, |
1814 |
committer, b"commit 2", b":1", [], files_two) |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1815 |
return command_list |
1816 |
||
1817 |
def test_copy_of_modified_file_in_root(self): |
|
1818 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1819 |
src_path = b'a' |
1820 |
dest_path = b'b' |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1821 |
handler.process(self.file_command_iter(src_path, dest_path)) |
1822 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1823 |
expected_modified=[(src_path,)], |
|
1824 |
expected_added=[(dest_path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1825 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
1826 |
self.assertContent(branch, revtree2, src_path, b"bbb") |
|
1827 |
self.assertContent(branch, revtree2, dest_path, b"bbb") |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1828 |
self.assertRevisionRoot(revtree1, src_path) |
1829 |
self.assertRevisionRoot(revtree2, dest_path) |
|
1830 |
||
1831 |
def test_copy_of_modified_file_in_subdir(self): |
|
1832 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1833 |
src_path = b'd/a' |
1834 |
dest_path = b'd/b' |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1835 |
handler.process(self.file_command_iter(src_path, dest_path)) |
1836 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1837 |
expected_modified=[(src_path,)], |
|
1838 |
expected_added=[(dest_path,)]) |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1839 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
1840 |
self.assertContent(branch, revtree2, src_path, b"bbb") |
|
1841 |
self.assertContent(branch, revtree2, dest_path, b"bbb") |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1842 |
|
1843 |
def test_copy_of_modified_file_to_new_dir(self): |
|
1844 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1845 |
src_path = b'd1/a' |
1846 |
dest_path = b'd2/a' |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1847 |
handler.process(self.file_command_iter(src_path, dest_path)) |
1848 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1849 |
expected_modified=[(src_path,)], |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1850 |
expected_added=[(b'd2',), (dest_path,)]) |
1851 |
self.assertContent(branch, revtree1, src_path, b"aaa") |
|
1852 |
self.assertContent(branch, revtree2, src_path, b"bbb") |
|
1853 |
self.assertContent(branch, revtree2, dest_path, b"bbb") |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1854 |
|
1855 |
def test_copy_of_modified_symlink_in_root(self): |
|
1856 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1857 |
src_path = b'a' |
1858 |
dest_path = b'b' |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1859 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1860 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1861 |
expected_modified=[(src_path,)], |
|
1862 |
expected_added=[(dest_path,)]) |
|
1863 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
|
1864 |
self.assertSymlinkTarget(branch, revtree2, src_path, "bbb") |
|
1865 |
self.assertSymlinkTarget(branch, revtree2, dest_path, "bbb") |
|
1866 |
self.assertRevisionRoot(revtree1, src_path) |
|
1867 |
self.assertRevisionRoot(revtree2, dest_path) |
|
1868 |
||
1869 |
def test_copy_of_modified_symlink_in_subdir(self): |
|
1870 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1871 |
src_path = b'd/a' |
1872 |
dest_path = b'd/b' |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1873 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1874 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1875 |
expected_modified=[(src_path,)], |
|
1876 |
expected_added=[(dest_path,)]) |
|
1877 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
|
1878 |
self.assertSymlinkTarget(branch, revtree2, src_path, "bbb") |
|
1879 |
self.assertSymlinkTarget(branch, revtree2, dest_path, "bbb") |
|
1880 |
||
1881 |
def test_copy_of_modified_symlink_to_new_dir(self): |
|
1882 |
handler, branch = self.get_handler() |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1883 |
src_path = b'd1/a' |
1884 |
dest_path = b'd2/a' |
|
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1885 |
handler.process(self.file_command_iter(src_path, dest_path, 'symlink')) |
1886 |
revtree1, revtree2 = self.assertChanges(branch, 2, |
|
1887 |
expected_modified=[(src_path,)], |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1888 |
expected_added=[(b'd2',), (dest_path,)]) |
|
0.99.18
by Ian Clatworthy
Handle copy of a file/symlink already modified in this commit |
1889 |
self.assertSymlinkTarget(branch, revtree1, src_path, "aaa") |
1890 |
self.assertSymlinkTarget(branch, revtree2, src_path, "bbb") |
|
1891 |
self.assertSymlinkTarget(branch, revtree2, dest_path, "bbb") |
|
|
0.99.10
by Ian Clatworthy
commented out draft of CopyModified tests |
1892 |
|
1893 |
||
|
0.85.1
by Ian Clatworthy
extend tests to test the chk code path |
1894 |
class TestImportToPackFileKinds(TestCaseForGenericProcessor): |
|
0.64.74
by Ian Clatworthy
fix symlink importing |
1895 |
|
1896 |
def get_command_iter(self, path, kind, content): |
|
|
0.123.13
by Jelmer Vernooij
Check for availability of fastimport before running tests. |
1897 |
|
|
0.64.74
by Ian Clatworthy
fix symlink importing |
1898 |
def command_list(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1899 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
|
0.64.74
by Ian Clatworthy
fix symlink importing |
1900 |
def files_one(): |
|
0.123.8
by Jelmer Vernooij
Use modes for FileModifyCommand. |
1901 |
yield commands.FileModifyCommand(path, kind_to_mode(kind, False), |
|
0.64.74
by Ian Clatworthy
fix symlink importing |
1902 |
None, content) |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1903 |
yield commands.CommitCommand(b'head', b'1', None, |
1904 |
committer, b"commit 1", None, [], files_one) |
|
|
0.64.74
by Ian Clatworthy
fix symlink importing |
1905 |
return command_list |
1906 |
||
1907 |
def test_import_plainfile(self): |
|
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
1908 |
handler, branch = self.get_handler() |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1909 |
handler.process(self.get_command_iter(b'foo', 'file', b'aaa')) |
|
0.64.74
by Ian Clatworthy
fix symlink importing |
1910 |
|
1911 |
def test_import_symlink(self): |
|
|
0.76.1
by Ian Clatworthy
clean-up tests for GenericProcessor |
1912 |
handler, branch = self.get_handler() |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1913 |
handler.process(self.get_command_iter(b'foo', 'symlink', b'bar')) |
|
0.115.3
by John Arbash Meinel
add the failing test that we preserve the last-modified revision |
1914 |
|
1915 |
||
1916 |
class TestModifyRevertInBranch(TestCaseForGenericProcessor): |
|
1917 |
||
1918 |
def file_command_iter(self): |
|
1919 |
# A add 'foo'
|
|
1920 |
# |\
|
|
1921 |
# | B modify 'foo'
|
|
1922 |
# | |
|
|
1923 |
# | C revert 'foo' back to A
|
|
1924 |
# |/
|
|
1925 |
# D merge 'foo'
|
|
1926 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1927 |
committer_a = [b'', b'a@elmer.com', time.time(), time.timezone] |
1928 |
committer_b = [b'', b'b@elmer.com', time.time(), time.timezone] |
|
1929 |
committer_c = [b'', b'c@elmer.com', time.time(), time.timezone] |
|
1930 |
committer_d = [b'', b'd@elmer.com', time.time(), time.timezone] |
|
|
0.115.3
by John Arbash Meinel
add the failing test that we preserve the last-modified revision |
1931 |
def files_one(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1932 |
yield commands.FileModifyCommand(b'foo', kind_to_mode('file', False), |
1933 |
None, b"content A\n") |
|
1934 |
yield commands.CommitCommand(b'head', b'1', None, |
|
1935 |
committer_a, b"commit 1", None, [], files_one) |
|
|
0.115.3
by John Arbash Meinel
add the failing test that we preserve the last-modified revision |
1936 |
def files_two(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1937 |
yield commands.FileModifyCommand(b'foo', kind_to_mode('file', False), |
1938 |
None, b"content B\n") |
|
1939 |
yield commands.CommitCommand(b'head', b'2', None, |
|
1940 |
committer_b, b"commit 2", b":1", [], files_two) |
|
|
0.115.3
by John Arbash Meinel
add the failing test that we preserve the last-modified revision |
1941 |
def files_three(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1942 |
yield commands.FileModifyCommand(b'foo', kind_to_mode('file', False), |
1943 |
None, b"content A\n") |
|
1944 |
yield commands.CommitCommand(b'head', b'3', None, |
|
1945 |
committer_c, b"commit 3", b":2", [], files_three) |
|
|
7027.2.6
by Jelmer Vernooij
Fix noeol handling for knits. |
1946 |
yield commands.CommitCommand(b'head', b'4', None, |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1947 |
committer_d, b"commit 4", b":1", [b':3'], lambda: []) |
|
0.115.3
by John Arbash Meinel
add the failing test that we preserve the last-modified revision |
1948 |
return command_list |
1949 |
||
1950 |
def test_modify_revert(self): |
|
1951 |
handler, branch = self.get_handler() |
|
1952 |
handler.process(self.file_command_iter()) |
|
|
0.115.4
by John Arbash Meinel
(broken) Start working towards using CommitBuilder rather than using a custom implementation. |
1953 |
branch.lock_read() |
1954 |
self.addCleanup(branch.unlock) |
|
1955 |
rev_d = branch.last_revision() |
|
1956 |
rev_a, rev_c = branch.repository.get_parent_map([rev_d])[rev_d] |
|
1957 |
rev_b = branch.repository.get_parent_map([rev_c])[rev_c][0] |
|
1958 |
rtree_a, rtree_b, rtree_c, rtree_d = branch.repository.revision_trees([ |
|
1959 |
rev_a, rev_b, rev_c, rev_d]) |
|
|
6809.4.5
by Jelmer Vernooij
Swap arguments for get_file_*. |
1960 |
self.assertEqual(rev_a, rtree_a.get_file_revision('foo')) |
1961 |
self.assertEqual(rev_b, rtree_b.get_file_revision('foo')) |
|
1962 |
self.assertEqual(rev_c, rtree_c.get_file_revision('foo')) |
|
1963 |
self.assertEqual(rev_c, rtree_d.get_file_revision('foo')) |
|
|
0.64.303
by Jelmer Vernooij
Cope with non-utf8 characters in commit messages. |
1964 |
|
1965 |
||
1966 |
class TestCommitCommands(TestCaseForGenericProcessor): |
|
1967 |
||
1968 |
def test_non_utf8_commit_message(self): |
|
1969 |
handler, branch = self.get_handler() |
|
1970 |
def files_one(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1971 |
yield commands.FileModifyCommand(b'a', |
1972 |
kind_to_mode('file', False), None, b"data") |
|
|
0.64.303
by Jelmer Vernooij
Cope with non-utf8 characters in commit messages. |
1973 |
def command_list(): |
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1974 |
committer = [b'', b'elmer@a.com', time.time(), time.timezone] |
1975 |
yield commands.CommitCommand(b'head', b'1', None, |
|
1976 |
committer, b'This is a funky character: \x83', None, [], |
|
|
0.64.303
by Jelmer Vernooij
Cope with non-utf8 characters in commit messages. |
1977 |
files_one) |
1978 |
handler.process(command_list) |
|
1979 |
rev = branch.repository.get_revision(branch.last_revision()) |
|
1980 |
self.assertEquals(u"This is a funky character: \ufffd", rev.message) |
|
|
0.64.332
by Jelmer Vernooij
Cope with non-utf8 characters in paths when importing. |
1981 |
|
1982 |
||
1983 |
class TestAddNonUtf8InBranch(TestCaseForGenericProcessor): |
|
1984 |
||
1985 |
def file_command_iter(self): |
|
1986 |
# A add 'foo\x83'
|
|
1987 |
def command_list(): |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1988 |
committer_a = [b'', b'a@elmer.com', time.time(), time.timezone] |
|
0.64.332
by Jelmer Vernooij
Cope with non-utf8 characters in paths when importing. |
1989 |
def files_one(): |
1990 |
yield commands.FileModifyCommand( |
|
|
7027.2.1
by Jelmer Vernooij
Port fastimport to python3. |
1991 |
b'foo\x83', kind_to_mode('file', False), None, b"content A\n") |
1992 |
yield commands.CommitCommand(b'head', b'1', None, |
|
1993 |
committer_a, b"commit 1", None, [], files_one) |
|
|
0.64.332
by Jelmer Vernooij
Cope with non-utf8 characters in paths when importing. |
1994 |
return command_list |
1995 |
||
1996 |
def test_add(self): |
|
1997 |
handler, branch = self.get_handler() |
|
1998 |
handler.process(self.file_command_iter()) |
|
1999 |
branch.lock_read() |
|
2000 |
self.addCleanup(branch.unlock) |
|
2001 |
rev_a = branch.last_revision() |
|
2002 |
rtree_a = branch.repository.revision_tree(rev_a) |
|
|
6809.4.5
by Jelmer Vernooij
Swap arguments for get_file_*. |
2003 |
self.assertEqual(rev_a, rtree_a.get_file_revision(u'foo\ufffd')) |