Mercurial > hg-stable
comparison hgext/convert/subversion.py @ 6543:a6e2e60b34d0
convert: handle past or foreign partial svn copies
Subversion allows revisions to be composed of subparts coming from revisions
before the parent or from other part of the repository. There is no simple
representation for these now, keep the changes but do not track their origins.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 14 Apr 2008 22:31:34 +0200 |
parents | e7810e61f7c1 |
children | 3447c088a516 |
comparison
equal
deleted
inserted
replaced
6542:e7810e61f7c1 | 6543:a6e2e60b34d0 |
---|---|
673 entries.append(self.recode(entrypath)) | 673 entries.append(self.recode(entrypath)) |
674 | 674 |
675 # Copies here (must copy all from source) | 675 # Copies here (must copy all from source) |
676 # Probably not a real problem for us if | 676 # Probably not a real problem for us if |
677 # source does not exist | 677 # source does not exist |
678 if not ent.copyfrom_path: | 678 if not ent.copyfrom_path or not parents: |
679 continue | 679 continue |
680 copyfrompath = self.getrelpath(ent.copyfrom_path.decode(self.encoding)) | 680 # Copy sources not in parent revisions cannot be represented, |
681 # ignore their origin for now | |
682 pmodule, prevnum = self.revsplit(parents[0])[1:] | |
683 if ent.copyfrom_rev < prevnum: | |
684 continue | |
685 copyfrompath = ent.copyfrom_path.decode(self.encoding) | |
686 copyfrompath = self.getrelpath(copyfrompath, pmodule) | |
681 if not copyfrompath: | 687 if not copyfrompath: |
682 continue | 688 continue |
683 copyfrom[path] = ent | 689 copyfrom[path] = ent |
684 self.ui.debug("mark %s came from %s:%d\n" | 690 self.ui.debug("mark %s came from %s:%d\n" |
685 % (path, copyfrompath, ent.copyfrom_rev)) | 691 % (path, copyfrompath, ent.copyfrom_rev)) |
686 | |
687 # Good, /probably/ a regular copy. Really should check | |
688 # to see whether the parent revision actually contains | |
689 # the directory in question. | |
690 children = self._find_children(ent.copyfrom_path, ent.copyfrom_rev) | 692 children = self._find_children(ent.copyfrom_path, ent.copyfrom_rev) |
691 children.sort() | 693 children.sort() |
692 for child in children: | 694 for child in children: |
693 entrypath = self.getrelpath("/" + child) | 695 entrypath = self.getrelpath("/" + child, pmodule) |
694 if not entrypath: | 696 if not entrypath: |
695 continue | 697 continue |
696 entry = entrypath.decode(self.encoding) | 698 entry = entrypath.decode(self.encoding) |
697 copytopath = path + entry[len(copyfrompath):] | 699 copytopath = path + entry[len(copyfrompath):] |
698 copytopath = self.getrelpath(copytopath) | 700 copytopath = self.getrelpath(copytopath) |
699 copies[self.recode(copytopath)] = self.recode(entry) | 701 copies[self.recode(copytopath)] = self.recode(entry, pmodule) |
700 | 702 |
701 return (util.unique(entries), copies) | 703 return (util.unique(entries), copies) |
702 | 704 |
703 def _fetch_revisions(self, from_revnum, to_revnum): | 705 def _fetch_revisions(self, from_revnum, to_revnum): |
704 if from_revnum < to_revnum: | 706 if from_revnum < to_revnum: |