Skip to content

Instantly share code, notes, and snippets.

@tuxcanfly
Created August 23, 2010 12:36
Show Gist options
  • Save tuxcanfly/545385 to your computer and use it in GitHub Desktop.
Save tuxcanfly/545385 to your computer and use it in GitHub Desktop.
from __future__ import with_statement
import os
filename = "gh2bb.txt"
mapping = {}
with open(filename) as f:
lines = f.readlines()
for line in lines:
gh, bb = line.split(',')
mapping[gh] = bb
for gh, bb in mapping.iteritems():
# hg clone
clone_cmd = "hg clone git+ssh://%s" %gh
print "cloning %s" %gh
os.system(clone_cmd)
# find created dir
created_dir = gh.split('/').pop()[:-4]
print "going into %s" %created_dir
os.chdir(created_dir)
# pull from github
pull_cmd = "hg pull"
os.system(pull_cmd)
# push to bitbucket
push_cmd = "hg push %s" %bb
os.system(push_cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment