convert: be even more tolerant when detecting svn tags
authorPatrick Mezard <pmezard@gmail.com>
Sat, 15 Nov 2008 15:51:26 +0100
changeset 7381 b965605dfb2e
parent 7242 d1dff8c492dd
child 7382 f5f6b7dcd217
convert: be even more tolerant when detecting svn tags Former code failed when tracking child directories we assumed were renamed with their parents but were really created in the tags directory. This happens in jQuery repository with /tags/ui/1.5b4/release@5455.
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Sun Oct 26 13:23:02 2008 +0100
+++ b/hgext/convert/subversion.py	Sat Nov 15 15:51:26 2008 +0100
@@ -46,6 +46,9 @@
 except ImportError:
     pass
 
+class SvnPathNotFound(Exception):
+    pass
+
 def geturl(path):
     try:
         return svn.client.url_from_path(svn.core.svn_path_canonicalize(path))
@@ -414,9 +417,15 @@
                         remainings.append([source, sourcerev, tagname])
                         continue
                     # From revision may be fake, get one with changes
-                    tagid = self.latest(source, sourcerev)
-                    if tagid:
-                        tags[tagname] = tagid
+                    try:
+                        tagid = self.latest(source, sourcerev)
+                        if tagid:
+                            tags[tagname] = tagid
+                    except SvnPathNotFound:
+                        # It happens when we are following directories we assumed
+                        # were copied with their parents but were really created
+                        # in the tag directory.
+                        pass
                 pendings = remainings
                 tagspath = srctagspath
 
@@ -474,7 +483,7 @@
         except SubversionException:
             dirent = None
         if not dirent:
-            raise util.Abort('%s not found up to revision %d' % (path, stop))
+            raise SvnPathNotFound(_('%s not found up to revision %d') % (path, stop))
 
         # stat() gives us the previous revision on this line of development, but
         # it might be in *another module*. Fetch the log and detect renames down
@@ -836,7 +845,7 @@
                         latest = self.latest(self.module, firstrevnum - 1)
                         if latest:
                             firstcset.parents.append(latest)
-                except util.Abort:
+                except SvnPathNotFound:
                     pass
         except SubversionException, (inst, num):
             if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION: