Closed Bug 1222508 Opened 9 years ago Closed 9 years ago

"ValueError: need more than 4 values to unpack" error trying to qimport a patch w/ Mercurial 3.6

Categories

(Developer Services :: Mercurial: qimportbz, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: RyanVM, Assigned: gps)

References

Details

Attachments

(3 files)

Seen while testing Mercurial 3.6 locally.

$ hg qimport bz://1210784 && hg qpush
Fetching... done
Parsing...** Unknown exception encountered with possibly-broken third-party extension qimportbz
** which supports versions unknown of Mercurial.
** Please disable qimportbz and try your action again.
** If that fixes the bug please report it to https://bugzilla.mozilla.org/enter_bug.cgi?product=Developer%20Services&component=Mercurial%3A%20qimportbz
** Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
** Mercurial Distributed SCM (version 3.6)
** Extensions loaded: blackbox, pager, purge, share, transplant, progress, color, rebase, histedit, strip, mq, qimportbz, push-to-try, bzexport, firefoxtree, hg qbackout
Traceback (most recent call last):
  File "c:/mozilla-build-test/python/Scripts/hg", line 43, in <module>
    mercurial.dispatch.run()
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\dispatch.py", line 54, in run
    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\dispatch.py", line 116, in dispatch
    ret = _runcatch(req)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\dispatch.py", line 187, in _runcatch
    return _dispatch(req)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\dispatch.py", line 920, in _dispatch
    cmdpats, cmdoptions)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\dispatch.py", line 679, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\extensions.py", line 183, in closure
    return func(*(args + a), **kw)
  File "c:\mozilla-build-test\python\Lib\site-packages\hgext\color.py", line 525, in colorcmd
    return orig(ui_, opts, cmd, cmdfunc)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\extensions.py", line 183, in closure
    return func(*(args + a), **kw)
  File "c:\mozilla-build-test\python\Lib\site-packages\hgext\pager.py", line 139, in pagecmd
    return orig(ui, options, cmd, cmdfunc)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\dispatch.py", line 1051, in _runcommand
    return checkargs()
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\dispatch.py", line 1011, in checkargs
    return cmdfunc()
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\dispatch.py", line 917, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\util.py", line 801, in check
    return func(*args, **kwargs)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\extensions.py", line 183, in closure
    return func(*(args + a), **kw)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\util.py", line 801, in check
    return func(*args, **kwargs)
  File "c:/Users/Ryan/.mozbuild/version-control-tools/hgext\qimportbz\__init__.py", line 156, in qimporthook
    ret = orig(ui, repo, *files, **opts)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\util.py", line 801, in check
    return func(*args, **kwargs)
  File "c:\mozilla-build-test\python\Lib\site-packages\hgext\mq.py", line 2323, in qimport
    rev=opts.get('rev'), git=opts.get('git'))
  File "c:\mozilla-build-test\python\Lib\site-packages\hgext\mq.py", line 2161, in qimport
    fp = hg.openpath(self.ui, filename)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\hg.py", line 140, in openpath
    return url.open(ui, path)
  File "c:\mozilla-build-test\python\Lib\site-packages\mercurial\url.py", line 513, in open
    return opener(ui, authinfo).open(url_, data)
  File "c:\mozilla-build-test\python\lib\urllib2.py", line 437, in open
    response = meth(req, response)
  File "c:/Users/Ryan/.mozbuild/version-control-tools/hgext\qimportbz\bzhandler.py", line 76, in bz_response
    bug = bz.Bug(self.ui, data)
  File "c:/Users/Ryan/.mozbuild/version-control-tools/hgext\qimportbz\bz.py", line 266, in __init__
    self.attachments = [Attachment.parse(self, a) for a in xml.findall("bug/attachment")]
  File "c:/Users/Ryan/.mozbuild/version-control-tools/hgext\qimportbz\bz.py", line 40, in parse
    return ctor(bug, node)
  File "c:/Users/Ryan/.mozbuild/version-control-tools/hgext\qimportbz\bz.py", line 97, in __init__
    patch.extract(bug.settings.ui, StringIO.StringIO(rawtext))
ValueError: need more than 4 values to unpack
Blech, this is broken in the same way with plain old |hg import| as well.
I'll fix this.
Assignee: nobody → gps
Status: NEW → ASSIGNED
qimportbz: add test; r=dminor

We didn't have test coverage of qimportbz. Add a basic smoke test.

The test currently fails because of wonkiness with bug parsing, it
appears. This will be fixed in a subsequent commit.
Attachment #8685038 - Flags: review?(dminor)
qimportbz: support URLs in qimportbz.bugzilla config option; r=dminor

Before, the code assumed https://. This didn't work in the test
environment because we run the test server over http://.

We refactor the config option logic to support specifying the Bugzilla as a
URL.

Our simple smoke test now passes with this change.
Attachment #8685039 - Flags: review?(dminor)
qimportbz: accept dict return from patch.extract() (bug 1222508); r=dminor

Mercurial 3.6 changed patch.extract() to return a dict instead of a
tuple. Support the new return value.
Attachment #8685040 - Flags: review?(dminor)
Attachment #8685038 - Flags: review?(dminor) → review+
Comment on attachment 8685038 [details]
MozReview Request: qimportbz: add test; r=dminor

https://reviewboard.mozilla.org/r/24705/#review22241
Attachment #8685039 - Flags: review?(dminor) → review+
Comment on attachment 8685039 [details]
MozReview Request: qimportbz: support URLs in qimportbz.bugzilla config option; r=dminor

https://reviewboard.mozilla.org/r/24707/#review22243
Attachment #8685040 - Flags: review?(dminor) → review+
Comment on attachment 8685040 [details]
MozReview Request: qimportbz: accept dict return from patch.extract() (bug 1222508); r=dminor

https://reviewboard.mozilla.org/r/24709/#review22245
Pushed with autoland \o/
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: