Show More
@@ -23,7 +23,7 b' from common import NoRepo, commit, conve' | |||
|
23 | 23 | |
|
24 | 24 | try: |
|
25 | 25 | # bazaar imports |
|
26 |
from bzrlib import b |
|
|
26 | from bzrlib import bzrdir, revision, errors | |
|
27 | 27 | from bzrlib.revisionspec import RevisionSpec |
|
28 | 28 | except ImportError: |
|
29 | 29 | pass |
@@ -42,14 +42,17 b' class bzr_source(converter_source):' | |||
|
42 | 42 | |
|
43 | 43 | try: |
|
44 | 44 | # access bzrlib stuff |
|
45 |
b |
|
|
45 | bzrdir | |
|
46 | 46 | except NameError: |
|
47 | 47 | raise NoRepo(_('Bazaar modules could not be loaded')) |
|
48 | 48 | |
|
49 | 49 | path = os.path.abspath(path) |
|
50 | 50 | self._checkrepotype(path) |
|
51 | self.branch = branch.Branch.open(path) | |
|
52 |
self.sourcerepo = |
|
|
51 | try: | |
|
52 | self.sourcerepo = bzrdir.BzrDir.open(path).open_repository() | |
|
53 | except errors.NoRepositoryPresent: | |
|
54 | raise NoRepo(_('%s does not look like a Bazaar repository') | |
|
55 | % path) | |
|
53 | 56 | self._parentids = {} |
|
54 | 57 | |
|
55 | 58 | def _checkrepotype(self, path): |
@@ -90,14 +93,21 b' class bzr_source(converter_source):' | |||
|
90 | 93 | |
|
91 | 94 | def getheads(self): |
|
92 | 95 | if not self.rev: |
|
93 |
|
|
|
94 | try: | |
|
95 | r = RevisionSpec.from_string(self.rev) | |
|
96 | info = r.in_history(self.branch) | |
|
97 | except errors.BzrError: | |
|
98 | raise util.Abort(_('%s is not a valid revision in current branch') | |
|
99 |
|
|
|
100 | return [info.rev_id] | |
|
96 | heads = sorted([b.last_revision() | |
|
97 | for b in self.sourcerepo.find_branches()]) | |
|
98 | else: | |
|
99 | revid = None | |
|
100 | for branch in self.sourcerepo.find_branches(): | |
|
101 | try: | |
|
102 | r = RevisionSpec.from_string(self.rev) | |
|
103 | info = r.in_history(branch) | |
|
104 | except errors.BzrError: | |
|
105 | pass | |
|
106 | revid = info.rev_id | |
|
107 | if revid is None: | |
|
108 | raise util.Abort(_('%s is not a valid revision') % self.rev) | |
|
109 | heads = [revid] | |
|
110 | return heads | |
|
101 | 111 | |
|
102 | 112 | def getfile(self, name, rev): |
|
103 | 113 | revtree = self.sourcerepo.revision_tree(rev) |
@@ -140,19 +150,24 b' class bzr_source(converter_source):' | |||
|
140 | 150 | parents = self._filterghosts(rev.parent_ids) |
|
141 | 151 | self._parentids[version] = parents |
|
142 | 152 | |
|
153 | branch = self.recode(rev.properties.get('branch-nick', u'default')) | |
|
154 | if branch == 'trunk': | |
|
155 | branch = 'default' | |
|
143 | 156 | return commit(parents=parents, |
|
144 | 157 | date='%d %d' % (rev.timestamp, -rev.timezone), |
|
145 | 158 | author=self.recode(rev.committer), |
|
146 | 159 | desc=self.recode(rev.message), |
|
160 | branch=branch, | |
|
147 | 161 | rev=version) |
|
148 | 162 | |
|
149 | 163 | def gettags(self): |
|
150 | if not self.branch.supports_tags(): | |
|
151 | return {} | |
|
152 | tagdict = self.branch.tags.get_tag_dict() | |
|
153 | 164 | bytetags = {} |
|
154 | for name, rev in tagdict.iteritems(): | |
|
155 | bytetags[self.recode(name)] = rev | |
|
165 | for branch in self.sourcerepo.find_branches(): | |
|
166 | if not branch.supports_tags(): | |
|
167 | return {} | |
|
168 | tagdict = branch.tags.get_tag_dict() | |
|
169 | for name, rev in tagdict.iteritems(): | |
|
170 | bytetags[self.recode(name)] = rev | |
|
156 | 171 | return bytetags |
|
157 | 172 | |
|
158 | 173 | def getchangedfiles(self, rev, i): |
@@ -9,7 +9,7 b" echo 'hgext.graphlog = ' >> $HGRCPATH" | |||
|
9 | 9 | |
|
10 | 10 | glog() |
|
11 | 11 | { |
|
12 | hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" | |
|
12 | hg glog --template '{rev}@{branch} "{desc|firstline}" files: {files}\n' "$@" | |
|
13 | 13 | } |
|
14 | 14 | |
|
15 | 15 | manifest() |
@@ -30,7 +30,7 b' ghost revisions' | |||
|
30 | 30 | 1 Initial layout setup |
|
31 | 31 | 0 Commit with ghost revision |
|
32 | 32 | $ glog -R source-hg |
|
33 | o 1 "Commit with ghost revision" files: somefile | |
|
33 | o 1@source "Commit with ghost revision" files: somefile | |
|
34 | 34 | | |
|
35 | o 0 "Initial layout setup" files: somefile | |
|
35 | o 0@source "Initial layout setup" files: somefile | |
|
36 | 36 |
@@ -48,17 +48,17 b' test multiple merges at once' | |||
|
48 | 48 | 1 Added brach2 file |
|
49 | 49 | 0 Merged branches |
|
50 | 50 | $ glog -R source-hg |
|
51 | o 5 "(octopus merge fixup)" files: | |
|
51 | o 5@source "(octopus merge fixup)" files: | |
|
52 | 52 | |\ |
|
53 | | o 4 "Merged branches" files: file-branch2 | |
|
53 | | o 4@source "Merged branches" files: file-branch2 | |
|
54 | 54 | | |\ |
|
55 | o---+ 3 "Added brach2 file" files: file-branch2 | |
|
55 | o---+ 3@source-branch2 "Added brach2 file" files: file-branch2 | |
|
56 | 56 | / / |
|
57 | | o 2 "Added parent file" files: file-parent | |
|
57 | | o 2@source "Added parent file" files: file-parent | |
|
58 | 58 | | | |
|
59 | o | 1 "Added branch1 file" files: file file-branch1 | |
|
59 | o | 1@source-branch1 "Added branch1 file" files: file file-branch1 | |
|
60 | 60 | |/ |
|
61 | o 0 "Initial add" files: file | |
|
61 | o 0@source "Initial add" files: file | |
|
62 | 62 | |
|
63 | 63 | $ manifest source-hg tip |
|
64 | 64 | % manifest of tip |
@@ -32,9 +32,9 b' create and rename on the same file in th' | |||
|
32 | 32 | 1 Initial add: a, c, e |
|
33 | 33 | 0 rename a into b, create a, rename c into d |
|
34 | 34 | $ glog -R source-hg |
|
35 | o 1 "rename a into b, create a, rename c into d" files: a b c d e f | |
|
35 | o 1@source "rename a into b, create a, rename c into d" files: a b c d e f | |
|
36 | 36 | | |
|
37 | o 0 "Initial add: a, c, e" files: a c e | |
|
37 | o 0@source "Initial add: a, c, e" files: a c e | |
|
38 | 38 | |
|
39 | 39 | |
|
40 | 40 | manifest |
@@ -54,7 +54,7 b' test --rev option' | |||
|
54 | 54 | converting... |
|
55 | 55 | 0 Initial add: a, c, e |
|
56 | 56 | $ glog -R source-1-hg |
|
57 | o 0 "Initial add: a, c, e" files: a c e | |
|
57 | o 0@source "Initial add: a, c, e" files: a c e | |
|
58 | 58 | |
|
59 | 59 | |
|
60 | 60 | test with filemap |
@@ -77,22 +77,12 b' test with filemap' | |||
|
77 | 77 | convert from lightweight checkout |
|
78 | 78 | |
|
79 | 79 | $ bzr checkout --lightweight source source-light |
|
80 | $ hg convert source-light source-light-hg | |
|
80 | $ hg convert -s bzr source-light source-light-hg | |
|
81 | 81 | initializing destination source-light-hg repository |
|
82 | 82 | warning: lightweight checkouts may cause conversion failures, try with a regular branch instead. |
|
83 | scanning source... | |
|
84 | sorting... | |
|
85 | converting... | |
|
86 | 1 Initial add: a, c, e | |
|
87 | 0 rename a into b, create a, rename c into d | |
|
88 | ||
|
89 | lightweight manifest | |
|
90 | ||
|
91 | $ hg manifest -R source-light-hg -r tip | |
|
92 | a | |
|
93 | b | |
|
94 | d | |
|
95 | f | |
|
83 | $TESTTMP/test-createandrename/source-light does not look like a Bazaar repository | |
|
84 | abort: source-light: missing or unsupported repository | |
|
85 | [255] | |
|
96 | 86 | |
|
97 | 87 | extract timestamps that look just like hg's {date|isodate}: |
|
98 | 88 | yyyy-mm-dd HH:MM zzzz (no seconds!) |
@@ -147,13 +137,13 b' merge' | |||
|
147 | 137 | 1 Editing b |
|
148 | 138 | 0 Merged improve branch |
|
149 | 139 | $ glog -R source-hg |
|
150 | o 3 "Merged improve branch" files: | |
|
140 | o 3@source "Merged improve branch" files: | |
|
151 | 141 | |\ |
|
152 | | o 2 "Editing b" files: b | |
|
142 | | o 2@source-improve "Editing b" files: b | |
|
153 | 143 | | | |
|
154 | o | 1 "Editing a" files: a | |
|
144 | o | 1@source "Editing a" files: a | |
|
155 | 145 | |/ |
|
156 | o 0 "Initial add" files: a b | |
|
146 | o 0@source "Initial add" files: a b | |
|
157 | 147 | |
|
158 | 148 | $ cd .. |
|
159 | 149 | |
@@ -208,3 +198,41 b' test the symlinks can be recreated' | |||
|
208 | 198 | $ hg cat syma; echo |
|
209 | 199 | a |
|
210 | 200 | |
|
201 | Multiple branches | |
|
202 | ||
|
203 | $ bzr init-repo -q --no-trees repo | |
|
204 | $ bzr init -q repo/trunk | |
|
205 | $ bzr co repo/trunk repo-trunk | |
|
206 | $ cd repo-trunk | |
|
207 | $ echo a > a | |
|
208 | $ bzr add a | |
|
209 | adding a | |
|
210 | $ bzr ci -qm adda --commit-time '2012-01-01 00:00:01 +0000' | |
|
211 | $ bzr switch -b branch | |
|
212 | Tree is up to date at revision 1. | |
|
213 | Switched to branch: *repo/branch/ (glob) | |
|
214 | $ echo b > b | |
|
215 | $ bzr add b | |
|
216 | adding b | |
|
217 | $ bzr ci -qm addb --commit-time '2012-01-01 00:00:02 +0000' | |
|
218 | $ bzr switch --force ../repo/trunk | |
|
219 | Updated to revision 1. | |
|
220 | Switched to branch: */repo/trunk/ (glob) | |
|
221 | $ echo a >> a | |
|
222 | $ bzr ci -qm changea --commit-time '2012-01-01 00:00:03 +0000' | |
|
223 | $ cd .. | |
|
224 | $ hg convert --datesort repo repo-bzr | |
|
225 | initializing destination repo-bzr repository | |
|
226 | scanning source... | |
|
227 | sorting... | |
|
228 | converting... | |
|
229 | 2 adda | |
|
230 | 1 addb | |
|
231 | 0 changea | |
|
232 | $ (cd repo-bzr; glog) | |
|
233 | o 2@default "changea" files: a | |
|
234 | | | |
|
235 | | o 1@branch "addb" files: b | |
|
236 | |/ | |
|
237 | o 0@default "adda" files: a | |
|
238 |
General Comments 0
You need to be logged in to leave comments.
Login now