From: Germán Póo-Caamaño Date: Thu, 23 Jun 2011 02:15:59 +0000 (-0700) Subject: Added workaround for svn tags imported wrongly X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1a85acef6b98f27621e5f55e395c82691ed89693;p=people%2Flarsk%2Fxenproject-org-gitdm.git Added workaround for svn tags imported wrongly When some projects have migrated from Subversion to Git, there were several tags that were treated as new commits, which shows a change in the whole project (code added/removed) when nothing really happened. For instance, in GNOME a lot svn tags were catched during the migration, but not all of them. svn tags in git repositories brings bad stats because double count commits, and in project with a lot history it may may involve several thousands of source of lines of code. Signed-off-by: Germán Póo-Caamaño --- diff --git a/gitdm b/gitdm index fe5473c..28df314 100755 --- a/gitdm +++ b/gitdm @@ -341,6 +341,22 @@ def ApplyFileFilter (line, ignore): return 0 return ignore +def is_svntag(logpatch): + """ + This is a workaround for a bug on the migration to Git + from Subversion found in GNOME. It may happen in other + repositories as well. + """ + + for Line in logpatch: + m = patterns['svn-tag'].match(Line.strip()) + if m: + sys.stderr.write ('(W) detected a commit on a svn tag: %s\n' % + (m.group (0),)) + return True + + return False + # # If this patch is signed off by both Andrew Morton and Linus Torvalds, # remove the (redundant) Linus signoff. @@ -384,6 +400,15 @@ for logpatch in patches: if (printcount % 50) == 0: print >> sys.stderr, 'Grabbing changesets...%d\r' % printcount, printcount += 1 + + # We want to ignore commits on svn tags since in Subversion + # thats mean a copy of the whole repository, which leads to + # wrong results. Some migrations from Subversion to Git does + # not catch all this tags/copy and import them just as a new + # big changeset. + if is_svntag(logpatch): + continue + p = grabpatch(logpatch) if not p: break diff --git a/patterns.py b/patterns.py index b679049..803e532 100644 --- a/patterns.py +++ b/patterns.py @@ -46,4 +46,6 @@ patterns = { # It implies --numstat 'numstat': re.compile('^(\d+|-)\s+(\d+|-)\s+(.*)$'), 'rename' : re.compile('(.*)\{(.*) => (.*)\}(.*)'), + # Detect errors on svn conversions + 'svn-tag': re.compile("^svn path=/tags/(.*)/?; revision=([0-9]+)$"), }