Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Use the Bugzilla REST API #30

Closed
amccreight opened this issue Aug 15, 2014 · 15 comments
Closed

Use the Bugzilla REST API #30

amccreight opened this issue Aug 15, 2014 · 15 comments
Assignees

Comments

@amccreight
Copy link

No description provided.

@froydnj
Copy link

froydnj commented Apr 1, 2015

This seems a bit more important now that setting review flags via git bz attach is no longer working, see https://bugzilla.mozilla.org/show_bug.cgi?id=1150057

@froydnj
Copy link

froydnj commented Apr 1, 2015

Bugzilla's REST API looks like a more-or-less straightforward translation from what we were using for attachment.cgi; I'm going to try twiddling with that.

@amccreight
Copy link
Author

FWIW, I haven't had any problems recently with reviewer flags, but we do have at least one report from somebody (a while back) who had trouble with some reviewers.

I think the best approach here is to re-use hg bzexport, so we don't have to reimplement all of the bzapi stuff. We could probably turn git-bz-moz into a thin wrapper around the scripts there. I looked into that a little yesterday. The code lives at:
https://hg.mozilla.org/hgcustom/version-control-tools/file/819a2f07c285/hgext/bzexport

@globau
Copy link

globau commented Sep 8, 2015

bmo's api docs are at http://bmo.readthedocs.org/en/latest/api

@amccreight
Copy link
Author

I'll start taking a look at this today.

@amccreight
Copy link
Author

I have a prototype up at https://github.com/amccreight/git-bz-moz

I pulled in a lot of the bzexport bugzilla backend. I managed to attach a patch, but there's a lot of the other functionality that does not work still.

@Nephyrin
Copy link

Might be worth hooking up bzexport as a submodule such that it's easier to stay in sync rather than pulling in their files, unless we just want to use them as a base and fork them

@amccreight
Copy link
Author

The basic problem is that bzexport is in hg, not git. So I'd have to set up a git mirror or something.

@Nephyrin
Copy link

With the hg-git tool it's pretty easy to make a git mirror:
https://github.com/Nephyrin/bzexport

Here's a script to do this, which we could dump in this repo somewhere:

#!/bin/bash

set -e

### Setup a temp dir that is destroyed on exit

unset tmpdir
cleanup() { [[ -z $tmpdir ]] || rm -rf "$tmpdir"; }
trap cleanup EXIT

tmpdir="$(mktemp -d --tmpdir sync_bzexport_to_git.XXX)"
[[ -n $tmpdir ]] || exit 1

cd "$tmpdir"

### Do the thing

set -v

hg clone https://hg.mozilla.org/hgcustom/version-control-tools/
cd version-control-tools
hg bookmark -r tip master
# If this gives command not found, you need to install hg-git
hg gexport
cd .hg/git
git remote add github git@github.com:mozilla/bzexport.git
git push github master

The hg gexport command just exports the Hg repository to a git tree in .hg/git, and the bookmarks are turned into git branches.

I created a branch on my repo that pulls it in as a submodule:
https://github.com/Nephyrin/git-bz-moz/tree/bzexport

git submodule update --init should create/update any submodules

The downside to this approach is that you need to sync the GitHub mirror whenever you want to bump the submodule version, but that just requires having hg-git installed and running above mirror sync script

@Nephyrin
Copy link

@amccreight amccreight changed the title Use the actual bugzilla API instead of just submitting pages Use the Bugzilla REST API Sep 14, 2015
@amccreight
Copy link
Author

I've update my prototype. Most commands at least sort of work (git push and git edit do not). It also does not yet handle review flags for the Firefox component.

https://github.com/amccreight/git-bz-moz/tree/RestAPI

@amccreight
Copy link
Author

The readme contains basic instructions on dealing with the bugzilla API key.

@indygreg
Copy link

Please don't set up your own Git mirror of version-control-tools. This is something I can do using Mozilla's official vcs mirroring tools.

@indygreg
Copy link

https://github.com/mozilla/version-control-tools should have content soon. That repo is read-only. But if you send pull requests I'll look at them.

amccreight added a commit to amccreight/git-bz-moz that referenced this issue Sep 24, 2015
…erver.

This is enough to get |git bz apply| to work.

Fixes issue mozilla#30.
@amccreight amccreight self-assigned this Sep 24, 2015
@amccreight
Copy link
Author

I landed this a few months ago.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants