155 def getfile(self, file, rev): |
155 def getfile(self, file, rev): |
156 data, mode = self._getfile(file, rev) |
156 data, mode = self._getfile(file, rev) |
157 self.modecache[(file, rev)] = mode |
157 self.modecache[(file, rev)] = mode |
158 return data |
158 return data |
159 |
159 |
160 def getmode(self, file, rev): |
160 def getmode(self, file, rev): |
161 return self.modecache[(file, rev)] |
161 return self.modecache[(file, rev)] |
162 |
162 |
163 def getchanges(self, rev): |
163 def getchanges(self, rev): |
164 self.modecache = {} |
164 self.modecache = {} |
165 files = self.files[rev] |
165 files = self.files[rev] |
447 # print "Deleted/moved non-file:", revnum, path, ent |
447 # print "Deleted/moved non-file:", revnum, path, ent |
448 # children = self._find_children(path, revnum - 1) |
448 # children = self._find_children(path, revnum - 1) |
449 # print "find children %s@%d from %d action %s" % (path, revnum, ent.copyfrom_rev, ent.action) |
449 # print "find children %s@%d from %d action %s" % (path, revnum, ent.copyfrom_rev, ent.action) |
450 # Sometimes this is tricky. For example: in |
450 # Sometimes this is tricky. For example: in |
451 # The Subversion Repository revision 6940 a dir |
451 # The Subversion Repository revision 6940 a dir |
452 # was copied and one of its files was deleted |
452 # was copied and one of its files was deleted |
453 # from the new location in the same commit. This |
453 # from the new location in the same commit. This |
454 # code can't deal with that yet. |
454 # code can't deal with that yet. |
455 if ent.action == 'C': |
455 if ent.action == 'C': |
456 children = self._find_children(path, fromrev) |
456 children = self._find_children(path, fromrev) |
457 else: |
457 else: |
461 children = [s.replace(oroot,nroot) for s in children] |
461 children = [s.replace(oroot,nroot) for s in children] |
462 # Mark all [files, not directories] as deleted. |
462 # Mark all [files, not directories] as deleted. |
463 for child in children: |
463 for child in children: |
464 # Can we move a child directory and its |
464 # Can we move a child directory and its |
465 # parent in the same commit? (probably can). Could |
465 # parent in the same commit? (probably can). Could |
466 # cause problems if instead of revnum -1, |
466 # cause problems if instead of revnum -1, |
467 # we have to look in (copyfrom_path, revnum - 1) |
467 # we have to look in (copyfrom_path, revnum - 1) |
468 entrypath = get_entry_from_path("/" + child, module=old_module) |
468 entrypath = get_entry_from_path("/" + child, module=old_module) |
469 if entrypath: |
469 if entrypath: |
470 entry = self.recode(entrypath.decode(self.encoding)) |
470 entry = self.recode(entrypath.decode(self.encoding)) |
471 if entry in copies: |
471 if entry in copies: |
491 children = self._find_children(path, revnum) |
491 children = self._find_children(path, revnum) |
492 children.sort() |
492 children.sort() |
493 for child in children: |
493 for child in children: |
494 # Can we move a child directory and its |
494 # Can we move a child directory and its |
495 # parent in the same commit? (probably can). Could |
495 # parent in the same commit? (probably can). Could |
496 # cause problems if instead of revnum -1, |
496 # cause problems if instead of revnum -1, |
497 # we have to look in (copyfrom_path, revnum - 1) |
497 # we have to look in (copyfrom_path, revnum - 1) |
498 entrypath = get_entry_from_path("/" + child, module=self.module) |
498 entrypath = get_entry_from_path("/" + child, module=self.module) |
499 # print child, self.module, entrypath |
499 # print child, self.module, entrypath |
500 if entrypath: |
500 if entrypath: |
501 # Need to filter out directories here... |
501 # Need to filter out directories here... |
540 copies[self.recode(copyto_entry)] = self.recode(entry) |
540 copies[self.recode(copyto_entry)] = self.recode(entry) |
541 # copy from quux splort/quuxfile |
541 # copy from quux splort/quuxfile |
542 |
542 |
543 self.modulemap[revnum] = self.module # track backwards in time |
543 self.modulemap[revnum] = self.module # track backwards in time |
544 # a list of (filename, id) where id lets us retrieve the file. |
544 # a list of (filename, id) where id lets us retrieve the file. |
545 # eg in git, id is the object hash. for svn it'll be the |
545 # eg in git, id is the object hash. for svn it'll be the |
546 self.files[rev] = zip(entries, [rev] * len(entries)) |
546 self.files[rev] = zip(entries, [rev] * len(entries)) |
547 if not entries: |
547 if not entries: |
548 return |
548 return |
549 |
549 |
550 # Example SVN datetime. Includes microseconds. |
550 # Example SVN datetime. Includes microseconds. |
554 |
554 |
555 log = message and self.recode(message) |
555 log = message and self.recode(message) |
556 author = author and self.recode(author) or '' |
556 author = author and self.recode(author) or '' |
557 |
557 |
558 cset = commit(author=author, |
558 cset = commit(author=author, |
559 date=util.datestr(date), |
559 date=util.datestr(date), |
560 desc=log, |
560 desc=log, |
561 parents=parents, |
561 parents=parents, |
562 copies=copies, |
562 copies=copies, |
563 branch=branch, |
563 branch=branch, |
564 rev=rev.encode('utf-8')) |
564 rev=rev.encode('utf-8')) |
565 |
565 |
583 self.ui.debug('revision %d has no entries\n' % revnum) |
583 self.ui.debug('revision %d has no entries\n' % revnum) |
584 continue |
584 continue |
585 parselogentry(orig_paths, revnum, author, date, message) |
585 parselogentry(orig_paths, revnum, author, date, message) |
586 except SubversionException, (_, num): |
586 except SubversionException, (_, num): |
587 if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION: |
587 if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION: |
588 raise NoSuchRevision(branch=self, |
588 raise NoSuchRevision(branch=self, |
589 revision="Revision number %d" % to_revnum) |
589 revision="Revision number %d" % to_revnum) |
590 raise |
590 raise |
591 |
591 |
592 def _getfile(self, file, rev): |
592 def _getfile(self, file, rev): |
593 io = StringIO() |
593 io = StringIO() |