Closed Bug 1463195 Opened 7 years ago Closed 7 years ago

bzexport fails with mercurial 4.6

Categories

(Developer Services :: Mercurial: bzexport, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jfkthame, Assigned: sheehan)

References

Details

(Keywords: in-triage)

Attachments

(5 files)

With mercurial 4.6 and up-to-date https://hg.mozilla.org/hgcustom/version-control-tools, bzexport fails: $ hg bzexport ** Unknown exception encountered with possibly-broken third-party extension bzexport ** which supports versions 4.2 of Mercurial. ** Please disable bzexport 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%20bzexport ** Python 2.7.15 (default, May 1 2018, 16:44:08) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] ** Mercurial Distributed SCM (version 4.6) ** Extensions loaded: strip, mq, transplant, graphlog, histedit, rebase, evolve, fsmonitor, blackbox, firefoxtree, bzexport, push-to-try Traceback (most recent call last): File "/usr/local/bin/hg", line 41, in <module> dispatch.run() File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/dispatch.py", line 90, in run status = (dispatch(req) or 0) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/dispatch.py", line 210, in dispatch ret = _runcatch(req) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/dispatch.py", line 351, in _runcatch return _callcatch(ui, _runcatchfunc) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/dispatch.py", line 359, in _callcatch return scmutil.callcatch(ui, func) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/scmutil.py", line 160, in callcatch return func() File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/dispatch.py", line 341, in _runcatchfunc return _dispatch(req) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/dispatch.py", line 971, in _dispatch cmdpats, cmdoptions) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/dispatch.py", line 727, in runcommand ret = _runcommand(ui, options, cmd, d) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/dispatch.py", line 979, in _runcommand return cmdfunc() File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/dispatch.py", line 968, in <lambda> d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/util.py", line 1553, in check return func(*args, **kwargs) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/util.py", line 1553, in check return func(*args, **kwargs) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/hgext/mq.py", line 3599, in mqcommand return orig(ui, repo, *args, **kwargs) File "/usr/local/Cellar/mercurial/4.6/lib/python2.7/site-packages/mercurial/util.py", line 1553, in check return func(*args, **kwargs) File "/Users/jkew/.mozbuild/version-control-tools/hgext/bzexport/__init__.py", line 1022, in bzexport cmdutil.export(repo, [ctx.hex()], fp=contents, opts=diffopts) TypeError: export() got an unexpected keyword argument 'fp'
Blocks: hg46
Keywords: in-triage
BTW, note that mach bootstrap (at least on macOS) now installs mercurial 4.6, and therefore results in a broken bzexport. I had to manually downgrade mercurial to get a working bzexport back.
Assignee: nobody → sheehan
Status: NEW → ASSIGNED
Mercurial 4.6 has removed the keyword argument `fp` from the cmdutil.export command and replaced it with a cmdutil.exportfile command. We try and use the old command and swap to the new version if that fails.
This removes the devel-warn messages from tests
bzexport uses mozhg, which hasn't been updated to use the new APIs.
This commits wraps uses of deprecated APIs in try/except blocks. Tests are almost back to passing, with the exception of a failure in all tests with shutting down the docker container for BMO and an intermittent in test-basechange.t
Comment on attachment 8980027 [details] mozhg: use error.Abort instead of util.Abort (Bug 1463195) r?gps Gregory Szorc [:gps] has approved the revision. https://phabricator.services.mozilla.com/D1364
Attachment #8980027 - Flags: review+
Comment on attachment 8980029 [details] bzexport: update supported versions (Bug 1463195) r?gps Gregory Szorc [:gps] has approved the revision. https://phabricator.services.mozilla.com/D1366
Attachment #8980029 - Flags: review+
Comment on attachment 8980025 [details] bzexport: change cmdutil.export to cmdutil.exportfile (Bug 1463195) r?gps Gregory Szorc [:gps] has approved the revision. https://phabricator.services.mozilla.com/D1362
Attachment #8980025 - Flags: review+
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/888c1be64816 bzexport: change cmdutil.export to cmdutil.exportfile r=gps
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Comment on attachment 8980026 [details] bzexport: register config items (Bug 1463195) r?gps Gregory Szorc [:gps] has approved the revision. https://phabricator.services.mozilla.com/D1363
Attachment #8980026 - Flags: review+
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/a47dc2bafeea mozhg: use error.Abort instead of util.Abort r=gps
Comment on attachment 8980028 [details] bzexport: fix use of deprecated APIs (Bug 1463195) r?gps Gregory Szorc [:gps] has approved the revision. https://phabricator.services.mozilla.com/D1365
Attachment #8980028 - Flags: review+
I now get the following error on Windows when running just about any mercurial command: > *** failed to import extension bzexport from c:\Users\Brian\.mozbuild\version-control-tools\hgext\bzexport: No module named mozhg.util Running ./mach bootstrap doesn't seem to help. (And I had to install VC for Python just to get that to even work since otherwise it couldn't update Mercurial. But that's another bug I guess.)
Flags: needinfo?(sheehan)
And now I got spammed 5 emails from Phabricator just because I replied to this bug.
I'm starting to suspect that upgrading MozillaBuild just messed up Python somehow.
Are you using the latest changeset from version-control-tools? We introduced a Windows-only issue earlier this week and fixed it a few hours ago in bug 1467428.
Yes, I just ran ./mach bootstrap and then pulled it manually to be sure. I notice when I run `hg qref` a bunch of the other extensions are broken (qimportbz, qbackout, mqext, push-to-try etc.). Either a lot of extensions are broken on Windows or my setup is broken. I'm starting to suspect the latter although I haven't made any changes to it recently except upgrading MozillaBuild.
For what it's worth I also get: > *** failed to import extension evolve from C:\Users\Brian\appdata\Roaming\Python\Python27\site-packages\hgext3rd\evolve: No module named wireproto (And we really need to fix the defaults for these Phabricator emails.)
(In reply to Brian Birtles (:birtles) from comment #17) > I now get the following error on Windows when running just about any > mercurial command: > > > *** failed to import extension bzexport from c:\Users\Brian\.mozbuild\version-control-tools\hgext\bzexport: No module named mozhg.util Ran into the same error message. The patch for this looks like this: --- a/hgext/bzexport/__init__.py +++ b/hgext/bzexport/__init__.py @@ -63,21 +63,21 @@ from mercurial import ( patch, registrar, revset, scmutil, util, ) from hgext import mq -from mozhg.util import import_module - OUR_DIR = os.path.dirname(__file__) execfile(os.path.join(OUR_DIR, '..', 'bootstrap.py')) +from mozhg.util import import_module + import bzauth import bz from mozautomation.commitparser import BUG_RE from mozhg.rewrite import newparents, replacechangesets testedwith = '4.2 4.3 4.4 4.5 4.6' minimumhgversion = '4.2' buglink = 'https://bugzilla.mozilla.org/enter_bug.cgi?product=Developer%20Services&component=Mercurial%
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/hgcustom/version-control-tools/rev/c647a2b0a442 bzexport: don't attempt to import mozhg before sys.path adjustment
Are you still having issues :birtles? It looks like c647a2b0a442 in version-control-tools may have solved this issue, but I never followed up. Apologies!
Flags: needinfo?(sheehan) → needinfo?(bbirtles)
It seems to have fixed it for bzexport but not for the other extensions like qimportbz, qbackout, push-to-try, and mqext.
Flags: needinfo?(bbirtles)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: