From e750755eba04df799c251c3f5166c10738dce53e Mon Sep 17 00:00:00 2001 From: Durham Goode Date: Mon, 17 Jun 2013 19:44:00 -0700 Subject: [PATCH] revlog: add exception when linkrev == nullrev When we deployed the latest crew mercurial to our users, a few of them had issues where a filelog would have an entry with a -1 linkrev. This caused operations like rebase and amend to create a bundle containing the entire repository, which took a long time. I don't know what the issue is, but adding this check should prevent repos from getting in this state, and should help us pinpoint the issue next time it happens. --- mercurial/revlog.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mercurial/revlog.py b/mercurial/revlog.py index 324e25652a..af929083f7 100644 --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -991,6 +991,9 @@ class revlog(object): p1, p2 - the parent nodeids of the revision cachedelta - an optional precomputed delta """ + if link == nullrev: + raise RevlogError(_("attempted to add linkrev -1 to %s") + % self.indexfile) node = hash(text, p1, p2) if node in self.nodemap: return node