# HG changeset patch # User Jeff Hammel # Date 1379896664 25200 # Node ID baecb5a6f05b1a035179e1591072dec98e19a39f # Parent a5b7ea791f643bd4fe82efaba0f76d5e52fe6725 some more thangs diff -r a5b7ea791f64 -r baecb5a6f05b bzconsole/api.py --- a/bzconsole/api.py Thu Sep 19 13:04:03 2013 -0700 +++ b/bzconsole/api.py Sun Sep 22 17:37:44 2013 -0700 @@ -132,7 +132,7 @@ def new(self, component, title, product=None, version=None, description=None, whiteboard=(), cc=(), - blocks=(), depends_on=()): + blocks=(), depends_on=(), see_also=()): """file a new bug. username and password must be set""" # sanity check @@ -185,7 +185,15 @@ depends_on = [int(i) for i in depends_on] request['depends_on'] = depends_on + if see_also: + if isinstance(see_also, string): + see_also = [see_also] + request['see_also'] = list(see_also) + # get the bug description + if os.path.exists(description): + description = file(description).read() + description = tmpbuffer(contents=description) if not description: description = tmpbuffer() assert description, "Must provide a non-empty description" diff -r a5b7ea791f64 -r baecb5a6f05b bzconsole/main.py --- a/bzconsole/main.py Thu Sep 19 13:04:03 2013 -0700 +++ b/bzconsole/main.py Sun Sep 22 17:37:44 2013 -0700 @@ -8,6 +8,10 @@ class BZcli(BZapi): """command line interface front-end for the API class""" + def file(self, component, title, path, **kwargs): + """read from a file [NOTIMPLEMENTED]""" + raise NotImplementedError + def unique(self, component=None): """display unique and duplicated components""" unique, dupe = self._unique_components() diff -r a5b7ea791f64 -r baecb5a6f05b bzconsole/utils.py --- a/bzconsole/utils.py Thu Sep 19 13:04:03 2013 -0700 +++ b/bzconsole/utils.py Sun Sep 22 17:37:44 2013 -0700 @@ -2,11 +2,15 @@ import subprocess import tempfile -def tmpbuffer(editor=None): +def tmpbuffer(editor=None, contents=None): """open an editor and retreive the resulting editted buffer""" if not editor: editor = os.environ['EDITOR'] - tmpfile = tempfile.mktemp(suffix='.txt') + assert editor + fd, tmpfile = tempfile.mkstemp(suffix='.txt') + if contents: + os.write(fd, contents) + os.close(fd) cmdline = editor.split() cmdline.append(tmpfile) edit = subprocess.call(cmdline)