diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py index 328efb5ca0b47f8d5ae16dd2009f7fb7205e7665_bWVyY3VyaWFsL29ic29sZXRlLnB5..a56038e6a3c96705afef40c7ac46a93986bfee44_bWVyY3VyaWFsL29ic29sZXRlLnB5 100644 --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -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 --git a/tests/test-obsolete.t b/tests/test-obsolete.t index 328efb5ca0b47f8d5ae16dd2009f7fb7205e7665_dGVzdHMvdGVzdC1vYnNvbGV0ZS50..a56038e6a3c96705afef40c7ac46a93986bfee44_dGVzdHMvdGVzdC1vYnNvbGV0ZS50 100644 --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -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