Show More
@@ -193,7 +193,8 b' class convert(object):' | |||
|
193 | 193 | do_copies = hasattr(self.dest, 'copyfile') |
|
194 | 194 | filenames = [] |
|
195 | 195 | |
|
196 |
f |
|
|
196 | files, copies = self.source.getchanges(rev) | |
|
197 | for f, v in files: | |
|
197 | 198 | newf = self.mapfile(f) |
|
198 | 199 | if not newf: |
|
199 | 200 | continue |
@@ -206,8 +207,8 b' class convert(object):' | |||
|
206 | 207 | e = self.source.getmode(f, v) |
|
207 | 208 | self.dest.putfile(newf, e, data) |
|
208 | 209 | if do_copies: |
|
209 |
if f in |
|
|
210 |
copyf = self.mapfile( |
|
|
210 | if f in copies: | |
|
211 | copyf = self.mapfile(copies[f]) | |
|
211 | 212 | if copyf: |
|
212 | 213 | # Merely marks that a copy happened. |
|
213 | 214 | self.dest.copyfile(copyf, newf) |
@@ -3,15 +3,13 b'' | |||
|
3 | 3 | class NoRepo(Exception): pass |
|
4 | 4 | |
|
5 | 5 | class commit(object): |
|
6 |
def __init__(self, author, date, desc, parents, branch=None, rev=None |
|
|
7 | copies={}): | |
|
6 | def __init__(self, author, date, desc, parents, branch=None, rev=None): | |
|
8 | 7 | self.author = author |
|
9 | 8 | self.date = date |
|
10 | 9 | self.desc = desc |
|
11 | 10 | self.parents = parents |
|
12 | 11 | self.branch = branch |
|
13 | 12 | self.rev = rev |
|
14 | self.copies = copies | |
|
15 | 13 | |
|
16 | 14 | class converter_source(object): |
|
17 | 15 | """Conversion source interface""" |
@@ -42,10 +40,12 b' class converter_source(object):' | |||
|
42 | 40 | raise NotImplementedError() |
|
43 | 41 | |
|
44 | 42 | def getchanges(self, version): |
|
45 | """Return sorted list of (filename, id) tuples for all files changed in rev. | |
|
43 | """Returns a tuple of (files, copies) | |
|
44 | Files is a sorted list of (filename, id) tuples for all files changed | |
|
45 | in version, where id is the source revision id of the file. | |
|
46 | 46 | |
|
47 | id just tells us which revision to return in getfile(), e.g. in | |
|
48 | git it's an object hash.""" | |
|
47 | copies is a dictionary of dest: source | |
|
48 | """ | |
|
49 | 49 | raise NotImplementedError() |
|
50 | 50 | |
|
51 | 51 | def getcommit(self, version): |
@@ -250,7 +250,7 b' class convert_cvs(converter_source):' | |||
|
250 | 250 | files = self.files[rev] |
|
251 | 251 | cl = files.items() |
|
252 | 252 | cl.sort() |
|
253 | return cl | |
|
253 | return (cl, {}) | |
|
254 | 254 | |
|
255 | 255 | def getcommit(self, rev): |
|
256 | 256 | return self.changeset[rev] |
@@ -48,7 +48,7 b' class convert_git(converter_source):' | |||
|
48 | 48 | s = (m[1] == "120000") |
|
49 | 49 | self.modecache[(f, h)] = (p and "x") or (s and "l") or "" |
|
50 | 50 | changes.append((f, h)) |
|
51 | return changes | |
|
51 | return (changes, {}) | |
|
52 | 52 | |
|
53 | 53 | def getcommit(self, version): |
|
54 | 54 | c = self.catfile(version, "commit") # read the commit hash |
@@ -151,7 +151,7 b' class mercurial_source(converter_source)' | |||
|
151 | 151 | m, a, r = self.repo.status(ctx.parents()[0].node(), ctx.node())[:3] |
|
152 | 152 | changes = [(name, rev) for name in m + a + r] |
|
153 | 153 | changes.sort() |
|
154 | return changes | |
|
154 | return (changes, self.getcopies(ctx)) | |
|
155 | 155 | |
|
156 | 156 | def getcopies(self, ctx): |
|
157 | 157 | added = self.repo.status(ctx.parents()[0].node(), ctx.node())[1] |
@@ -168,7 +168,7 b' class mercurial_source(converter_source)' | |||
|
168 | 168 | parents = [hex(p.node()) for p in ctx.parents() if p.node() != nullid] |
|
169 | 169 | return commit(author=ctx.user(), date=util.datestr(ctx.date()), |
|
170 | 170 | desc=ctx.description(), parents=parents, |
|
171 |
branch=ctx.branch() |
|
|
171 | branch=ctx.branch()) | |
|
172 | 172 | |
|
173 | 173 | def gettags(self): |
|
174 | 174 | tags = [t for t in self.repo.tagslist() if t[0] != 'tip'] |
@@ -98,7 +98,7 b' class convert_svn(converter_source):' | |||
|
98 | 98 | self.module = self.url[len(self.base):] |
|
99 | 99 | self.modulemap = {} # revision, module |
|
100 | 100 | self.commits = {} |
|
101 |
self. |
|
|
101 | self.paths = {} | |
|
102 | 102 | self.uuid = svn.ra.get_uuid(self.ra).decode(self.encoding) |
|
103 | 103 | except SubversionException, e: |
|
104 | 104 | raise NoRepo("couldn't open SVN repo %s" % self.url) |
@@ -173,12 +173,14 b' class convert_svn(converter_source):' | |||
|
173 | 173 | |
|
174 | 174 | def getchanges(self, rev): |
|
175 | 175 | self.modecache = {} |
|
176 |
|
|
|
177 | cl = files | |
|
178 |
|
|
|
176 | (paths, parents) = self.paths[rev] | |
|
177 | files, copies = self.expandpaths(rev, paths, parents) | |
|
178 | files.sort() | |
|
179 | files = zip(files, [rev] * len(files)) | |
|
180 | ||
|
179 | 181 | # caller caches the result, so free it here to release memory |
|
180 |
del self. |
|
|
181 |
return |
|
|
182 | del self.paths[rev] | |
|
183 | return (files, copies) | |
|
182 | 184 | |
|
183 | 185 | def getcommit(self, rev): |
|
184 | 186 | if rev not in self.commits: |
@@ -350,8 +352,14 b' class convert_svn(converter_source):' | |||
|
350 | 352 | copies = {} |
|
351 | 353 | revnum = self.revnum(rev) |
|
352 | 354 | |
|
355 | if revnum in self.modulemap: | |
|
356 | new_module = self.modulemap[revnum] | |
|
357 | if new_module != self.module: | |
|
358 | self.module = new_module | |
|
359 | self.reparent(self.module) | |
|
360 | ||
|
353 | 361 | for path, ent in paths: |
|
354 |
|
|
|
362 | self.ui.write("path %s\n" % path) | |
|
355 | 363 | entrypath = get_entry_from_path(path, module=self.module) |
|
356 | 364 | entry = entrypath.decode(self.encoding) |
|
357 | 365 | |
@@ -554,12 +562,7 b' class convert_svn(converter_source):' | |||
|
554 | 562 | continue |
|
555 | 563 | paths.append((path, ent)) |
|
556 | 564 | |
|
557 |
|
|
|
558 | # a list of (filename, id) where id lets us retrieve the file. | |
|
559 | # eg in git, id is the object hash. for svn it'll be the | |
|
560 | self.files[rev] = zip(entries, [rev] * len(entries)) | |
|
561 | if not entries: | |
|
562 | return | |
|
565 | self.paths[rev] = (paths, parents) | |
|
563 | 566 | |
|
564 | 567 | # Example SVN datetime. Includes microseconds. |
|
565 | 568 | # ISO-8601 conformant |
@@ -579,7 +582,6 b' class convert_svn(converter_source):' | |||
|
579 | 582 | date=util.datestr(date), |
|
580 | 583 | desc=log, |
|
581 | 584 | parents=parents, |
|
582 | copies=copies, | |
|
583 | 585 | branch=branch, |
|
584 | 586 | rev=rev.encode('utf-8')) |
|
585 | 587 |
General Comments 0
You need to be logged in to leave comments.
Login now