##// END OF EJS Templates
convert/svn: refactor svn_source.latest() with a nested function...
Patrick Mezard -
r16465:ad38b96c stable
parent child Browse files
Show More
@@ -563,6 +563,27 b' class svn_source(converter_source):'
563 reported. Return None if computed module does not belong to
563 reported. Return None if computed module does not belong to
564 rootmodule subtree.
564 rootmodule subtree.
565 """
565 """
566 def findchanges(path, start, stop):
567 stream = self._getlog([path], start, stop)
568 try:
569 for entry in stream:
570 paths, revnum, author, date, message = entry
571 if revnum <= stop:
572 break
573
574 for p in paths:
575 if (not path.startswith(p) or
576 not paths[p].copyfrom_path):
577 continue
578 newpath = paths[p].copyfrom_path + path[len(p):]
579 self.ui.debug("branch renamed from %s to %s at %d\n" %
580 (path, newpath, revnum))
581 path = newpath
582 break
583 return revnum, path
584 finally:
585 stream.close()
586
566 if not path.startswith(self.rootmodule):
587 if not path.startswith(self.rootmodule):
567 # Requests on foreign branches may be forbidden at server level
588 # Requests on foreign branches may be forbidden at server level
568 self.ui.debug('ignoring foreign branch %r\n' % path)
589 self.ui.debug('ignoring foreign branch %r\n' % path)
@@ -583,28 +604,11 b' class svn_source(converter_source):'
583 # stat() gives us the previous revision on this line of
604 # stat() gives us the previous revision on this line of
584 # development, but it might be in *another module*. Fetch the
605 # development, but it might be in *another module*. Fetch the
585 # log and detect renames down to the latest revision.
606 # log and detect renames down to the latest revision.
586 stream = self._getlog([path], stop, dirent.created_rev)
607 revnum, realpath = findchanges(path, stop, dirent.created_rev)
587 try:
608 if not realpath.startswith(self.rootmodule):
588 for entry in stream:
609 self.ui.debug('ignoring foreign branch %r\n' % realpath)
589 paths, revnum, author, date, message = entry
590 if revnum <= dirent.created_rev:
591 break
592
593 for p in paths:
594 if not path.startswith(p) or not paths[p].copyfrom_path:
595 continue
596 newpath = paths[p].copyfrom_path + path[len(p):]
597 self.ui.debug("branch renamed from %s to %s at %d\n" %
598 (path, newpath, revnum))
599 path = newpath
600 break
601 finally:
602 stream.close()
603
604 if not path.startswith(self.rootmodule):
605 self.ui.debug('ignoring foreign branch %r\n' % path)
606 return None
610 return None
607 return self.revid(dirent.created_rev, path)
611 return self.revid(revnum, realpath)
608
612
609 def reparent(self, module):
613 def reparent(self, module):
610 """Reparent the svn transport and return the previous parent."""
614 """Reparent the svn transport and return the previous parent."""
General Comments 0
You need to be logged in to leave comments. Login now