Created
August 23, 2010 12:36
-
-
Save tuxcanfly/545385 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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