comparison bzgit.py @ 6:7138a453ecf7

WIP
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 17 Dec 2012 12:24:54 -0800
parents 6c1ca906ffa4
children b951b70aa952
comparison
equal deleted inserted replaced
5:6c1ca906ffa4 6:7138a453ecf7
8 import bzconsole 8 import bzconsole
9 import optparse 9 import optparse
10 import sys 10 import sys
11 import urlparse 11 import urlparse
12 from pygithub3 import Github 12 from pygithub3 import Github
13 from bzconsole.command import read_dotfile # XXX to be moved
13 14
14 def path_segments(path): 15 def path_segments(path):
15 """return path segments""" 16 """return path segments"""
16 segments = path.strip('/').split('/') 17 segments = path.strip('/').split('/')
17 if segments == ['']: 18 if segments == ['']:
54 pull_request = int(segments[3]) 55 pull_request = int(segments[3])
55 56
56 # connect to gh 57 # connect to gh
57 gh = Github() # TODO: auth 58 gh = Github() # TODO: auth
58 pull = gh.pull_requests.get(pull_request, github_user, github_project) 59 pull = gh.pull_requests.get(pull_request, github_user, github_project)
60 title = pull.title
61 diff = pull.diff_url
59 62
60 # move all the things 63 # move all the things
61 bz = bzconsole.BZapi() 64 bz_options = read_dotfile()
62 # new = bz.new() 65 assert set(['username', 'password']).issubset(bz_options)
63 # 66 bz = bzconsole.BZapi(**bz_options)
67
68 description = """From %s:
69
70 %s
71 """ % (resource, title)
72
73 # TODO: add CC of github user if possible
74 cc = [':wlach']
75 new = bz.new('Mozbase', title=title, description=description, cc=cc)
76 bug = int(new.strip().rsplit('/')[-1])
77 import pdb; pdb.set_trace()
78 # attachment = bz.attach(bug, diff, reviewer=':wlach')
64 79
65 # comment on pull request wrt bugzilla.m.o issue location 80 # comment on pull request wrt bugzilla.m.o issue location
66 # TODO 81 # TODO
67 82
68 # close pull request 83 # close pull request