Mercurial > public > mercurial-scm > hg-stable
diff mercurial/interfaces/dirstate.py @ 50082:3550e4a88ccd
dirstate: add a context for tracking files change
Let us start to use it. We will enforce it later.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 26 Jan 2023 17:44:27 +0100 |
parents | e1cff85484e2 |
children | 76d44983a398 |
line wrap: on
line diff
--- a/mercurial/interfaces/dirstate.py Mon Feb 13 21:51:45 2023 +0100 +++ b/mercurial/interfaces/dirstate.py Thu Jan 26 17:44:27 2023 +0100 @@ -30,6 +30,9 @@ is_changing_parents = interfaceutil.Attribute( """True if parents changes in progress.""" ) + is_changing_files = interfaceutil.Attribute( + """True if file tracking changes in progress.""" + ) def _ignorefiles(): """Return a list of files containing patterns to ignore.""" @@ -49,6 +52,15 @@ released. """ + @contextlib.contextmanager + def changing_files(repo): + """Context manager for handling dirstate files. + + If an exception occurs in the scope of the context manager, + the incoherent dirstate won't be written when wlock is + released. + """ + def hasdir(d): pass