Mercurial > hg
comparison mercurial/dirstate.py @ 50154:028fb89a0539
dirstate: enforce change context for hacky_extension_update_file
This was the last method not scoped yet
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 22 Feb 2023 03:42:36 +0100 |
parents | e9379b55ed80 |
children | 4c67862a0c49 |
comparison
equal
deleted
inserted
replaced
50153:98890baf324e | 50154:028fb89a0539 |
---|---|
784 p2_info=p2_info, | 784 p2_info=p2_info, |
785 possibly_dirty=possibly_dirty, | 785 possibly_dirty=possibly_dirty, |
786 parentfiledata=parentfiledata, | 786 parentfiledata=parentfiledata, |
787 ) | 787 ) |
788 | 788 |
789 # XXX since this make the dirstate dirty, we should enforce that it is done | |
790 # withing an appropriate change-context that scope the change and ensure it | |
791 # eventually get written on disk (or rolled back) | |
792 def hacky_extension_update_file(self, *args, **kwargs): | 789 def hacky_extension_update_file(self, *args, **kwargs): |
793 """NEVER USE THIS, YOU DO NOT NEED IT | 790 """NEVER USE THIS, YOU DO NOT NEED IT |
794 | 791 |
795 This function is a variant of "update_file" to be called by a small set | 792 This function is a variant of "update_file" to be called by a small set |
796 of extensions, it also adjust the internal state of file, but can be | 793 of extensions, it also adjust the internal state of file, but can be |
806 This function could probably be replaced by more semantic one (like | 803 This function could probably be replaced by more semantic one (like |
807 "adjust expected size" or "always revalidate file content", etc) | 804 "adjust expected size" or "always revalidate file content", etc) |
808 however at the time where this is writen, this is too much of a detour | 805 however at the time where this is writen, this is too much of a detour |
809 to be considered. | 806 to be considered. |
810 """ | 807 """ |
808 if not (self._changing_level > 0 or self._running_status > 0): | |
809 msg = "requires a changes context" | |
810 raise error.ProgrammingError(msg) | |
811 self._update_file( | 811 self._update_file( |
812 *args, | 812 *args, |
813 **kwargs, | 813 **kwargs, |
814 ) | 814 ) |
815 | 815 |