diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py --- a/hgext/git/dirstate.py +++ b/hgext/git/dirstate.py @@ -265,6 +265,11 @@ class gitdirstate: # correctly stage/revert index edits. return False + def is_changing_any(self): + # TODO: we need to implement the context manager bits and + # correctly stage/revert index edits. + return False + def write(self, tr): # TODO: call parent change callbacks diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -202,6 +202,14 @@ class dirstate: ) raise error.ProgrammingError(msg) + @property + def is_changing_any(self): + """Returns true if the dirstate is in the middle of a set of changes. + + This returns True for any kind of change. + """ + return self._changing_level > 0 + def pendingparentchange(self): """Returns true if the dirstate is in the middle of a set of changes that modify the dirstate parent. diff --git a/mercurial/interfaces/dirstate.py b/mercurial/interfaces/dirstate.py --- a/mercurial/interfaces/dirstate.py +++ b/mercurial/interfaces/dirstate.py @@ -24,6 +24,9 @@ class idirstate(interfaceutil.Interface) # TODO: all these private methods and attributes should be made # public or removed from the interface. _ignore = interfaceutil.Attribute("""Matcher for ignored files.""") + is_changing_any = interfaceutil.Attribute( + """True if any changes in progress.""" + ) is_changing_parents = interfaceutil.Attribute( """True if parents changes in progress.""" ) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -3070,7 +3070,7 @@ class localrepository: self.ui.develwarn(b'"wlock" acquired after "lock"') def unlock(): - if self.dirstate.is_changing_parents: + if self.dirstate.is_changing_any: msg = b"wlock release in the middle of a changing parents" self.ui.develwarn(msg) self.dirstate.invalidate()