diff mercurial/sparse.py @ 52715:f3762eafed66

typing: add some type annotations to the `merge.mergeresult` class The generated type annotations around `filemap()` and `files()` were slightly modified by the pyupgrade series culminating in 70a75d379daf. This module is way more complicated than the other changes, but these weren't too bad to figure out. The typing caught a trivial issue in `sparse`- it was passing an empty data list to `addfile()` for the `ACTION_REMOVE` case, instead of a tuple or None. `merge.manifestmerge()` calls this function with None for the data, so 1) it has to be typed as optional, and 2) is safe to pass None in the sparse code.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 13 Jan 2025 12:24:33 -0500
parents 24ee91ba9aa8
children
line wrap: on
line diff
--- a/mercurial/sparse.py	Mon Jan 13 00:40:48 2025 -0500
+++ b/mercurial/sparse.py	Mon Jan 13 12:24:33 2025 -0500
@@ -548,7 +548,7 @@
         elif (old and not new) or (not old and not new and file in dirstate):
             dropped.append(file)
             if file not in pending:
-                mresult.addfile(file, mergestatemod.ACTION_REMOVE, [], b'')
+                mresult.addfile(file, mergestatemod.ACTION_REMOVE, None, b'')
 
     # Verify there are no pending changes in newly included files
     abort = False