Mercurial > hg > evolve
changeset 1298:4099b087f672 stable
evolve: handle invalid obsmarkers in the `debugobsconvert`
User can now recover from such situation, The error message is also changed to
point the `debugobsconvert` commands.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 06 Feb 2015 17:01:28 +0000 |
parents | ee9c10728b68 |
children | 936aa82884ab |
files | hgext/evolve.py |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -2769,6 +2769,23 @@ _bestformat = max(obsolete.formats.keys()) + +if getattr(obsolete, '_checkinvalidmarkers', None) is not None: + @eh.wrapfunction(obsolete, '_checkinvalidmarkers') + def _checkinvalidmarkers(orig, markers): + """search for marker with invalid data and raise error if needed + + Exist as a separated function to allow the evolve extension for a more + subtle handling. + """ + if 'debugobsconvert' in sys.argv: + return + for mark in markers: + if node.nullid in mark[1]: + raise util.Abort(_('bad obsolescence marker detected: ' + 'invalid successors nullid'), + hint=_('You should run `hg debugobsconvert`')) + @command( 'debugobsconvert', [('', 'new-format', _bestformat, _('Destination format for markers.'))], @@ -2782,6 +2799,11 @@ known = set() markers = [] for m in origmarkers: + # filter out invalid markers + if nullid in m[1]: + m = list(m) + m[1] = tuple(s for s in m[1] if s != nullid) + m = tuple(m) if m in known: continue known.add(m)