Show More
@@ -23,7 +23,7 b' import testparseutil' | |||||
23 | # Whitelist of modules that symbols can be directly imported from. |
|
23 | # Whitelist of modules that symbols can be directly imported from. | |
24 | allowsymbolimports = ( |
|
24 | allowsymbolimports = ( | |
25 | '__future__', |
|
25 | '__future__', | |
26 |
'b |
|
26 | 'breezy', | |
27 | 'hgclient', |
|
27 | 'hgclient', | |
28 | 'mercurial', |
|
28 | 'mercurial', | |
29 | 'mercurial.hgweb.common', |
|
29 | 'mercurial.hgweb.common', |
@@ -5,8 +5,9 b'' | |||||
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | # This module is for handling 'bzr', that was formerly known as Bazaar-NG; |
|
8 | # This module is for handling Breezy imports or `brz`, but it's also compatible | |
9 | # it cannot access 'bar' repositories, but they were never used very much |
|
9 | # with Bazaar or `bzr`, that was formerly known as Bazaar-NG; | |
|
10 | # it cannot access `bar` repositories, but they were never used very much. | |||
10 | from __future__ import absolute_import |
|
11 | from __future__ import absolute_import | |
11 |
|
12 | |||
12 | import os |
|
13 | import os | |
@@ -19,31 +20,32 b' from mercurial import (' | |||||
19 | ) |
|
20 | ) | |
20 | from . import common |
|
21 | from . import common | |
21 |
|
22 | |||
|
23 | ||||
22 | # these do not work with demandimport, blacklist |
|
24 | # these do not work with demandimport, blacklist | |
23 | demandimport.IGNORES.update( |
|
25 | demandimport.IGNORES.update( | |
24 | [ |
|
26 | [ | |
25 |
b'b |
|
27 | b'breezy.transactions', | |
26 |
b'b |
|
28 | b'breezy.urlutils', | |
27 | b'ElementPath', |
|
29 | b'ElementPath', | |
28 | ] |
|
30 | ] | |
29 | ) |
|
31 | ) | |
30 |
|
32 | |||
31 | try: |
|
33 | try: | |
32 | # bazaar imports |
|
34 | # bazaar imports | |
33 |
import b |
|
35 | import breezy.bzr.bzrdir | |
34 |
import b |
|
36 | import breezy.errors | |
35 |
import b |
|
37 | import breezy.revision | |
36 |
import b |
|
38 | import breezy.revisionspec | |
37 |
|
39 | |||
38 |
bzrdir = b |
|
40 | bzrdir = breezy.bzr.bzrdir | |
39 |
errors = b |
|
41 | errors = breezy.errors | |
40 |
revision = b |
|
42 | revision = breezy.revision | |
41 |
revisionspec = b |
|
43 | revisionspec = breezy.revisionspec | |
42 | revisionspec.RevisionSpec |
|
44 | revisionspec.RevisionSpec | |
43 | except ImportError: |
|
45 | except ImportError: | |
44 | pass |
|
46 | pass | |
45 |
|
47 | |||
46 |
supportedkinds = ( |
|
48 | supportedkinds = ('file', 'symlink') | |
47 |
|
49 | |||
48 |
|
50 | |||
49 | class bzr_source(common.converter_source): |
|
51 | class bzr_source(common.converter_source): | |
@@ -58,7 +60,7 b' class bzr_source(common.converter_source' | |||||
58 | ) |
|
60 | ) | |
59 |
|
61 | |||
60 | try: |
|
62 | try: | |
61 |
# access b |
|
63 | # access breezy stuff | |
62 | bzrdir |
|
64 | bzrdir | |
63 | except NameError: |
|
65 | except NameError: | |
64 | raise common.NoRepo(_(b'Bazaar modules could not be loaded')) |
|
66 | raise common.NoRepo(_(b'Bazaar modules could not be loaded')) | |
@@ -66,7 +68,8 b' class bzr_source(common.converter_source' | |||||
66 | path = os.path.abspath(path) |
|
68 | path = os.path.abspath(path) | |
67 | self._checkrepotype(path) |
|
69 | self._checkrepotype(path) | |
68 | try: |
|
70 | try: | |
69 |
|
|
71 | bzr_dir = bzrdir.BzrDir.open(path.decode()) | |
|
72 | self.sourcerepo = bzr_dir.open_repository() | |||
70 | except errors.NoRepositoryPresent: |
|
73 | except errors.NoRepositoryPresent: | |
71 | raise common.NoRepo( |
|
74 | raise common.NoRepo( | |
72 | _(b'%s does not look like a Bazaar repository') % path |
|
75 | _(b'%s does not look like a Bazaar repository') % path | |
@@ -78,7 +81,7 b' class bzr_source(common.converter_source' | |||||
78 | # Lightweight checkouts detection is informational but probably |
|
81 | # Lightweight checkouts detection is informational but probably | |
79 | # fragile at API level. It should not terminate the conversion. |
|
82 | # fragile at API level. It should not terminate the conversion. | |
80 | try: |
|
83 | try: | |
81 | dir = bzrdir.BzrDir.open_containing(path)[0] |
|
84 | dir = bzrdir.BzrDir.open_containing(path.decode())[0] | |
82 | try: |
|
85 | try: | |
83 | tree = dir.open_workingtree(recommend_upgrade=False) |
|
86 | tree = dir.open_workingtree(recommend_upgrade=False) | |
84 | branch = tree.branch |
|
87 | branch = tree.branch | |
@@ -87,8 +90,8 b' class bzr_source(common.converter_source' | |||||
87 | branch = dir.open_branch() |
|
90 | branch = dir.open_branch() | |
88 | if ( |
|
91 | if ( | |
89 | tree is not None |
|
92 | tree is not None | |
90 |
and tree. |
|
93 | and tree.controldir.root_transport.base | |
91 |
!= branch. |
|
94 | != branch.controldir.root_transport.base | |
92 | ): |
|
95 | ): | |
93 | self.ui.warn( |
|
96 | self.ui.warn( | |
94 | _( |
|
97 | _( | |
@@ -127,7 +130,8 b' class bzr_source(common.converter_source' | |||||
127 | revid = None |
|
130 | revid = None | |
128 | for branch in self._bzrbranches(): |
|
131 | for branch in self._bzrbranches(): | |
129 | try: |
|
132 | try: | |
130 |
r = |
|
133 | revspec = self.revs[0].decode() | |
|
134 | r = revisionspec.RevisionSpec.from_string(revspec) | |||
131 | info = r.in_history(branch) |
|
135 | info = r.in_history(branch) | |
132 | except errors.BzrError: |
|
136 | except errors.BzrError: | |
133 | pass |
|
137 | pass | |
@@ -142,24 +146,26 b' class bzr_source(common.converter_source' | |||||
142 | return heads |
|
146 | return heads | |
143 |
|
147 | |||
144 | def getfile(self, name, rev): |
|
148 | def getfile(self, name, rev): | |
|
149 | name = name.decode() | |||
145 | revtree = self.sourcerepo.revision_tree(rev) |
|
150 | revtree = self.sourcerepo.revision_tree(rev) | |
146 | fileid = revtree.path2id(name.decode(self.encoding or b'utf-8')) |
|
151 | ||
147 | kind = None |
|
152 | try: | |
148 | if fileid is not None: |
|
153 | kind = revtree.kind(name) | |
149 | kind = revtree.kind(fileid) |
|
154 | except breezy.errors.NoSuchFile: | |
|
155 | return None, None | |||
150 | if kind not in supportedkinds: |
|
156 | if kind not in supportedkinds: | |
151 | # the file is not available anymore - was deleted |
|
157 | # the file is not available anymore - was deleted | |
152 | return None, None |
|
158 | return None, None | |
153 | mode = self._modecache[(name, rev)] |
|
159 | mode = self._modecache[(name.encode(), rev)] | |
154 |
if kind == |
|
160 | if kind == 'symlink': | |
155 |
target = revtree.get_symlink_target( |
|
161 | target = revtree.get_symlink_target(name) | |
156 | if target is None: |
|
162 | if target is None: | |
157 | raise error.Abort( |
|
163 | raise error.Abort( | |
158 | _(b'%s.%s symlink has no target') % (name, rev) |
|
164 | _(b'%s.%s symlink has no target') % (name, rev) | |
159 | ) |
|
165 | ) | |
160 | return target, mode |
|
166 | return target.encode(), mode | |
161 | else: |
|
167 | else: | |
162 |
sio = revtree.get_file( |
|
168 | sio = revtree.get_file(name) | |
163 | return sio.read(), mode |
|
169 | return sio.read(), mode | |
164 |
|
170 | |||
165 | def getchanges(self, version, full): |
|
171 | def getchanges(self, version, full): | |
@@ -184,15 +190,15 b' class bzr_source(common.converter_source' | |||||
184 | parents = self._filterghosts(rev.parent_ids) |
|
190 | parents = self._filterghosts(rev.parent_ids) | |
185 | self._parentids[version] = parents |
|
191 | self._parentids[version] = parents | |
186 |
|
192 | |||
187 |
branch = |
|
193 | branch = rev.properties.get('branch-nick', 'default') | |
188 |
if branch == |
|
194 | if branch == 'trunk': | |
189 |
branch = |
|
195 | branch = 'default' | |
190 | return common.commit( |
|
196 | return common.commit( | |
191 | parents=parents, |
|
197 | parents=parents, | |
192 | date=b'%d %d' % (rev.timestamp, -rev.timezone), |
|
198 | date=b'%d %d' % (rev.timestamp, -rev.timezone), | |
193 | author=self.recode(rev.committer), |
|
199 | author=self.recode(rev.committer), | |
194 | desc=self.recode(rev.message), |
|
200 | desc=self.recode(rev.message), | |
195 | branch=branch, |
|
201 | branch=branch.encode('utf8'), | |
196 | rev=version, |
|
202 | rev=version, | |
197 | saverev=self._saverev, |
|
203 | saverev=self._saverev, | |
198 | ) |
|
204 | ) | |
@@ -234,35 +240,32 b' class bzr_source(common.converter_source' | |||||
234 |
|
240 | |||
235 | # Process the entries by reverse lexicographic name order to |
|
241 | # Process the entries by reverse lexicographic name order to | |
236 | # handle nested renames correctly, most specific first. |
|
242 | # handle nested renames correctly, most specific first. | |
|
243 | ||||
|
244 | def key(c): | |||
|
245 | return c.path[0] or c.path[1] or "" | |||
|
246 | ||||
237 | curchanges = sorted( |
|
247 | curchanges = sorted( | |
238 | current.iter_changes(origin), |
|
248 | current.iter_changes(origin), | |
239 | key=lambda c: c[1][0] or c[1][1], |
|
249 | key=key, | |
240 | reverse=True, |
|
250 | reverse=True, | |
241 | ) |
|
251 | ) | |
242 | for ( |
|
252 | for change in curchanges: | |
243 | fileid, |
|
253 | paths = change.path | |
244 | paths, |
|
254 | kind = change.kind | |
245 |
change |
|
255 | executable = change.executable | |
246 | versioned, |
|
|||
247 | parent, |
|
|||
248 | name, |
|
|||
249 | kind, |
|
|||
250 | executable, |
|
|||
251 | ) in curchanges: |
|
|||
252 |
|
||||
253 | if paths[0] == u'' or paths[1] == u'': |
|
256 | if paths[0] == u'' or paths[1] == u'': | |
254 | # ignore changes to tree root |
|
257 | # ignore changes to tree root | |
255 | continue |
|
258 | continue | |
256 |
|
259 | |||
257 | # bazaar tracks directories, mercurial does not, so |
|
260 | # bazaar tracks directories, mercurial does not, so | |
258 | # we have to rename the directory contents |
|
261 | # we have to rename the directory contents | |
259 |
if kind[1] == |
|
262 | if kind[1] == 'directory': | |
260 |
if kind[0] not in (None, |
|
263 | if kind[0] not in (None, 'directory'): | |
261 | # Replacing 'something' with a directory, record it |
|
264 | # Replacing 'something' with a directory, record it | |
262 | # so it can be removed. |
|
265 | # so it can be removed. | |
263 | changes.append((self.recode(paths[0]), revid)) |
|
266 | changes.append((self.recode(paths[0]), revid)) | |
264 |
|
267 | |||
265 |
if kind[0] == |
|
268 | if kind[0] == 'directory' and None not in paths: | |
266 | renaming = paths[0] != paths[1] |
|
269 | renaming = paths[0] != paths[1] | |
267 | # neither an add nor an delete - a move |
|
270 | # neither an add nor an delete - a move | |
268 | # rename all directory contents manually |
|
271 | # rename all directory contents manually | |
@@ -270,9 +273,9 b' class bzr_source(common.converter_source' | |||||
270 | # get all child-entries of the directory |
|
273 | # get all child-entries of the directory | |
271 | for name, entry in inventory.iter_entries(subdir): |
|
274 | for name, entry in inventory.iter_entries(subdir): | |
272 | # hg does not track directory renames |
|
275 | # hg does not track directory renames | |
273 |
if entry.kind == |
|
276 | if entry.kind == 'directory': | |
274 | continue |
|
277 | continue | |
275 |
frompath = self.recode(paths[0] + |
|
278 | frompath = self.recode(paths[0] + '/' + name) | |
276 | if frompath in seen: |
|
279 | if frompath in seen: | |
277 | # Already handled by a more specific change entry |
|
280 | # Already handled by a more specific change entry | |
278 | # This is important when you have: |
|
281 | # This is important when you have: | |
@@ -283,14 +286,14 b' class bzr_source(common.converter_source' | |||||
283 | seen.add(frompath) |
|
286 | seen.add(frompath) | |
284 | if not renaming: |
|
287 | if not renaming: | |
285 | continue |
|
288 | continue | |
286 |
topath = self.recode(paths[1] + |
|
289 | topath = self.recode(paths[1] + '/' + name) | |
287 | # register the files as changed |
|
290 | # register the files as changed | |
288 | changes.append((frompath, revid)) |
|
291 | changes.append((frompath, revid)) | |
289 | changes.append((topath, revid)) |
|
292 | changes.append((topath, revid)) | |
290 | # add to mode cache |
|
293 | # add to mode cache | |
291 | mode = ( |
|
294 | mode = ( | |
292 | (entry.executable and b'x') |
|
295 | (entry.executable and b'x') | |
293 |
or (entry.kind == |
|
296 | or (entry.kind == 'symlink' and b's') | |
294 | or b'' |
|
297 | or b'' | |
295 | ) |
|
298 | ) | |
296 | self._modecache[(topath, revid)] = mode |
|
299 | self._modecache[(topath, revid)] = mode | |
@@ -320,7 +323,7 b' class bzr_source(common.converter_source' | |||||
320 |
|
323 | |||
321 | # populate the mode cache |
|
324 | # populate the mode cache | |
322 | kind, executable = [e[1] for e in (kind, executable)] |
|
325 | kind, executable = [e[1] for e in (kind, executable)] | |
323 |
mode = (executable and b'x') or (kind == |
|
326 | mode = (executable and b'x') or (kind == 'symlink' and b'l') or b'' | |
324 | self._modecache[(topath, revid)] = mode |
|
327 | self._modecache[(topath, revid)] = mode | |
325 | changes.append((topath, revid)) |
|
328 | changes.append((topath, revid)) | |
326 |
|
329 |
@@ -168,35 +168,25 b' def has_baz():' | |||||
168 | return matchoutput('baz --version 2>&1', br'baz Bazaar version') |
|
168 | return matchoutput('baz --version 2>&1', br'baz Bazaar version') | |
169 |
|
169 | |||
170 |
|
170 | |||
171 | @check("bzr", "Canonical's Bazaar client") |
|
171 | @check("bzr", "Breezy library and executable version >= 3.1") | |
172 | def has_bzr(): |
|
172 | def has_bzr(): | |
173 | if not is_not_python2: |
|
173 | if not is_not_python2: | |
174 | return False |
|
174 | return False | |
175 | try: |
|
175 | try: | |
176 | import bzrlib |
|
176 | # Test the Breezy python lib | |
177 |
import b |
|
177 | import breezy | |
178 |
import b |
|
178 | import breezy.bzr.bzrdir | |
179 |
import b |
|
179 | import breezy.errors | |
180 |
import b |
|
180 | import breezy.revision | |
|
181 | import breezy.revisionspec | |||
181 |
|
182 | |||
182 |
b |
|
183 | breezy.revisionspec.RevisionSpec | |
183 | return bzrlib.__doc__ is not None |
|
184 | if breezy.__doc__ is None or breezy.version_info[:2] < (3, 1): | |
|
185 | return False | |||
184 | except (AttributeError, ImportError): |
|
186 | except (AttributeError, ImportError): | |
185 | return False |
|
187 | return False | |
186 |
|
188 | # Test the executable | ||
187 |
|
189 | return matchoutput('brz --version 2>&1', br'Breezy \(brz\) ') | ||
188 | @checkvers("bzr", "Canonical's Bazaar client >= %s", (1.14,)) |
|
|||
189 | def has_bzr_range(v): |
|
|||
190 | major, minor = v.split('rc')[0].split('.')[0:2] |
|
|||
191 | try: |
|
|||
192 | import bzrlib |
|
|||
193 |
|
||||
194 | return bzrlib.__doc__ is not None and bzrlib.version_info[:2] >= ( |
|
|||
195 | int(major), |
|
|||
196 | int(minor), |
|
|||
197 | ) |
|
|||
198 | except ImportError: |
|
|||
199 | return False |
|
|||
200 |
|
190 | |||
201 |
|
191 | |||
202 | @check("chg", "running with chg") |
|
192 | @check("chg", "running with chg") |
@@ -1,4 +1,4 b'' | |||||
1 |
#require bzr |
|
1 | #require bzr | |
2 |
|
2 | |||
3 | $ . "$TESTDIR/bzr-definitions" |
|
3 | $ . "$TESTDIR/bzr-definitions" | |
4 |
|
4 | |||
@@ -9,18 +9,18 b' replace file with dir' | |||||
9 |
|
9 | |||
10 | $ mkdir test-replace-file-with-dir |
|
10 | $ mkdir test-replace-file-with-dir | |
11 | $ cd test-replace-file-with-dir |
|
11 | $ cd test-replace-file-with-dir | |
12 |
$ b |
|
12 | $ brz init -q source | |
13 | $ cd source |
|
13 | $ cd source | |
14 | $ echo d > d |
|
14 | $ echo d > d | |
15 |
$ b |
|
15 | $ brz add -q d | |
16 |
$ b |
|
16 | $ brz commit -q -m 'add d file' | |
17 | $ rm d |
|
17 | $ rm d | |
18 | $ mkdir d |
|
18 | $ mkdir d | |
19 |
$ b |
|
19 | $ brz add -q d | |
20 |
$ b |
|
20 | $ brz commit -q -m 'replace with d dir' | |
21 | $ echo a > d/a |
|
21 | $ echo a > d/a | |
22 |
$ b |
|
22 | $ brz add -q d/a | |
23 |
$ b |
|
23 | $ brz commit -q -m 'add d/a' | |
24 | $ cd .. |
|
24 | $ cd .. | |
25 | $ hg convert source source-hg |
|
25 | $ hg convert source source-hg | |
26 | initializing destination source-hg repository |
|
26 | initializing destination source-hg repository |
@@ -9,17 +9,17 b' empty directory' | |||||
9 |
|
9 | |||
10 | $ mkdir test-empty |
|
10 | $ mkdir test-empty | |
11 | $ cd test-empty |
|
11 | $ cd test-empty | |
12 |
$ b |
|
12 | $ brz init -q source | |
13 | $ cd source |
|
13 | $ cd source | |
14 | $ echo content > a |
|
14 | $ echo content > a | |
15 |
$ b |
|
15 | $ brz add -q a | |
16 |
$ b |
|
16 | $ brz commit -q -m 'Initial add' | |
17 | $ mkdir empty |
|
17 | $ mkdir empty | |
18 |
$ b |
|
18 | $ brz add -q empty | |
19 |
$ b |
|
19 | $ brz commit -q -m 'Empty directory added' | |
20 | $ echo content > empty/something |
|
20 | $ echo content > empty/something | |
21 |
$ b |
|
21 | $ brz add -q empty/something | |
22 |
$ b |
|
22 | $ brz commit -q -m 'Added file into directory' | |
23 | $ cd .. |
|
23 | $ cd .. | |
24 | $ hg convert source source-hg |
|
24 | $ hg convert source source-hg | |
25 | initializing destination source-hg repository |
|
25 | initializing destination source-hg repository | |
@@ -42,15 +42,15 b' directory renames' | |||||
42 |
|
42 | |||
43 | $ mkdir test-dir-rename |
|
43 | $ mkdir test-dir-rename | |
44 | $ cd test-dir-rename |
|
44 | $ cd test-dir-rename | |
45 |
$ b |
|
45 | $ brz init -q source | |
46 | $ cd source |
|
46 | $ cd source | |
47 | $ mkdir tpyo |
|
47 | $ mkdir tpyo | |
48 | $ echo content > tpyo/something |
|
48 | $ echo content > tpyo/something | |
49 |
$ b |
|
49 | $ brz add -q tpyo | |
50 |
$ b |
|
50 | $ brz commit -q -m 'Added directory' | |
51 |
$ b |
|
51 | $ brz mv tpyo typo | |
52 | tpyo => typo |
|
52 | tpyo => typo | |
53 |
$ b |
|
53 | $ brz commit -q -m 'Oops, typo' | |
54 | $ cd .. |
|
54 | $ cd .. | |
55 | $ hg convert source source-hg |
|
55 | $ hg convert source source-hg | |
56 | initializing destination source-hg repository |
|
56 | initializing destination source-hg repository | |
@@ -71,16 +71,16 b' nested directory renames' | |||||
71 |
|
71 | |||
72 | $ mkdir test-nested-dir-rename |
|
72 | $ mkdir test-nested-dir-rename | |
73 | $ cd test-nested-dir-rename |
|
73 | $ cd test-nested-dir-rename | |
74 |
$ b |
|
74 | $ brz init -q source | |
75 | $ cd source |
|
75 | $ cd source | |
76 | $ mkdir -p firstlevel/secondlevel/thirdlevel |
|
76 | $ mkdir -p firstlevel/secondlevel/thirdlevel | |
77 | $ echo content > firstlevel/secondlevel/file |
|
77 | $ echo content > firstlevel/secondlevel/file | |
78 | $ echo this_needs_to_be_there_too > firstlevel/secondlevel/thirdlevel/stuff |
|
78 | $ echo this_needs_to_be_there_too > firstlevel/secondlevel/thirdlevel/stuff | |
79 |
$ b |
|
79 | $ brz add -q firstlevel | |
80 |
$ b |
|
80 | $ brz commit -q -m 'Added nested directories' | |
81 |
$ b |
|
81 | $ brz mv firstlevel/secondlevel secondlevel | |
82 | firstlevel/secondlevel => secondlevel |
|
82 | firstlevel/secondlevel => secondlevel | |
83 |
$ b |
|
83 | $ brz commit -q -m 'Moved secondlevel one level up' | |
84 | $ cd .. |
|
84 | $ cd .. | |
85 | $ hg convert source source-hg |
|
85 | $ hg convert source source-hg | |
86 | initializing destination source-hg repository |
|
86 | initializing destination source-hg repository | |
@@ -99,14 +99,14 b' directory remove' | |||||
99 |
|
99 | |||
100 | $ mkdir test-dir-remove |
|
100 | $ mkdir test-dir-remove | |
101 | $ cd test-dir-remove |
|
101 | $ cd test-dir-remove | |
102 |
$ b |
|
102 | $ brz init -q source | |
103 | $ cd source |
|
103 | $ cd source | |
104 | $ mkdir src |
|
104 | $ mkdir src | |
105 | $ echo content > src/sourcecode |
|
105 | $ echo content > src/sourcecode | |
106 |
$ b |
|
106 | $ brz add -q src | |
107 |
$ b |
|
107 | $ brz commit -q -m 'Added directory' | |
108 |
$ b |
|
108 | $ brz rm -q src | |
109 |
$ b |
|
109 | $ brz commit -q -m 'Removed directory' | |
110 | $ cd .. |
|
110 | $ cd .. | |
111 | $ hg convert source source-hg |
|
111 | $ hg convert source source-hg | |
112 | initializing destination source-hg repository |
|
112 | initializing destination source-hg repository | |
@@ -126,19 +126,19 b' directory replace' | |||||
126 |
|
126 | |||
127 | $ mkdir test-dir-replace |
|
127 | $ mkdir test-dir-replace | |
128 | $ cd test-dir-replace |
|
128 | $ cd test-dir-replace | |
129 |
$ b |
|
129 | $ brz init -q source | |
130 | $ cd source |
|
130 | $ cd source | |
131 | $ mkdir first second |
|
131 | $ mkdir first second | |
132 | $ echo content > first/file |
|
132 | $ echo content > first/file | |
133 | $ echo morecontent > first/dummy |
|
133 | $ echo morecontent > first/dummy | |
134 | $ echo othercontent > second/something |
|
134 | $ echo othercontent > second/something | |
135 |
$ b |
|
135 | $ brz add -q first second | |
136 |
$ b |
|
136 | $ brz commit -q -m 'Initial layout' | |
137 |
$ b |
|
137 | $ brz mv first/file second/file | |
138 | first/file => second/file |
|
138 | first/file => second/file | |
139 |
$ b |
|
139 | $ brz mv first third | |
140 | first => third |
|
140 | first => third | |
141 |
$ b |
|
141 | $ brz commit -q -m 'Some conflicting moves' | |
142 | $ cd .. |
|
142 | $ cd .. | |
143 | $ hg convert source source-hg |
|
143 | $ hg convert source source-hg | |
144 | initializing destination source-hg repository |
|
144 | initializing destination source-hg repository | |
@@ -158,27 +158,27 b' divergent nested renames (issue3089)' | |||||
158 |
|
158 | |||
159 | $ mkdir test-divergent-renames |
|
159 | $ mkdir test-divergent-renames | |
160 | $ cd test-divergent-renames |
|
160 | $ cd test-divergent-renames | |
161 |
$ b |
|
161 | $ brz init -q source | |
162 | $ cd source |
|
162 | $ cd source | |
163 | $ mkdir -p a/c |
|
163 | $ mkdir -p a/c | |
164 | $ echo a > a/fa |
|
164 | $ echo a > a/fa | |
165 | $ echo c > a/c/fc |
|
165 | $ echo c > a/c/fc | |
166 |
$ b |
|
166 | $ brz add -q a | |
167 |
$ b |
|
167 | $ brz commit -q -m 'Initial layout' | |
168 |
$ b |
|
168 | $ brz mv a b | |
169 | a => b |
|
169 | a => b | |
170 | $ mkdir a |
|
170 | $ mkdir a | |
171 |
$ b |
|
171 | $ brz add a | |
172 | add(ed|ing) a (re) |
|
172 | add(ed|ing) a (re) | |
173 |
$ b |
|
173 | $ brz mv b/c a/c | |
174 | b/c => a/c |
|
174 | b/c => a/c | |
175 |
$ b |
|
175 | $ brz status | |
176 | added: |
|
176 | added: | |
177 | a/ |
|
177 | a/ | |
178 | renamed: |
|
178 | renamed: | |
179 | a/? => b/? (re) |
|
179 | a/? => b/? (re) | |
180 | a/c/? => a/c/? (re) |
|
180 | a/c/? => a/c/? (re) | |
181 |
$ b |
|
181 | $ brz commit -q -m 'Divergent renames' | |
182 | $ cd .. |
|
182 | $ cd .. | |
183 | $ hg convert source source-hg |
|
183 | $ hg convert source source-hg | |
184 | initializing destination source-hg repository |
|
184 | initializing destination source-hg repository |
@@ -3,11 +3,12 b'' | |||||
3 | $ . "$TESTDIR/bzr-definitions" |
|
3 | $ . "$TESTDIR/bzr-definitions" | |
4 | $ cat > ghostcreator.py <<EOF |
|
4 | $ cat > ghostcreator.py <<EOF | |
5 | > import sys |
|
5 | > import sys | |
6 |
> from b |
|
6 | > from breezy import workingtree | |
|
7 | > import breezy.bzr.bzrdir | |||
7 | > wt = workingtree.WorkingTree.open('.') |
|
8 | > wt = workingtree.WorkingTree.open('.') | |
8 | > |
|
9 | > | |
9 | > message, ghostrev = sys.argv[1:] |
|
10 | > message, ghostrev = sys.argv[1:] | |
10 | > wt.set_parent_ids(wt.get_parent_ids() + [ghostrev]) |
|
11 | > wt.set_parent_ids(wt.get_parent_ids() + [ghostrev.encode()]) | |
11 | > wt.commit(message) |
|
12 | > wt.commit(message) | |
12 | > EOF |
|
13 | > EOF | |
13 |
|
14 | |||
@@ -15,11 +16,11 b' ghost revisions' | |||||
15 |
|
16 | |||
16 | $ mkdir test-ghost-revisions |
|
17 | $ mkdir test-ghost-revisions | |
17 | $ cd test-ghost-revisions |
|
18 | $ cd test-ghost-revisions | |
18 |
$ b |
|
19 | $ brz init -q source | |
19 | $ cd source |
|
20 | $ cd source | |
20 | $ echo content > somefile |
|
21 | $ echo content > somefile | |
21 |
$ b |
|
22 | $ brz add -q somefile | |
22 |
$ b |
|
23 | $ brz commit -q -m 'Initial layout setup' | |
23 | $ echo morecontent >> somefile |
|
24 | $ echo morecontent >> somefile | |
24 | $ "$PYTHON" ../../ghostcreator.py 'Commit with ghost revision' ghostrev |
|
25 | $ "$PYTHON" ../../ghostcreator.py 'Commit with ghost revision' ghostrev | |
25 | $ cd .. |
|
26 | $ cd .. |
@@ -10,37 +10,37 b' test multiple merges at once' | |||||
10 |
|
10 | |||
11 | $ mkdir test-multimerge |
|
11 | $ mkdir test-multimerge | |
12 | $ cd test-multimerge |
|
12 | $ cd test-multimerge | |
13 |
$ b |
|
13 | $ brz init -q source | |
14 | $ cd source |
|
14 | $ cd source | |
15 | $ echo content > file |
|
15 | $ echo content > file | |
16 | $ echo text > rename_me |
|
16 | $ echo text > rename_me | |
17 |
$ b |
|
17 | $ brz add -q file rename_me | |
18 |
$ b |
|
18 | $ brz commit -q -m 'Initial add' '--commit-time=2009-10-10 08:00:00 +0100' | |
19 | $ cd .. |
|
19 | $ cd .. | |
20 |
$ b |
|
20 | $ brz branch -q source source-branch1 | |
21 | $ cd source-branch1 |
|
21 | $ cd source-branch1 | |
22 | $ echo morecontent >> file |
|
22 | $ echo morecontent >> file | |
23 | $ echo evenmorecontent > file-branch1 |
|
23 | $ echo evenmorecontent > file-branch1 | |
24 |
$ b |
|
24 | $ brz add -q file-branch1 | |
25 |
$ b |
|
25 | $ brz commit -q -m 'Added branch1 file' '--commit-time=2009-10-10 08:00:01 +0100' | |
26 | $ cd ../source |
|
26 | $ cd ../source | |
27 | $ sleep 1 |
|
27 | $ sleep 1 | |
28 | $ echo content > file-parent |
|
28 | $ echo content > file-parent | |
29 |
$ b |
|
29 | $ brz add -q file-parent | |
30 |
$ b |
|
30 | $ brz commit -q -m 'Added parent file' '--commit-time=2009-10-10 08:00:02 +0100' | |
31 | $ cd .. |
|
31 | $ cd .. | |
32 |
$ b |
|
32 | $ brz branch -q source source-branch2 | |
33 | $ cd source-branch2 |
|
33 | $ cd source-branch2 | |
34 | $ echo somecontent > file-branch2 |
|
34 | $ echo somecontent > file-branch2 | |
35 |
$ b |
|
35 | $ brz add -q file-branch2 | |
36 |
$ b |
|
36 | $ brz mv -q rename_me renamed | |
37 | $ echo change > renamed |
|
37 | $ echo change > renamed | |
38 |
$ b |
|
38 | $ brz commit -q -m 'Added brach2 file' '--commit-time=2009-10-10 08:00:03 +0100' | |
39 | $ sleep 1 |
|
39 | $ sleep 1 | |
40 | $ cd ../source |
|
40 | $ cd ../source | |
41 |
$ b |
|
41 | $ brz merge -q ../source-branch1 | |
42 |
$ b |
|
42 | $ brz merge -q --force ../source-branch2 | |
43 |
$ b |
|
43 | $ brz commit -q -m 'Merged branches' '--commit-time=2009-10-10 08:00:04 +0100' | |
44 | $ cd .. |
|
44 | $ cd .. | |
45 |
|
45 | |||
46 | BUG: file-branch2 should not be added in rev 4, and the rename_me -> renamed |
|
46 | BUG: file-branch2 should not be added in rev 4, and the rename_me -> renamed |
@@ -3,11 +3,12 b'' | |||||
3 | $ . "$TESTDIR/bzr-definitions" |
|
3 | $ . "$TESTDIR/bzr-definitions" | |
4 | $ cat > treeset.py <<EOF |
|
4 | $ cat > treeset.py <<EOF | |
5 | > import sys |
|
5 | > import sys | |
6 |
> from b |
|
6 | > from breezy import workingtree | |
|
7 | > import breezy.bzr.bzrdir | |||
7 | > wt = workingtree.WorkingTree.open('.') |
|
8 | > wt = workingtree.WorkingTree.open('.') | |
8 | > |
|
9 | > | |
9 | > message, rootid = sys.argv[1:] |
|
10 | > message, rootid = sys.argv[1:] | |
10 | > wt.set_root_id('tree_root-%s' % rootid) |
|
11 | > wt.set_root_id(b'tree_root-%s' % rootid.encode()) | |
11 | > wt.commit(message) |
|
12 | > wt.commit(message) | |
12 | > EOF |
|
13 | > EOF | |
13 |
|
14 | |||
@@ -15,11 +16,11 b' change the id of the tree root' | |||||
15 |
|
16 | |||
16 | $ mkdir test-change-treeroot-id |
|
17 | $ mkdir test-change-treeroot-id | |
17 | $ cd test-change-treeroot-id |
|
18 | $ cd test-change-treeroot-id | |
18 |
$ b |
|
19 | $ brz init -q source | |
19 | $ cd source |
|
20 | $ cd source | |
20 | $ echo content > file |
|
21 | $ echo content > file | |
21 |
$ b |
|
22 | $ brz add -q file | |
22 |
$ b |
|
23 | $ brz commit -q -m 'Initial add' | |
23 | $ "$PYTHON" ../../treeset.py 'Changed root' new |
|
24 | $ "$PYTHON" ../../treeset.py 'Changed root' new | |
24 | $ cd .. |
|
25 | $ cd .. | |
25 | $ hg convert source source-hg |
|
26 | $ hg convert source source-hg |
@@ -6,7 +6,7 b' create and rename on the same file in th' | |||||
6 |
|
6 | |||
7 | $ mkdir test-createandrename |
|
7 | $ mkdir test-createandrename | |
8 | $ cd test-createandrename |
|
8 | $ cd test-createandrename | |
9 |
$ b |
|
9 | $ brz init -q source | |
10 |
|
10 | |||
11 | test empty repo conversion (issue3233) |
|
11 | test empty repo conversion (issue3233) | |
12 |
|
12 | |||
@@ -22,18 +22,18 b' back to the rename stuff' | |||||
22 | $ echo a > a |
|
22 | $ echo a > a | |
23 | $ echo c > c |
|
23 | $ echo c > c | |
24 | $ echo e > e |
|
24 | $ echo e > e | |
25 |
$ b |
|
25 | $ brz add -q a c e | |
26 |
$ b |
|
26 | $ brz commit -q -m 'Initial add: a, c, e' | |
27 |
$ b |
|
27 | $ brz mv a b | |
28 | a => b |
|
28 | a => b | |
29 |
$ b |
|
29 | $ brz mv c d | |
30 | c => d |
|
30 | c => d | |
31 |
$ b |
|
31 | $ brz mv e f | |
32 | e => f |
|
32 | e => f | |
33 | $ echo a2 >> a |
|
33 | $ echo a2 >> a | |
34 | $ mkdir e |
|
34 | $ mkdir e | |
35 |
$ b |
|
35 | $ brz add -q a e | |
36 |
$ b |
|
36 | $ brz commit -q -m 'rename a into b, create a, rename c into d' | |
37 | $ cd .. |
|
37 | $ cd .. | |
38 | $ hg convert source source-hg |
|
38 | $ hg convert source source-hg | |
39 | scanning source... |
|
39 | scanning source... | |
@@ -86,7 +86,7 b' test with filemap' | |||||
86 |
|
86 | |||
87 | convert from lightweight checkout |
|
87 | convert from lightweight checkout | |
88 |
|
88 | |||
89 |
$ b |
|
89 | $ brz checkout --lightweight source source-light | |
90 | $ hg convert -s bzr source-light source-light-hg |
|
90 | $ hg convert -s bzr source-light source-light-hg | |
91 | initializing destination source-light-hg repository |
|
91 | initializing destination source-light-hg repository | |
92 | warning: lightweight checkouts may cause conversion failures, try with a regular branch instead. |
|
92 | warning: lightweight checkouts may cause conversion failures, try with a regular branch instead. | |
@@ -99,7 +99,7 b' yyyy-mm-dd HH:MM zzzz (no seconds!)' | |||||
99 | compare timestamps |
|
99 | compare timestamps | |
100 |
|
100 | |||
101 | $ cd source |
|
101 | $ cd source | |
102 |
$ b |
|
102 | $ brz log | \ | |
103 | > sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \ |
|
103 | > sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \ | |
104 | > > ../bzr-timestamps |
|
104 | > > ../bzr-timestamps | |
105 | $ cd .. |
|
105 | $ cd .. | |
@@ -113,20 +113,21 b' merge' | |||||
113 | $ cd test-merge |
|
113 | $ cd test-merge | |
114 | $ cat > helper.py <<EOF |
|
114 | $ cat > helper.py <<EOF | |
115 | > import sys |
|
115 | > import sys | |
116 |
> from b |
|
116 | > from breezy import workingtree | |
|
117 | > import breezy.bzr.bzrdir | |||
117 | > wt = workingtree.WorkingTree.open('.') |
|
118 | > wt = workingtree.WorkingTree.open('.') | |
118 | > |
|
119 | > | |
119 | > message, stamp = sys.argv[1:] |
|
120 | > message, stamp = sys.argv[1:] | |
120 | > wt.commit(message, timestamp=int(stamp)) |
|
121 | > wt.commit(message, timestamp=int(stamp)) | |
121 | > EOF |
|
122 | > EOF | |
122 |
$ b |
|
123 | $ brz init -q source | |
123 | $ cd source |
|
124 | $ cd source | |
124 | $ echo content > a |
|
125 | $ echo content > a | |
125 | $ echo content2 > b |
|
126 | $ echo content2 > b | |
126 |
$ b |
|
127 | $ brz add -q a b | |
127 |
$ b |
|
128 | $ brz commit -q -m 'Initial add' | |
128 | $ cd .. |
|
129 | $ cd .. | |
129 |
$ b |
|
130 | $ brz branch -q source source-improve | |
130 | $ cd source |
|
131 | $ cd source | |
131 | $ echo more >> a |
|
132 | $ echo more >> a | |
132 | $ "$PYTHON" ../helper.py 'Editing a' 100 |
|
133 | $ "$PYTHON" ../helper.py 'Editing a' 100 | |
@@ -134,8 +135,8 b' merge' | |||||
134 | $ echo content3 >> b |
|
135 | $ echo content3 >> b | |
135 | $ "$PYTHON" ../helper.py 'Editing b' 200 |
|
136 | $ "$PYTHON" ../helper.py 'Editing b' 200 | |
136 | $ cd ../source |
|
137 | $ cd ../source | |
137 |
$ b |
|
138 | $ brz merge -q ../source-improve | |
138 |
$ b |
|
139 | $ brz commit -q -m 'Merged improve branch' | |
139 | $ cd .. |
|
140 | $ cd .. | |
140 | $ hg convert --datesort source source-hg |
|
141 | $ hg convert --datesort source source-hg | |
141 | initializing destination source-hg repository |
|
142 | initializing destination source-hg repository | |
@@ -163,7 +164,7 b' symlinks and executable files' | |||||
163 |
|
164 | |||
164 | $ mkdir test-symlinks |
|
165 | $ mkdir test-symlinks | |
165 | $ cd test-symlinks |
|
166 | $ cd test-symlinks | |
166 |
$ b |
|
167 | $ brz init -q source | |
167 | $ cd source |
|
168 | $ cd source | |
168 | $ touch program |
|
169 | $ touch program | |
169 | $ chmod +x program |
|
170 | $ chmod +x program | |
@@ -171,15 +172,15 b' symlinks and executable files' | |||||
171 | $ mkdir d |
|
172 | $ mkdir d | |
172 | $ echo a > d/a |
|
173 | $ echo a > d/a | |
173 | $ ln -s a syma |
|
174 | $ ln -s a syma | |
174 |
$ b |
|
175 | $ brz add -q altname program syma d/a | |
175 |
$ b |
|
176 | $ brz commit -q -m 'Initial setup' | |
176 | $ touch newprog |
|
177 | $ touch newprog | |
177 | $ chmod +x newprog |
|
178 | $ chmod +x newprog | |
178 | $ rm altname |
|
179 | $ rm altname | |
179 | $ ln -s newprog altname |
|
180 | $ ln -s newprog altname | |
180 | $ chmod -x program |
|
181 | $ chmod -x program | |
181 |
$ b |
|
182 | $ brz add -q newprog | |
182 |
$ b |
|
183 | $ brz commit -q -m 'Symlink changed, x bits changed' | |
183 | $ cd .. |
|
184 | $ cd .. | |
184 | $ hg convert source source-hg |
|
185 | $ hg convert source source-hg | |
185 | initializing destination source-hg repository |
|
186 | initializing destination source-hg repository | |
@@ -215,30 +216,28 b' test the symlinks can be recreated' | |||||
215 |
|
216 | |||
216 | Multiple branches |
|
217 | Multiple branches | |
217 |
|
218 | |||
218 |
$ b |
|
219 | $ brz init-repo -q --no-trees repo | |
219 |
$ b |
|
220 | $ brz init -q repo/trunk | |
220 |
$ b |
|
221 | $ brz co repo/trunk repo-trunk | |
221 | $ cd repo-trunk |
|
222 | $ cd repo-trunk | |
222 | $ echo a > a |
|
223 | $ echo a > a | |
223 |
$ b |
|
224 | $ brz add -q a | |
224 |
$ b |
|
225 | $ brz ci -qm adda | |
225 |
$ b |
|
226 | $ brz tag trunk-tag | |
226 | Created tag trunk-tag. |
|
227 | Created tag trunk-tag. | |
227 |
$ b |
|
228 | $ brz switch -b branch | |
228 | Tree is up to date at revision 1. |
|
229 | Tree is up to date at revision 1. | |
229 | Switched to branch*repo/branch/ (glob) |
|
230 | Switched to branch*repo/branch/ (glob) | |
230 | $ sleep 1 |
|
|||
231 | $ echo b > b |
|
231 | $ echo b > b | |
232 |
$ b |
|
232 | $ brz add -q b | |
233 |
$ b |
|
233 | $ brz ci -qm addb | |
234 |
$ b |
|
234 | $ brz tag branch-tag | |
235 | Created tag branch-tag. |
|
235 | Created tag branch-tag. | |
236 |
$ b |
|
236 | $ brz switch --force ../repo/trunk | |
237 | Updated to revision 1. |
|
237 | Updated to revision 1. | |
238 | Switched to branch*/repo/trunk/ (glob) |
|
238 | Switched to branch*/repo/trunk/ (glob) | |
239 | $ sleep 1 |
|
|||
240 | $ echo a >> a |
|
239 | $ echo a >> a | |
241 |
$ b |
|
240 | $ brz ci -qm changea | |
242 | $ cd .. |
|
241 | $ cd .. | |
243 | $ hg convert --datesort repo repo-bzr |
|
242 | $ hg convert --datesort repo repo-bzr | |
244 | initializing destination repo-bzr repository |
|
243 | initializing destination repo-bzr repository | |
@@ -269,13 +268,13 b' not and get incorporated in extra fields' | |||||
269 |
|
268 | |||
270 | Nested repositories (issue3254) |
|
269 | Nested repositories (issue3254) | |
271 |
|
270 | |||
272 |
$ b |
|
271 | $ brz init-repo -q --no-trees repo/inner | |
273 |
$ b |
|
272 | $ brz init -q repo/inner/trunk | |
274 |
$ b |
|
273 | $ brz co repo/inner/trunk inner-trunk | |
275 | $ cd inner-trunk |
|
274 | $ cd inner-trunk | |
276 | $ echo b > b |
|
275 | $ echo b > b | |
277 |
$ b |
|
276 | $ brz add -q b | |
278 |
$ b |
|
277 | $ brz ci -qm addb | |
279 | $ cd .. |
|
278 | $ cd .. | |
280 | $ hg convert --datesort repo noinner-bzr |
|
279 | $ hg convert --datesort repo noinner-bzr | |
281 | initializing destination noinner-bzr repository |
|
280 | initializing destination noinner-bzr repository |
General Comments 0
You need to be logged in to leave comments.
Login now