Mercurial > hg
changeset 22407:d259322a394b
dirstate: add exception when calling setparent without begin/end (API)
Adds an exception when calling dirstate.setparent without having first called
dirstate.beginparentchange. This will prevent people from writing code that
modifies the dirstate parent without considering the transactionality of their
change.
This will break third party extensions that call setparents.
author | Durham Goode <durham@fb.com> |
---|---|
date | Fri, 05 Sep 2014 11:37:44 -0700 |
parents | 2e47e461d2ca |
children | dc97e04c12ad |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Fri Sep 05 15:36:56 2014 -0700 +++ b/mercurial/dirstate.py Fri Sep 05 11:37:44 2014 -0700 @@ -256,6 +256,10 @@ 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