# HG changeset patch # User Pierre-Yves David # Date 1423242088 0 # Node ID 4099b087f6725a3a3d599e19fd7d3dc02e0d60b2 # Parent ee9c10728b6858676480c41054913c06bf6e127c 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. diff -r ee9c10728b68 -r 4099b087f672 hgext/evolve.py --- a/hgext/evolve.py Fri Feb 06 16:58:42 2015 +0000 +++ b/hgext/evolve.py Fri Feb 06 17:01:28 2015 +0000 @@ -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)