diff hgext/convert/subversion.py @ 19122:83973dc1bfe9

splicemap: improve error handling when source is subversion (issue2084) Implemented error handling on splicemap file when source is subversion (This checks are similar to when source is hg or git). The revision string is expected to be of svn:<uuid><path>@<number> format. the test case has been enhanced to check this format.
author Ben Goswami <bengoswami@fb.com>
date Thu, 25 Apr 2013 18:01:00 -0700
parents 942ecb55b1de
children 82c512643bed
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Thu Apr 25 16:02:58 2013 -0700
+++ b/hgext/convert/subversion.py	Thu Apr 25 18:01:00 2013 -0700
@@ -452,6 +452,14 @@
         del self.commits[rev]
         return commit
 
+    def checkrevformat(self, revstr):
+        """ fails if revision format does not match the correct format"""
+        if not re.match(r'svn:[0-9a-f]{8,8}-[0-9a-f]{4,4}-'
+                              '[0-9a-f]{4,4}-[0-9a-f]{4,4}-[0-9a-f]'
+                              '{12,12}(.*)\@[0-9]+$',revstr):
+            raise util.Abort(_('splicemap entry %s is not a valid revision'
+                               ' identifier') % revstr)
+
     def gettags(self):
         tags = {}
         if self.tags is None: