Commit 0507d31f authored by Claude Paroz's avatar Claude Paroz

Removed obsolete migrate-to-git command

parent 7a86a85b
import shutil
from import BaseCommand
from stats.models import Module, Branch
from common.utils import run_shell_command
class Command(BaseCommand):
def handle(self, *args, **options):
""" Migrate GNOME SVN modules to git repos in bulk """
if len(args) == 1:
modules = [Module.objects.get(name = args[0])]
modules = Module.objects.filter(vcs_root='')
for module in modules:
old_branch_dirs = []
for branch in module.branch_set.all():
module.vcs_type = "git"
module.vcs_root = "git://" %
module.vcs_web = "" %
# Checkout new git repo with master branch
head_branch = Branch.objects.get(, name='HEAD') = "master"
try: # Save will do a checkout
except Exception, e:
self.stderr.write("Unable to save master branch for module '%s': %s" % (, e))
for branch in module.branch_set.exclude(name='master'):
# Checkout branch (other than master)
cmd = ['git', 'checkout', '--track', '-b',, 'origin/%s' %]
run_shell_command(cmd, raise_on_error=True, cwd=branch.co_path)
except Exception, e:
self.stderr.write("Unable to checkout branch '%s' of module '%s': %s" % (,, e))
# delete old checkouts
for branch_dir in old_branch_dirs:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment