##// END OF EJS Templates
convert: fix svn branch source detection corner case...
Patrick Mezard -
r6545:a7492fb2 default
parent child Browse files
Show More
@@ -709,6 +709,13 b' class svn_source(converter_source):'
709 from_revnum, to_revnum = to_revnum, from_revnum
709 from_revnum, to_revnum = to_revnum, from_revnum
710
710
711 self.child_cset = None
711 self.child_cset = None
712
713 def isdescendantof(parent, child):
714 if not child or not parent or not child.startswith(parent):
715 return False
716 subpath = child[len(parent):]
717 return len(subpath) > 1 and subpath[0] == '/'
718
712 def parselogentry(orig_paths, revnum, author, date, message):
719 def parselogentry(orig_paths, revnum, author, date, message):
713 """Return the parsed commit object or None, and True if
720 """Return the parsed commit object or None, and True if
714 the revision is a branch root.
721 the revision is a branch root.
@@ -732,10 +739,21 b' class svn_source(converter_source):'
732 if root_paths:
739 if root_paths:
733 path, ent = root_paths[-1]
740 path, ent = root_paths[-1]
734 if ent.copyfrom_path:
741 if ent.copyfrom_path:
742 # If dir was moved while one of its file was removed
743 # the log may look like:
744 # A /dir (from /dir:x)
745 # A /dir/a (from /dir/a:y)
746 # A /dir/b (from /dir/b:z)
747 # ...
748 # for all remaining children.
749 # Let's take the highest child element from rev as source.
750 copies = [(p,e) for p,e in orig_paths[:-1]
751 if isdescendantof(ent.copyfrom_path, e.copyfrom_path)]
752 fromrev = max([e.copyfrom_rev for p,e in copies] + [ent.copyfrom_rev])
735 branched = True
753 branched = True
736 newpath = ent.copyfrom_path + self.module[len(path):]
754 newpath = ent.copyfrom_path + self.module[len(path):]
737 # ent.copyfrom_rev may not be the actual last revision
755 # ent.copyfrom_rev may not be the actual last revision
738 previd = self.latest(newpath, ent.copyfrom_rev)
756 previd = self.latest(newpath, fromrev)
739 if previd is not None:
757 if previd is not None:
740 prevmodule, prevnum = self.revsplit(previd)[1:]
758 prevmodule, prevnum = self.revsplit(previd)[1:]
741 if prevnum >= self.startrev:
759 if prevnum >= self.startrev:
@@ -117,8 +117,8 b' o branch=old3 11 branch trunk@1 into ol'
117 | | |
117 | | |
118 | o | branch= 3 change a files: a
118 | o | branch= 3 change a files: a
119 | | |
119 | | |
120 +---o branch=old 2 branch trunk, remove c files: a b
120 | | o branch=old 2 branch trunk, remove c files:
121 | |
121 | |/
122 | o branch= 1 hello files: a b c
122 | o branch= 1 hello files: a b c
123 |/
123 |/
124 o branch= 0 init projA files:
124 o branch= 0 init projA files:
General Comments 0
You need to be logged in to leave comments. Login now