parser.error('You must specify at least one source repo type. (--repo-types)') if not options.repo_names: parser.error('You must specify at least one source repo name. (--repo-names)') options.revmap_files = options.revmap_files.split(',') options.repo_names = options.repo_names.split(',') options.repo_types = options.repo_types.split(',') assert len(options.repo_names) == len(options.repo_types) assert len(options.repo_names) == len(options.revmap_files) repo_list = [] for i, name in enumerate(options.repo_names): repo_list.append(Repository(name, options.repo_types[i], options.revmap_files[i])) trac = Trac(trac_db_path) if options.json: from github_json import GitHubJson github = GitHubJson(github_repo, dry_run=options.dry_run) else: github_password = getpass('Password for user {0}: '.format(github_username)) github = GitHub(github_username, github_password, github_repo, dry_run=options.dry_run) # default to no mapping author_mapping = AuthorMapping(options.authors_file) rev_mapping = RevisionMapping(repo_list) # Show the Trac usernames assigned to tickets as an FYI #logging.info("Getting Trac ticket owners (will NOT be mapped to GitHub username)...") #for (username,) in trac.sql('SELECT DISTINCT owner FROM ticket'): # if username: # username = username.split(',')[0].strip() # username returned is tuple like: ('phred',)
try: [trac_db_path, github_username, github_password, github_repo] = args except ValueError: parser.error('Wrong number of arguments') if not '/' in github_repo: parser.error('Repo must be specified like "organization/project"') if options.quiet: logging.basicConfig(level=logging.INFO) else: logging.basicConfig(level=logging.DEBUG) trac = Trac(trac_db_path) if options.json: from github_json import GitHubJson github = GitHubJson(github_repo) else: github = GitHub(github_username, github_password, github_repo) # default to no mapping author_mapping = AuthorMapping(options.authors_file) epoch_to_iso = lambda x: datetime.datetime.fromtimestamp(x).isoformat() svn_to_git_mapper = lambda match: svn_to_git_commit_id(options.checkout, match.group(1)) # Show the Trac usernames assigned to tickets as an FYI #logging.info("Getting Trac ticket owners (will NOT be mapped to GitHub username)...") #for (username,) in trac.sql('SELECT DISTINCT owner FROM ticket'): # if username: