Closed Bug 1104906 Opened 10 years ago Closed 10 years ago

exception when trying to use bzexport to attach a patch

Categories

(Developer Services :: Mercurial: bzexport, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1105122

People

(Reporter: jfkthame, Unassigned)

References

Details

Attempting to bzexport a patch, I'm getting an exception:

** Unknown exception encountered with possibly-broken third-party extension bzexport
** which supports versions unknown of Mercurial.
** Please disable bzexport and try your action again.
** If that fixes the bug please report it to the extension author.
** Python 2.7.8 (default, Jul 13 2014, 02:30:56) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]
** Mercurial Distributed SCM (version 3.1)
** Extensions loaded: strip, mq, transplant, graphlog, bzexport, children, color, progress, rebase, histedit, reviewboard, bzpost, firefoxtree, mqext, qimportbz
Traceback (most recent call last):
  File "/opt/local/bin/hg", line 43, in <module>
    mercurial.dispatch.run()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 28, in run
    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 69, in dispatch
    ret = _runcatch(req)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 138, in _runcatch
    return _dispatch(req)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 820, in _dispatch
    cmdpats, cmdoptions)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 600, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/extensions.py", line 196, in wrap
    return wrapper(origfn, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/hgext/color.py", line 433, in colorcmd
    return orig(ui_, opts, cmd, cmdfunc)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 911, in _runcommand
    return checkargs()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 882, in checkargs
    return cmdfunc()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 817, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/util.py", line 550, in check
    return func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/extensions.py", line 151, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/util.py", line 550, in check
    return func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/hgext/mq.py", line 3393, in mqcommand
    return orig(ui, repo, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/util.py", line 550, in check
    return func(*args, **kwargs)
  File "/Users/jkew/.mozbuild/version-control-tools/hgext/bzexport/__init__.py", line 1040, in bzexport
    "attachment.cgi?id=" + result["id"] + "&action=edit")
KeyError: 'id'

I was able to use bzexport successfully earlier today, IIRC, and had not changed anything locally, so I wonder if something changed at the b.m.o API end? Since encountering this, I tried updating my tools with ./mach bootstrap and ./mach mercurial-setup, but I'm still hitting the same failure.
This looks pretty similar to bug 1058679.
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #1)
> This looks pretty similar to bug 1058679.

So it does. (Not quite the same, though, as I was trying to attach a patch to an existing bug, rather than using bzexport --new to file a new bug.)
We did make a change this after to switch the api-dev.bugzilla.mozilla.org server to auto-redirect to the BzAPI extension on bugzilla.mozilla.org directly (bug 1098342)

I thought bzexport was already using the BzAPI endpoint on bugzilla.mozilla.org so the redirect should not have affected you. 

What is the URL that bzexport is configured to access?
Also can you link me the code in bzexport that is used to add an attachment to an existing bug?

The return data should look similar to:

{
  "ref":"https://bugzilla.mozilla.org/bzapi/attachment/1234",
  "id":1234
}

dkl
Status: NEW → ASSIGNED
Flags: needinfo?(jfkthame)
QA Contact: dkl
(In reply to David Lawrence [:dkl] from comment #3)

> What is the URL that bzexport is configured to access?
> Also can you link me the code in bzexport that is used to add an attachment
> to an existing bug?

I'm not really sure where to find these things..... but from poking around a bit, it looks like bzexport is configured by default to use https://api-dev.bugzilla.mozilla.org/latest/:

https://hg.mozilla.org/hgcustom/version-control-tools/annotate/cce5fef89c64/hgext/bzexport/__init__.py#l365

It looks like bzexport calls a function create_attachment() at:

https://hg.mozilla.org/hgcustom/version-control-tools/annotate/cce5fef89c64/hgext/bzexport/__init__.py#l1033

and this is returning something that doesn't have the expected "id".

The create_attachment() function is found at:

https://hg.mozilla.org/hgcustom/version-control-tools/annotate/cce5fef89c64/hgext/bzexport/__init__.py#l740

and calls bz.create_attachment(), which is at:

https://hg.mozilla.org/hgcustom/version-control-tools/annotate/cce5fef89c64/hgext/bzexport/bz.py#l61
Flags: needinfo?(jfkthame)
Depends on: 1105141
Blocks: 1098342
This looks the same as bug 1105122. Forward duping since that one has more discussion.

(In reply to David Lawrence [:dkl] from comment #3)
> I thought bzexport was already using the BzAPI endpoint on
> bugzilla.mozilla.org so the redirect should not have affected you. 

Bug 1033394 was for the switch, which was reverted once and not relanded.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
QA Contact: dkl
Resolution: --- → DUPLICATE
No longer blocks: 1098342
You need to log in before you can comment on or make changes to this bug.