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).
--- 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