changeset 6:7138a453ecf7

WIP
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 17 Dec 2012 12:24:54 -0800
parents 6c1ca906ffa4
children b951b70aa952
files bzgit.py
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bzgit.py	Mon Dec 17 11:32:47 2012 -0800
+++ b/bzgit.py	Mon Dec 17 12:24:54 2012 -0800
@@ -10,6 +10,7 @@
 import sys
 import urlparse
 from pygithub3 import Github
+from bzconsole.command import read_dotfile # XXX to be moved
 
 def path_segments(path):
     """return path segments"""
@@ -56,11 +57,25 @@
     # connect to gh
     gh = Github() # TODO: auth
     pull = gh.pull_requests.get(pull_request, github_user, github_project)
+    title = pull.title
+    diff = pull.diff_url
 
     # move all the things
-    bz = bzconsole.BZapi()
-#    new = bz.new()
-#
+    bz_options = read_dotfile()
+    assert set(['username', 'password']).issubset(bz_options)
+    bz = bzconsole.BZapi(**bz_options)
+
+    description = """From %s:
+
+%s
+""" % (resource, title)
+
+    # TODO: add CC of github user if possible
+    cc = [':wlach']
+    new = bz.new('Mozbase', title=title, description=description, cc=cc)
+    bug = int(new.strip().rsplit('/')[-1])
+    import pdb; pdb.set_trace()
+# attachment = bz.attach(bug, diff, reviewer=':wlach')
 
     # comment on pull request wrt bugzilla.m.o issue location
     # TODO