diff options
author | Germán Póo-Caamaño <gpoo@gnome.org> | 2011-06-22 19:15:59 -0700 |
---|---|---|
committer | Germán Póo-Caamaño <gpoo@gnome.org> | 2011-06-22 19:27:47 -0700 |
commit | 1a85acef6b98f27621e5f55e395c82691ed89693 (patch) | |
tree | 6287c3165105a237c2b38e6e8337ed7b5ef49156 | |
parent | 5964089840beaf313fff4189934ecc2dc714bdbd (diff) |
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 <gpoo@gnome.org>
-rwxr-xr-x | gitdm | 25 | ||||
-rw-r--r-- | patterns.py | 2 |
2 files changed, 27 insertions, 0 deletions
@@ -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]+)$"), } |