Patchwork D11141: largefile: rearrange conditionnal in `synclfdirstate`

login
register
mail settings
Submitter phabricator
Date July 19, 2021, 10:42 a.m.
Message ID <differential-rev-PHID-DREV-rd7l2wiupm4yahusts6v-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49452/
State Superseded
Headers show

Comments

phabricator - July 19, 2021, 10:42 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We can liquidate the special case early, so do we.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11141

AFFECTED FILES
  hgext/largefiles/lfutil.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -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):