Closed Bug 1100027 Opened 10 years ago Closed 10 years ago

"error: pretxnchangegroup.b_singlehead hook raised an exception: 'wrappedlocalrepo' object has no attribute 'branchtags'" pushing to mozilla-central

Categories

(Developer Services :: Mercurial: hg.mozilla.org, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: philor, Assigned: gps)

References

Details

pushing to ssh://hg.mozilla.org/mozilla-central/
    searching for changes
    remote: adding changesets                                                       
    remote: adding manifests
    remote: adding file changes
    remote: added 37 changesets with 399 changes to 360 files
    remote: error: pretxnchangegroup.b_singlehead hook raised an exception: 'wrappedlocalrepo' object has no attribute 'branchtags'
    remote: transaction abort!
    remote: rollback completed
    remote: ** Unknown exception encountered with possibly-broken third-party extension hgwebjson
    remote: ** which supports versions unknown of Mercurial.
    remote: ** Please disable hgwebjson and try your action again.
    remote: ** If that fixes the bug please report it to the extension author.
    remote: ** Python 2.6.6 (r266:84292, Nov 21 2013, 10:50:32) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]
    remote: ** Mercurial Distributed SCM (version 3.2.1+2-3246801ff313)
    remote: ** Extensions loaded: hgwebjson, pushlog-feed, buglink, serverlog
    remote: Traceback (most recent call last):
    remote:   File "/usr/bin/hg", line 43, in <module>
    remote:     mercurial.dispatch.run()
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 28, in run
    remote:     sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 71, in dispatch
    remote:     ret = _runcatch(req)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 140, in _runcatch
    remote:     return _dispatch(req)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 850, in _dispatch
    remote:     cmdpats, cmdoptions)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 611, in runcommand
    remote:     ret = _runcommand(ui, options, cmd, d)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 941, in _runcommand
    remote:     return checkargs()
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 912, in checkargs
    remote:     return cmdfunc()
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/dispatch.py", line 847, in <lambda>
    remote:     d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/util.py", line 677, in check
    remote:     return func(*args, **kwargs)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/commands.py", line 5536, in serve
    remote:     s.serve_forever()
    remote:   File "/repo/hg/extensions/serverlog/__init__.py", line 332, in serve_forever
    remote:     return super(sshserverwrapped, self).serve_forever()
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/sshserver.py", line 94, in serve_forever
    remote:     while self.serve_one():
    remote:   File "/repo/hg/extensions/serverlog/__init__.py", line 361, in serve_one
    remote:     return super(sshserverwrapped, self).serve_one()
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/sshserver.py", line 112, in serve_one
    remote:     rsp = wireproto.dispatch(self.repo, self, cmd)
    remote:   File "/repo/hg/extensions/serverlog/__init__.py", line 353, in dispatch
    remote:     return origdispatch(repo, proto, cmd)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/wireproto.py", line 505, in dispatch
    remote:     return func(repo, proto, *args)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/wireproto.py", line 828, in unbundle
    remote:     proto._client())
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/exchange.py", line 1265, in unbundle
    remote:     r = changegroup.addchangegroup(repo, cg, source, url)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/changegroup.py", line 698, in addchangegroup
    remote:     repo.hook('pretxnchangegroup', throw=True, pending=p, **hookargs)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/localrepo.py", line 491, in hook
    remote:     return hook.hook(self.ui, self, name, throw, **args)
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/hook.py", line 203, in hook
    remote:     r = _pythonhook(ui, repo, name, hname, hookfn, args, throw) or r
    remote:   File "/usr/lib64/python2.6/site-packages/mercurial/hook.py", line 89, in _pythonhook
    remote:     r = obj(ui=ui, repo=repo, hooktype=name, **args)
    remote:   File "/repo/hg/libraries/mozhghooks/single_head_per_branch.py", line 20, in hook
    remote:     for b in repo.branchtags():
    remote: AttributeError: 'wrappedlocalrepo' object has no attribute 'branchtags'
    abort: unexpected response: empty string
I'm on it.
Assignee: nobody → gps
Status: NEW → ASSIGNED
Priority: -- → P1
There were 2 problems.

First, an old mozhghooks was deployed. The old version was referencing an API that doesn't exist in Mercurial 3.2.

I deployed the latest revision of mozhghooks.

That revealed another problem: the hook was still refusing pushes to mozilla-central and other Firefox repositories!

I hacked up the hook to print some debugging info. Sure enough, it revealed 2 changesets on the default branch: a head I was pushing and the following commit:

changeset:   72923:a84cd7a9f4fccecd4795982083144651bf460efd
phase:       public
parent:      72922:b8e90c1d834db89ba1abadaed277f4aaa7c912a0
parent:      -1:0000000000000000000000000000000000000000
manifest:    72903:f2a5558817119263b9420c5dba9bbca67b8bbc9d
user:        Joe Drew <joe@drew.ca>
date:        Sat Jul 16 21:35:10 2011 -0400
extra:       branch=default
extra:       close=1
description:
Close the branch containing all the bad commits, because we're rebasing on 569a960b4a64

Sure enough, repo.branchmap() returns *all* heads, even closed heads.

I made a one line change to the hook to filter out closed branch heads and wrote a test to cover the scenario.

The new version is deployed and I've successfully pushed a merge to central.

If someone wants to do a post-commit review, please do.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.