Skip to content
Browse files

Accept project names in the form owner/project.

The script can now migrate to a project owned by a different user or
organization than the one for which credentials are provided.
  • Loading branch information...
1 parent 956fbce commit 50fea56edeb511f537c8ce9a12ce949caec94b9b @dnschnur dnschnur committed
Showing with 14 additions and 1 deletion.
  1. +14 −1 migrateissues.py
View
15 migrateissues.py
@@ -300,7 +300,20 @@ def get_existing_github_issues():
google = gdata.projecthosting.client.ProjectHostingClient()
github = Github(github_user_name, github_password)
github_user = github.get_user()
- github_repo = github_user.get_repo(github_project)
+
+ # If the project name is specified as owner/project, assume that it's owned by either
+ # a different user than the one we have credentials for, or an organization.
+
+ if "/" in github_project:
+ owner_name, github_project = github_project.split("/")
+ try: github_owner = github.get_user(owner_name)
+ except GithubException:
+ try: github_owner = github.get_organization(owner_name)
+ except GithubException:
+ github_owner = github_user
+ else: github_owner = github_user
+
+ github_repo = github_owner.get_repo(github_project)
try:
existing_issues = get_existing_github_issues()

0 comments on commit 50fea56

Please sign in to comment.
Something went wrong with that request. Please try again.