Show More
@@ -45,10 +45,31 b' class bzr_source(converter_source):' | |||||
45 | raise NoRepo('Bazaar modules could not be loaded') |
|
45 | raise NoRepo('Bazaar modules could not be loaded') | |
46 |
|
46 | |||
47 | path = os.path.abspath(path) |
|
47 | path = os.path.abspath(path) | |
|
48 | self._checkrepotype(path) | |||
48 | self.branch = branch.Branch.open(path) |
|
49 | self.branch = branch.Branch.open(path) | |
49 | self.sourcerepo = self.branch.repository |
|
50 | self.sourcerepo = self.branch.repository | |
50 | self._parentids = {} |
|
51 | self._parentids = {} | |
51 |
|
52 | |||
|
53 | def _checkrepotype(self, path): | |||
|
54 | # Lightweight checkouts detection is informational but probably | |||
|
55 | # fragile at API level. It should not terminate the conversion. | |||
|
56 | try: | |||
|
57 | from bzrlib import bzrdir | |||
|
58 | dir = bzrdir.BzrDir.open_containing(path)[0] | |||
|
59 | try: | |||
|
60 | tree = dir.open_workingtree(recommend_upgrade=False) | |||
|
61 | branch = tree.branch | |||
|
62 | except (errors.NoWorkingTree, errors.NotLocalUrl), e: | |||
|
63 | tree = None | |||
|
64 | branch = dir.open_branch() | |||
|
65 | if (tree is not None and tree.bzrdir.root_transport.base != | |||
|
66 | branch.bzrdir.root_transport.base): | |||
|
67 | self.ui.warn(_('warning: lightweight checkouts may cause ' | |||
|
68 | 'conversion failures, try with a regular ' | |||
|
69 | 'branch instead.\n')) | |||
|
70 | except: | |||
|
71 | self.ui.note(_('bzr source type could not be determined\n')) | |||
|
72 | ||||
52 | def before(self): |
|
73 | def before(self): | |
53 | """Before the conversion begins, acquire a read lock |
|
74 | """Before the conversion begins, acquire a read lock | |
54 | for all the operations that might need it. Fortunately |
|
75 | for all the operations that might need it. Fortunately |
@@ -34,6 +34,12 b' EOF' | |||||
34 | hg convert --filemap filemap source source-filemap-hg |
|
34 | hg convert --filemap filemap source source-filemap-hg | |
35 | hg -R source-filemap-hg manifest -r tip |
|
35 | hg -R source-filemap-hg manifest -r tip | |
36 |
|
36 | |||
|
37 | echo '% convert from lightweight checkout' | |||
|
38 | bzr checkout --lightweight source source-light | |||
|
39 | hg convert source-light source-light-hg | |||
|
40 | echo "% lightweight manifest" | |||
|
41 | hg manifest -R source-light-hg -r tip | |||
|
42 | ||||
37 | # extract timestamps that look just like hg's {date|isodate}: |
|
43 | # extract timestamps that look just like hg's {date|isodate}: | |
38 | # yyyy-mm-dd HH:MM zzzz (no seconds!) |
|
44 | # yyyy-mm-dd HH:MM zzzz (no seconds!) | |
39 | echo "% compare timestamps" |
|
45 | echo "% compare timestamps" |
@@ -35,6 +35,19 b' 0 rename a into b, create a, rename c in' | |||||
35 | b |
|
35 | b | |
36 | d |
|
36 | d | |
37 | f |
|
37 | f | |
|
38 | % convert from lightweight checkout | |||
|
39 | initializing destination source-light-hg repository | |||
|
40 | warning: lightweight checkouts may cause conversion failures, try with a regular branch instead. | |||
|
41 | scanning source... | |||
|
42 | sorting... | |||
|
43 | converting... | |||
|
44 | 1 Initial add: a, c, e | |||
|
45 | 0 rename a into b, create a, rename c into d | |||
|
46 | % lightweight manifest | |||
|
47 | a | |||
|
48 | b | |||
|
49 | d | |||
|
50 | f | |||
38 | % compare timestamps |
|
51 | % compare timestamps | |
39 | good: hg timestamps match bzr timestamps |
|
52 | good: hg timestamps match bzr timestamps | |
40 | % merge |
|
53 | % merge |
General Comments 0
You need to be logged in to leave comments.
Login now