1. Mark Roddy
  2. bitbucket2github

Commits

Mark Roddy  committed 317502a Draft

perform user input operations at run time rather than import time

  • Participants
  • Parent commits 0ccce03
  • Branches default

Comments (0)

Files changed (1)

File bitbucket2github/bitbucket2github.py

View file
  • Ignore whitespace
 from scriptine.shell import sh
 import bitbucket, github
 
-bitbucket_username = vault.get('bitbucket.org', 'username')
-github_username = vault.get('github.com', 'username')
-github_api_token = vault.get('github.com', github_username)
-
 bitbucket_url = 'http://bitbucket.org/{0}/{1}'
 github_url = 'git+ssh://git@github.com/{0}/{1}.git'
 tmp_dir = tempfile.gettempdir()
 
-
-def backup(repo):
+def backup(repo, bitbucket_username, github_username, github_api_token):
     print "Syncing %s from BitBucket to GitHub" % repo['name']
     github.create_repo(repo, github_username, github_api_token)
 
     sh('hg bookmark master -f -R {0}'.format(local_repo))
     sh('hg push {0} -R {1}'.format(github_repo, local_repo))
 
+def main():
+    bitbucket_username = vault.get('bitbucket.org', 'username')
+    github_username = vault.get('github.com', 'username')
+    github_api_token = vault.get('github.com', github_username)
+    
 
-def main():
     for repo in bitbucket.repos(bitbucket_username):
-        backup(repo)
+        backup(repo, bitbucket_username, github_username, github_api_token)
 
 
 if __name__ == '__main__':