96 self.ctx = self.transport.client |
96 self.ctx = self.transport.client |
97 self.base = svn.ra.get_repos_root(self.ra) |
97 self.base = svn.ra.get_repos_root(self.ra) |
98 self.module = self.url[len(self.base):] |
98 self.module = self.url[len(self.base):] |
99 self.modulemap = {} # revision, module |
99 self.modulemap = {} # revision, module |
100 self.commits = {} |
100 self.commits = {} |
101 self.files = {} |
101 self.paths = {} |
102 self.uuid = svn.ra.get_uuid(self.ra).decode(self.encoding) |
102 self.uuid = svn.ra.get_uuid(self.ra).decode(self.encoding) |
103 except SubversionException, e: |
103 except SubversionException, e: |
104 raise NoRepo("couldn't open SVN repo %s" % self.url) |
104 raise NoRepo("couldn't open SVN repo %s" % self.url) |
105 |
105 |
106 try: |
106 try: |
171 def getmode(self, file, rev): |
171 def getmode(self, file, rev): |
172 return self.modecache[(file, rev)] |
172 return self.modecache[(file, rev)] |
173 |
173 |
174 def getchanges(self, rev): |
174 def getchanges(self, rev): |
175 self.modecache = {} |
175 self.modecache = {} |
176 files = self.files[rev] |
176 (paths, parents) = self.paths[rev] |
177 cl = files |
177 files, copies = self.expandpaths(rev, paths, parents) |
178 cl.sort() |
178 files.sort() |
|
179 files = zip(files, [rev] * len(files)) |
|
180 |
179 # caller caches the result, so free it here to release memory |
181 # caller caches the result, so free it here to release memory |
180 del self.files[rev] |
182 del self.paths[rev] |
181 return cl |
183 return (files, copies) |
182 |
184 |
183 def getcommit(self, rev): |
185 def getcommit(self, rev): |
184 if rev not in self.commits: |
186 if rev not in self.commits: |
185 uuid, module, revnum = self.revsplit(rev) |
187 uuid, module, revnum = self.revsplit(rev) |
186 self.module = module |
188 self.module = module |
348 entries = [] |
350 entries = [] |
349 copyfrom = {} # Map of entrypath, revision for finding source of deleted revisions. |
351 copyfrom = {} # Map of entrypath, revision for finding source of deleted revisions. |
350 copies = {} |
352 copies = {} |
351 revnum = self.revnum(rev) |
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 for path, ent in paths: |
361 for path, ent in paths: |
354 # self.ui.write("path %s\n" % path) |
362 self.ui.write("path %s\n" % path) |
355 entrypath = get_entry_from_path(path, module=self.module) |
363 entrypath = get_entry_from_path(path, module=self.module) |
356 entry = entrypath.decode(self.encoding) |
364 entry = entrypath.decode(self.encoding) |
357 |
365 |
358 kind = svn.ra.check_path(self.ra, entrypath, revnum) |
366 kind = svn.ra.check_path(self.ra, entrypath, revnum) |
359 if kind == svn.core.svn_node_file: |
367 if kind == svn.core.svn_node_file: |
552 if not path.startswith(self.module): |
560 if not path.startswith(self.module): |
553 self.ui.debug("boring@%s: %s\n" % (revnum, path)) |
561 self.ui.debug("boring@%s: %s\n" % (revnum, path)) |
554 continue |
562 continue |
555 paths.append((path, ent)) |
563 paths.append((path, ent)) |
556 |
564 |
557 entries, copies = self.expandpaths(rev, paths, parents) |
565 self.paths[rev] = (paths, parents) |
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 |
|
563 |
566 |
564 # Example SVN datetime. Includes microseconds. |
567 # Example SVN datetime. Includes microseconds. |
565 # ISO-8601 conformant |
568 # ISO-8601 conformant |
566 # '2007-01-04T17:35:00.902377Z' |
569 # '2007-01-04T17:35:00.902377Z' |
567 date = util.parsedate(date[:18] + " UTC", ["%Y-%m-%dT%H:%M:%S"]) |
570 date = util.parsedate(date[:18] + " UTC", ["%Y-%m-%dT%H:%M:%S"]) |
577 |
580 |
578 cset = commit(author=author, |
581 cset = commit(author=author, |
579 date=util.datestr(date), |
582 date=util.datestr(date), |
580 desc=log, |
583 desc=log, |
581 parents=parents, |
584 parents=parents, |
582 copies=copies, |
|
583 branch=branch, |
585 branch=branch, |
584 rev=rev.encode('utf-8')) |
586 rev=rev.encode('utf-8')) |
585 |
587 |
586 self.commits[rev] = cset |
588 self.commits[rev] = cset |
587 if self.child_cset and not self.child_cset.parents: |
589 if self.child_cset and not self.child_cset.parents: |