comparison hgext/win32text.py @ 50069:05a2f65c9e86

win32text: drop the `changing_parents` context in revert upgrade We are not changing parents here, so let us not pretend we do.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 25 Jan 2023 12:47:55 +0100
parents d68b71256c33
children b7ddd9ae4bef
comparison
equal deleted inserted replaced
50068:d68b71256c33 50069:05a2f65c9e86
214 214
215 215
216 def wrap_revert(orig, repo, ctx, names, uipathfn, actions, *args, **kwargs): 216 def wrap_revert(orig, repo, ctx, names, uipathfn, actions, *args, **kwargs):
217 # reset dirstate cache for file we touch 217 # reset dirstate cache for file we touch
218 ds = repo.dirstate 218 ds = repo.dirstate
219 with ds.changing_parents(repo): 219 for filename in actions[b'revert'][0]:
220 for filename in actions[b'revert'][0]: 220 entry = ds.get_entry(filename)
221 entry = ds.get_entry(filename) 221 if entry is not None:
222 if entry is not None: 222 if entry.p1_tracked:
223 if entry.p1_tracked: 223 # If we revert the file, it is possibly dirty. However,
224 # If we revert the file, it is possibly dirty. However, 224 # this extension meddle with the file content and therefore
225 # this extension meddle with the file content and therefore 225 # its size. As a result, we cannot simply call
226 # its size. As a result, we cannot simply call 226 # `dirstate.set_possibly_dirty` as it will not affet the
227 # `dirstate.set_possibly_dirty` as it will not affet the 227 # expected size of the file.
228 # expected size of the file. 228 #
229 # 229 # At least, now, the quirk is properly documented.
230 # At least, now, the quirk is properly documented. 230 ds.hacky_extension_update_file(
231 ds.hacky_extension_update_file( 231 filename,
232 filename, 232 entry.tracked,
233 entry.tracked, 233 p1_tracked=True,
234 p1_tracked=True, 234 p2_info=entry.p2_info,
235 p2_info=entry.p2_info, 235 )
236 )
237 return orig(repo, ctx, names, uipathfn, actions, *args, **kwargs) 236 return orig(repo, ctx, names, uipathfn, actions, *args, **kwargs)
238 237
239 238
240 def extsetup(ui): 239 def extsetup(ui):
241 # deprecated config: win32text.warn 240 # deprecated config: win32text.warn