问题
I have a Mercuirial (3.6.1) project. Every time I try to commit I get the next error.
(project)➜ project hg:(default) ✗ hg commit -m "TICK-190" subfolder/models.py
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2]
** Mercurial Distributed SCM (version 3.6.1)
** Extensions loaded:
Traceback (most recent call last):
File "/home/django/project/bin/hg", line 43, in <module>
mercurial.dispatch.run()
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 54, in run
sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 116, in dispatch
ret = _runcatch(req)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 187, in _runcatch
return _dispatch(req)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 920, in _dispatch
cmdpats, cmdoptions)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 679, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/home/django/plantbid/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 1051, in _runcommand
return checkargs()
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 1011, in checkargs
return cmdfunc()
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 917, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/util.py", line 801, in check
return func(*args, **kwargs)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/commands.py", line 1584, in commit
node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/cmdutil.py", line 2491, in commit
return commitfunc(ui, repo, message, matcher, opts)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/project.py", line 1578, in commitfunc
extra=extra)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/localrepo.py", line 64, in wrapper
return orig(repo.unfiltered(), *args, **kwargs)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/localrepo.py", line 1550, in commit
allowemptycommit = (wctx.branch() != wctx.p1().branch()
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/context.py", line 533, in branch
return encoding.tolocal(self._changeset[5].get("branch"))
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/util.py", line 534, in __get__
result = self.func(obj)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/context.py", line 502, in _changeset
return self._repo.changelog.read(self.rev())
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/changelog.py", line 338, in read
text = self.revision(node)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/revlog.py", line 1110, in revision
bins = self._chunks(chain, df=_df)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/revlog.py", line 1015, in _chunks
self._chunkraw(revs[0], revs[-1], df=df)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/revlog.py", line 990, in _chunkraw
return self._getchunk(start, length, df=df)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/revlog.py", line 981, in _getchunk
return self._loadchunk(offset, length, df=df)
File "/home/django/project/local/lib/python2.7/site-packages/mercurial/revlog.py", line 966, in _loadchunk
return util.buffer(d, offset - realoffset, length)
ValueError: size must be zero or positive
There's no much more detail I can explain. I was commiting my code without problems and suddenly this error started to show. I cannot commit any file. I can ask gor hg status with no problem.
Since this is a legacy project I've recently got, I want to make as little changes as possible.
UPDATE:
hg verify
repository uses revlog format 1
checking changesets
changelog@?: data length off by 1066185 bytes
changelog@?: rev 6801 points to nonexistent changeset -1
(expected 6801)
6802: unpacking changeset b087b38d690d: revlog decompress error: Error -5 while decompressing data: incomplete or truncated stream
checking manifests
manifest@?: data length off by 1894563 bytes
manifest@?: rev 6729 points to nonexistent changeset -1
manifest@?: 000000000000 not in changesets
manifest@?: rev 6730 points to unexpected changeset 6802
manifest@?: 9363dc75d5fb not in changesets
?: reading manifest delta 9363dc75d5fb: revlog decompress error: Error -5 while decompressing data: incomplete or truncated stream
crosschecking files in changesets and manifests
checking files
plantbid/templates/rfp_edit_nursery_responses3.html@?: rev 8 points to unexpected changeset 6802
(expected )
plantbid/templates/rfp_edit_nursery_responses3.html@?: 7e15c24e6859 not in manifests
plantrfp/views.py@4684: broken revlog! (index data/plantrfp/views.py.i is corrupted)
warning: orphan revlog 'data/plantrfp/views.py.i'
2266 files, 6803 changesets, 13181 total revisions
3 warnings encountered!
12 integrity errors encountered!
(first damaged changeset appears to be 4684)
回答1:
You may have found a bug in Mercurial, but try updating to the latest Mercurial version (3.9) first before you file a bug report. https://www.mercurial-scm.org
Re:Update: That looks like your repository is faulty. Maybe your hard drive has errors? Is this the only copy of the repository, or is there another one somewhere else? You best bet is probably to try and find a non-broken copy.
来源:https://stackoverflow.com/questions/38526293/cannot-commit-in-mercurial-repo