Show More
@@ -1,19 +1,6 b'' | |||||
1 | # Subversion 1.4/1.5 Python API backend |
|
1 | # Subversion 1.4/1.5 Python API backend | |
2 | # |
|
2 | # | |
3 | # Copyright(C) 2007 Daniel Holth et al |
|
3 | # Copyright(C) 2007 Daniel Holth et al | |
4 | # |
|
|||
5 | # Configuration options: |
|
|||
6 | # |
|
|||
7 | # convert.svn.trunk |
|
|||
8 | # Relative path to the trunk (default: "trunk") |
|
|||
9 | # convert.svn.branches |
|
|||
10 | # Relative path to tree of branches (default: "branches") |
|
|||
11 | # convert.svn.tags |
|
|||
12 | # Relative path to tree of tags (default: "tags") |
|
|||
13 | # |
|
|||
14 | # Set these in a hgrc, or on the command line as follows: |
|
|||
15 | # |
|
|||
16 | # hg convert --config convert.svn.trunk=wackoname [...] |
|
|||
17 |
|
4 | |||
18 | import locale |
|
5 | import locale | |
19 | import os |
|
6 | import os | |
@@ -213,7 +200,6 b' class svn_source(converter_source):' | |||||
213 | raise MissingTool(_('Subversion python bindings are too old, 1.4 ' |
|
200 | raise MissingTool(_('Subversion python bindings are too old, 1.4 ' | |
214 | 'or later required')) |
|
201 | 'or later required')) | |
215 |
|
202 | |||
216 | self.encoding = locale.getpreferredencoding() |
|
|||
217 | self.lastrevs = {} |
|
203 | self.lastrevs = {} | |
218 |
|
204 | |||
219 | latest = None |
|
205 | latest = None | |
@@ -524,8 +510,6 b' class svn_source(converter_source):' | |||||
524 | self.convertfp.write('%s %d\n' % (destrev, self.revnum(rev))) |
|
510 | self.convertfp.write('%s %d\n' % (destrev, self.revnum(rev))) | |
525 | self.convertfp.flush() |
|
511 | self.convertfp.flush() | |
526 |
|
512 | |||
527 | # -- helper functions -- |
|
|||
528 |
|
||||
529 | def revid(self, revnum, module=None): |
|
513 | def revid(self, revnum, module=None): | |
530 | if not module: |
|
514 | if not module: | |
531 | module = self.module |
|
515 | module = self.module | |
@@ -598,7 +582,8 b' class svn_source(converter_source):' | |||||
598 | It is not uncommon for two nearby revisions to cancel each other |
|
582 | It is not uncommon for two nearby revisions to cancel each other | |
599 | out, e.g. 'I copied trunk into a subdirectory of itself instead |
|
583 | out, e.g. 'I copied trunk into a subdirectory of itself instead | |
600 | of making a branch'. The converted repository is significantly |
|
584 | of making a branch'. The converted repository is significantly | |
601 |
smaller if we ignore such revisions. |
|
585 | smaller if we ignore such revisions. | |
|
586 | """ | |||
602 | self.blacklist = set() |
|
587 | self.blacklist = set() | |
603 | blacklist = self.blacklist |
|
588 | blacklist = self.blacklist | |
604 | for line in file("blacklist.txt", "r"): |
|
589 | for line in file("blacklist.txt", "r"): | |
@@ -700,18 +685,14 b' class svn_source(converter_source):' | |||||
700 | fromkind = svn.ra.check_path(self.ra, entrypath.strip('/'), fromrev) |
|
685 | fromkind = svn.ra.check_path(self.ra, entrypath.strip('/'), fromrev) | |
701 | self.reparent(prevmodule) |
|
686 | self.reparent(prevmodule) | |
702 |
|
687 | |||
703 |
if fromkind == svn.core.svn_node_file: |
|
688 | if fromkind == svn.core.svn_node_file: | |
704 | entries.append(self.recode(entry)) |
|
689 | entries.append(self.recode(entry)) | |
705 | elif fromkind == svn.core.svn_node_dir: |
|
690 | elif fromkind == svn.core.svn_node_dir: | |
706 | # print "Deleted/moved non-file:", revnum, path, ent |
|
691 | # Sometimes this is tricky. For example: in The | |
707 | # children = self._find_children(path, revnum - 1) |
|
692 | # Subversion Repository revision 6940 a dir was | |
708 | # print ("find children %s@%d from %d action %s" % |
|
693 | # copied and one of its files was deleted from the | |
709 | # (path, revnum, ent.copyfrom_rev, ent.action)) |
|
694 | # new location in the same commit. This code can't | |
710 | # Sometimes this is tricky. For example: in |
|
695 | # deal with that yet. | |
711 | # The Subversion Repository revision 6940 a dir |
|
|||
712 | # was copied and one of its files was deleted |
|
|||
713 | # from the new location in the same commit. This |
|
|||
714 | # code can't deal with that yet. |
|
|||
715 | if ent.action == 'C': |
|
696 | if ent.action == 'C': | |
716 | children = self._find_children(path, fromrev) |
|
697 | children = self._find_children(path, fromrev) | |
717 | else: |
|
698 | else: | |
@@ -737,21 +718,11 b' class svn_source(converter_source):' | |||||
737 | self.ui.debug(_('unknown path in revision %d: %s\n') % \ |
|
718 | self.ui.debug(_('unknown path in revision %d: %s\n') % \ | |
738 | (revnum, path)) |
|
719 | (revnum, path)) | |
739 | elif kind == svn.core.svn_node_dir: |
|
720 | elif kind == svn.core.svn_node_dir: | |
740 | # Should probably synthesize normal file entries |
|
|||
741 | # and handle as above to clean up copy/rename handling. |
|
|||
742 |
|
||||
743 | # If the directory just had a prop change, |
|
721 | # If the directory just had a prop change, | |
744 | # then we shouldn't need to look for its children. |
|
722 | # then we shouldn't need to look for its children. | |
745 | if ent.action == 'M': |
|
723 | if ent.action == 'M': | |
746 | continue |
|
724 | continue | |
747 |
|
725 | |||
748 | # Also this could create duplicate entries. Not sure |
|
|||
749 | # whether this will matter. Maybe should make entries a set. |
|
|||
750 | # print "Changed directory", revnum, path, ent.action, \ |
|
|||
751 | # ent.copyfrom_path, ent.copyfrom_rev |
|
|||
752 | # This will fail if a directory was copied |
|
|||
753 | # from another branch and then some of its files |
|
|||
754 | # were deleted in the same transaction. |
|
|||
755 | children = sorted(self._find_children(path, revnum)) |
|
726 | children = sorted(self._find_children(path, revnum)) | |
756 | for child in children: |
|
727 | for child in children: | |
757 | # Can we move a child directory and its |
|
728 | # Can we move a child directory and its | |
@@ -759,15 +730,13 b' class svn_source(converter_source):' | |||||
759 | # cause problems if instead of revnum -1, |
|
730 | # cause problems if instead of revnum -1, | |
760 | # we have to look in (copyfrom_path, revnum - 1) |
|
731 | # we have to look in (copyfrom_path, revnum - 1) | |
761 | entrypath = self.getrelpath("/" + child) |
|
732 | entrypath = self.getrelpath("/" + child) | |
762 | # print child, self.module, entrypath |
|
|||
763 | if entrypath: |
|
733 | if entrypath: | |
764 | # Need to filter out directories here... |
|
734 | # Need to filter out directories here... | |
765 | kind = self._checkpath(entrypath, revnum) |
|
735 | kind = self._checkpath(entrypath, revnum) | |
766 | if kind != svn.core.svn_node_dir: |
|
736 | if kind != svn.core.svn_node_dir: | |
767 | entries.append(self.recode(entrypath)) |
|
737 | entries.append(self.recode(entrypath)) | |
768 |
|
738 | |||
769 | # Copies here (must copy all from source) Probably not |
|
739 | # Handle directory copies | |
770 | # a real problem for us if source does not exist |
|
|||
771 | if not ent.copyfrom_path or not parents: |
|
740 | if not ent.copyfrom_path or not parents: | |
772 | continue |
|
741 | continue | |
773 | # Copy sources not in parent revisions cannot be |
|
742 | # Copy sources not in parent revisions cannot be |
General Comments 0
You need to be logged in to leave comments.
Login now