comparison mercurial/interfaces/dirstate.py @ 50026: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
comparison
equal deleted inserted replaced
50025:d50d45cd5a5f 50026:3550e4a88ccd
28 """True if any changes in progress.""" 28 """True if any changes in progress."""
29 ) 29 )
30 is_changing_parents = interfaceutil.Attribute( 30 is_changing_parents = interfaceutil.Attribute(
31 """True if parents changes in progress.""" 31 """True if parents changes in progress."""
32 ) 32 )
33 is_changing_files = interfaceutil.Attribute(
34 """True if file tracking changes in progress."""
35 )
33 36
34 def _ignorefiles(): 37 def _ignorefiles():
35 """Return a list of files containing patterns to ignore.""" 38 """Return a list of files containing patterns to ignore."""
36 39
37 def _ignorefileandline(f): 40 def _ignorefileandline(f):
41 _checkexec = interfaceutil.Attribute("""Callable for checking exec bits.""") 44 _checkexec = interfaceutil.Attribute("""Callable for checking exec bits.""")
42 45
43 @contextlib.contextmanager 46 @contextlib.contextmanager
44 def changing_parents(repo): 47 def changing_parents(repo):
45 """Context manager for handling dirstate parents. 48 """Context manager for handling dirstate parents.
49
50 If an exception occurs in the scope of the context manager,
51 the incoherent dirstate won't be written when wlock is
52 released.
53 """
54
55 @contextlib.contextmanager
56 def changing_files(repo):
57 """Context manager for handling dirstate files.
46 58
47 If an exception occurs in the scope of the context manager, 59 If an exception occurs in the scope of the context manager,
48 the incoherent dirstate won't be written when wlock is 60 the incoherent dirstate won't be written when wlock is
49 released. 61 released.
50 """ 62 """