diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -256,6 +256,10 @@ class dirstate(object): See localrepo.setparents() """ + if self._parentwriters == 0: + raise ValueError("cannot set dirstate parent without " + + " calling dirstate.begingparentchange") + self._dirty = self._dirtypl = True oldp2 = self._pl[1] self._pl = p1, p2