in cli.py [0:0]
def sync(args):
if not args.gh_url or not args.jira_url:
fail("Both GitHub and JIRA URL have to be specified!")
if not args.gh_token:
fail("No GitHub credentials specified!")
if not args.jira_user or not args.jira_token:
fail("No JIRA credentials specified!")
if not args.jira_project:
fail("No JIRA project specified!")
if not args.gh_org:
fail("No GitHub organization specified!")
if not args.gh_repo:
fail("No GitHub repository specified!")
github = ghlib.GitHub(args.gh_url, args.gh_token)
jira = jiralib.Jira(args.jira_url, args.jira_user, args.jira_token)
jira_project = jira.getProject(
args.jira_project,
args.issue_end_state,
args.issue_reopen_state,
args.jira_labels,
)
repo_id = args.gh_org + "/" + args.gh_repo
if args.state_file:
if args.state_issue:
fail("--state-file and --state-issue are mutually exclusive!")
state = util.state_from_file(args.state_file)
elif args.state_issue:
state = jira_project.fetch_repo_state(repo_id, args.state_issue)
else:
state = {}
s = Sync(github, jira_project, direction=direction_str_to_num(args.direction))
s.sync_repo(repo_id, states=state)
if args.state_file:
util.state_to_file(args.state_file, state)
elif args.state_issue:
jira_project.save_repo_state(repo_id, state, args.state_issue)