changeset 47699:034979d24c7b

largefile: rearrange conditionnal in `synclfdirstate` We can liquidate the special case early, so do we. Differential Revision: https://phab.mercurial-scm.org/D11141
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 19 Jul 2021 03:25:21 +0200
parents 9fa1085fbd63
children 9217ab0ecdb8
files hgext/largefiles/lfutil.py
diffstat 1 files changed, 14 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Mon Jul 19 03:20:04 2021 +0200
+++ b/hgext/largefiles/lfutil.py	Mon Jul 19 03:25:21 2021 +0200
@@ -550,25 +550,23 @@
 
 def synclfdirstate(repo, lfdirstate, lfile, normallookup):
     lfstandin = standin(lfile)
-    if lfstandin in repo.dirstate:
+    if lfstandin not in repo.dirstate:
+        lfdirstate.drop(lfile)
+    else:
         stat = repo.dirstate._map[lfstandin]
         state, mtime = stat.state, stat.mtime
-    else:
-        state, mtime = b'?', -1
-    if state == b'n':
-        if normallookup or mtime < 0 or not repo.wvfs.exists(lfile):
-            # state 'n' doesn't ensure 'clean' in this case
+        if state == b'n':
+            if normallookup or mtime < 0 or not repo.wvfs.exists(lfile):
+                # state 'n' doesn't ensure 'clean' in this case
+                lfdirstate.normallookup(lfile)
+            else:
+                lfdirstate.normal(lfile)
+        elif state == b'm':
             lfdirstate.normallookup(lfile)
-        else:
-            lfdirstate.normal(lfile)
-    elif state == b'm':
-        lfdirstate.normallookup(lfile)
-    elif state == b'r':
-        lfdirstate.remove(lfile)
-    elif state == b'a':
-        lfdirstate.add(lfile)
-    elif state == b'?':
-        lfdirstate.drop(lfile)
+        elif state == b'r':
+            lfdirstate.remove(lfile)
+        elif state == b'a':
+            lfdirstate.add(lfile)
 
 
 def markcommitted(orig, ctx, node):