# HG changeset patch # User Pierre-Yves David # Date 1408053582 25200 # Node ID a56038e6a3c96705afef40c7ac46a93986bfee44 # Parent 328efb5ca0b47f8d5ae16dd2009f7fb7205e7665 obsstore.create: add a simple safeguard against cyclic markers We detect when there is a cycle in the marker itself (precursors being listed as successors). diff -r 328efb5ca0b4 -r a56038e6a3c9 mercurial/obsolete.py --- a/mercurial/obsolete.py Thu Aug 14 14:57:03 2014 -0700 +++ b/mercurial/obsolete.py Thu Aug 14 14:59:42 2014 -0700 @@ -277,6 +277,8 @@ for succ in succs: if len(succ) != 20: raise ValueError(succ) + if prec in succs: + raise ValueError(_('in-marker cycle with %s') % node.hex(prec)) marker = (str(prec), tuple(succs), int(flag), encodemeta(metadata)) return bool(self.add(transaction, [marker])) diff -r 328efb5ca0b4 -r a56038e6a3c9 tests/test-obsolete.t --- a/tests/test-obsolete.t Thu Aug 14 14:57:03 2014 -0700 +++ b/tests/test-obsolete.t Thu Aug 14 14:59:42 2014 -0700 @@ -64,6 +64,14 @@ date: Thu Jan 01 00:00:00 1970 +0000 $ hg up --hidden tip --quiet + +Killing a single changeset with itself should fail +(simple local safeguard) + + $ hg debugobsolete `getid kill_me` `getid kill_me` + abort: bad obsmarker input: in-marker cycle with 97b7c2d76b1845ed3eb988cd612611e72406cef0 + [255] + $ cd .. Killing a single changeset with replacement