Bug 6056 - commit fails on non-generaldelta repositories
Summary: commit fails on non-generaldelta repositories
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: stable branch
Hardware: PC Windows
: urgent bug
Assignee: Bugzilla
URL:
Keywords: regression, releaseblocker
Depends on:
Blocks:
 
Reported: 2019-01-22 02:54 UTC by Mathias De Maré
Modified: 2019-02-08 00:00 UTC (History)
5 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias De Maré 2019-01-22 02:54 UTC
It appears we still have some non-generaldelta repositories, and I just bumped into an issue with one of them. This occurs on 4.9rc0+11-13c23396c7fe:

env HGRCPATH= HGPLAIN= hg commit -u foo -m "foo"
transaction abort!
rollback completed
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
** Mercurial Distributed SCM (version 4.9rc0+11-13c23396c7fe)
** Extensions loaded: 
Traceback (most recent call last):
  File "/bin/hg", line 43, in <module>
    dispatch.run()
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 99, in run
    status = dispatch(req)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 225, in dispatch
    ret = _runcatch(req) or 0
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 376, in _runcatch
    return _callcatch(ui, _runcatchfunc)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 384, in _callcatch
    return scmutil.callcatch(ui, func)
  File "/usr/lib64/python2.7/site-packages/mercurial/scmutil.py", line 165, in callcatch
    return func()
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 367, in _runcatchfunc
    return _dispatch(req)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 1021, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 756, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 1030, in _runcommand
    return cmdfunc()
  File "/usr/lib64/python2.7/site-packages/mercurial/dispatch.py", line 1018, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "/usr/lib64/python2.7/site-packages/mercurial/util.py", line 1670, in check
    return func(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/mercurial/commands.py", line 1644, in commit
    return _docommit(ui, repo, *pats, **opts)
  File "/usr/lib64/python2.7/site-packages/mercurial/commands.py", line 1719, in _docommit
    node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
  File "/usr/lib64/python2.7/site-packages/mercurial/cmdutil.py", line 2397, in commit
    return commitfunc(ui, repo, message, matcher, opts)
  File "/usr/lib64/python2.7/site-packages/mercurial/commands.py", line 1717, in commitfunc
    extra=extra)
  File "/usr/lib64/python2.7/site-packages/mercurial/localrepo.py", line 158, in wrapper
    return orig(repo.unfiltered(), *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/mercurial/localrepo.py", line 2477, in commit
    ret = self.commitctx(cctx, True)
  File "/usr/lib64/python2.7/site-packages/mercurial/localrepo.py", line 158, in wrapper
    return orig(repo.unfiltered(), *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/mercurial/localrepo.py", line 2587, in commitctx
    added, drop, match=self.narrowmatch())
  File "/usr/lib64/python2.7/site-packages/mercurial/manifest.py", line 1749, in write
    p1, p2, added, removed, match=match)
  File "/usr/lib64/python2.7/site-packages/mercurial/manifest.py", line 1493, in add
    cachedelta)
  File "/usr/lib64/python2.7/site-packages/mercurial/revlog.py", line 1885, in addrevision
    deltacomputer=deltacomputer)
  File "/usr/lib64/python2.7/site-packages/mercurial/revlog.py", line 1900, in addrawrevision
    deltacomputer=deltacomputer)
  File "/usr/lib64/python2.7/site-packages/mercurial/revlog.py", line 2028, in _addrevision
    deltainfo = deltacomputer.finddeltainfo(revinfo, fh)
  File "/usr/lib64/python2.7/site-packages/mercurial/revlogutils/deltas.py", line 995, in finddeltainfo
    candidaterevs = next(groups)
  File "/usr/lib64/python2.7/site-packages/mercurial/revlogutils/deltas.py", line 643, in _candidategroups
    temptative = candidates.send(good)
  File "/usr/lib64/python2.7/site-packages/mercurial/revlogutils/deltas.py", line 717, in _refinedgroups
    for candidates in _rawgroups(revlog, p1, p2, cachedelta, snapshots):
  File "/usr/lib64/python2.7/site-packages/mercurial/revlogutils/deltas.py", line 778, in _rawgroups
    if sparse and parents:
UnboundLocalError: local variable 'parents' referenced before assignment
Comment 1 vgatien-baron 2019-01-28 16:21 UTC
I saw the same error on my repository, on 4.8 with a number of backports from 4.9, including probably all the sparse-revlog changes.

In my case, the commit blows up on a filelog, instead of the manifestlog. The repository has a generaldelta requirement, but that filelog index doesn't have the generaldelta bit in the header. What appears to the vast majority of filelog indexes have the generaldelta bit, and a few of them don't. The ones without the generaldelta bit that I looked at all seemed pretty new (a couple of months old or less).
Comment 2 HG Bot 2019-01-31 09:25 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/189e06b2d719
Boris Feld <boris.feld@octobus.net>
revlog: make sure we never use sparserevlog without general delta (issue6056)

We are getting user report where the delta code tries to use `sparse-revlog`
logic on repository where `generaldelta` is disabled. This can't work so we
ensure the two booleans have a consistent value.

Creating this kind of repository is not expected to be possible the current bug
report point at a clonebundle related bug that is still to be properly isolated
(Yuya Nishihara seems to a have done it).

Corrupting a repository to reproduce the issue is possible. A test using this
method is included in this fix.

(please test the fix)
Comment 3 Bugzilla 2019-02-08 00:00 UTC
Bug was set to TESTING for 7 days, resolving