Commits

Anonymous committed 93b7a6e

Fixed bugs

  • Participants
  • Parent commits 8c70952
  • Tags 0.1

Comments (0)

Files changed (5)

+Revision 0 	 2010-12-07 	 Base version 

File bitbucket2github/bitbucket.py

     """ Creates a public repository with the given credentials """
 
     if not repo_exists(reponame, username):
+        print "Creating " + reponame + " in BitBucket"
         # Somehow BitBucket authentication with urllib2 is not working. So using this ugly approach.
         cmd = 'curl -d "name={reponame}" -u {username}:{password} {base_url}/repositories/'
         cmd = cmd.format(reponame=reponame,

File bitbucket2github/bitbucket2github.py

 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}'
+github_url = 'git+ssh://git@github.com/{0}/{1}.git'
 tmp_dir = tempfile.gettempdir()
 
 
 def backup(repo):
+    print "Syncing " + repo + " from BitBucket to GitHub"
     github.create_repo(repo, github_username, github_api_token)
 
     bitbucket_repo = bitbucket_url.format(bitbucket_username, repo)
     else:
         sh('hg clone {0} {1}'.format(bitbucket_repo, local_repo))
 
-    sh('hg bookmark master -f -R {1}'.format(local_repo))
-    sh('hg push {0} -R {1}'.format(github_url, local_repo))
+    sh('hg bookmark master -f -R {0}'.format(local_repo))
+    sh('hg push {0} -R {1}'.format(github_repo, local_repo))
 
 
 def main():
-    for repo in bitbucket.repos():
+    for repo in bitbucket.repos(bitbucket_username):
         backup(repo)
 
 

File bitbucket2github/github.py

     github = Github(username=username, api_token=api_token)
 
     if not repo_exists(reponame, username):
+        print "Creating " + reponame + " in GitHub"
         github.repos.create(reponame)

File bitbucket2github/github2bitbucket.py

 bitbucket_password = vault.get('bitbucket.org', bitbucket_username)
 
 bitbucket_url = 'ssh://hg@bitbucket.org/{0}/{1}'
-github_url = 'git+ssh://git@github.com/{0}/{1}'
+github_url = 'git+ssh://git@github.com/{0}/{1}.git'
 tmp_dir = tempfile.gettempdir()
 
 
 def backup(repo):
-    bitbucket.create_repo(repo, github_username, github_api_token)
+    print "Syncing " + repo + " from GitHub to BitBucket"
+    bitbucket.create_repo(repo, bitbucket_username, bitbucket_password)
 
     bitbucket_repo = bitbucket_url.format(bitbucket_username, repo)
     github_repo = github_url.format(github_username, repo)
     else:
         sh('hg clone {0} {1}'.format(github_repo, local_repo))
 
-    sh('hg bookmark master -f -R {1}'.format(local_repo))
+    sh('hg bookmark master -f -R {0}'.format(local_repo))
     sh('hg push {0} -R {1}'.format(bitbucket_repo, local_repo))
 
 
 def main():
-    for repo in github.repos():
+    for repo in github.repos(github_username):
         backup(repo)