Mercurial > hg-stable
changeset 22177:a56038e6a3c9 stable
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).
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 14 Aug 2014 14:59:42 -0700 |
parents | 328efb5ca0b4 |
children | 70383c6961b4 |
files | mercurial/obsolete.py tests/test-obsolete.t |
diffstat | 2 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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]))
--- 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