Patchwork D6194: remotefilelog: fix crash on `hg addremove` of added-but-deleted file

login
register
mail settings
Submitter phabricator
Date April 8, 2019, 6:51 p.m.
Message ID <f3b1c56e5cbe4ce0dc19d9a82ef144f3@localhost.localdomain>
Download mbox | patch
Permalink /patch/39541/
State Not Applicable
Headers show

Comments

phabricator - April 8, 2019, 6:51 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG91cc8dc866ed: remotefilelog: fix crash on `hg addremove` of added-but-deleted file (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6194?vs=14650&id=14697

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

AFFECTED FILES
  hgext/remotefilelog/__init__.py
  tests/test-remotefilelog-prefetch.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-remotefilelog-prefetch.t b/tests/test-remotefilelog-prefetch.t
--- a/tests/test-remotefilelog-prefetch.t
+++ b/tests/test-remotefilelog-prefetch.t
@@ -197,6 +197,9 @@ 
   $ mv x x2
   $ mv y y2
   $ mv z z2
+  $ echo a > a
+  $ hg add a
+  $ rm a
   $ clearcache
   $ hg addremove -s 50 > /dev/null
   3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over * (glob)
diff --git a/hgext/remotefilelog/__init__.py b/hgext/remotefilelog/__init__.py
--- a/hgext/remotefilelog/__init__.py
+++ b/hgext/remotefilelog/__init__.py
@@ -478,9 +478,10 @@ 
     def findrenames(orig, repo, matcher, added, removed, *args, **kwargs):
         if isenabled(repo):
             files = []
-            parentctx = repo['.']
+            pmf = repo['.'].manifest()
             for f in removed:
-                files.append((f, hex(parentctx.filenode(f))))
+                if f in pmf:
+                    files.append((f, hex(pmf[f])))
             # batch fetch the needed files from the server
             repo.fileservice.prefetch(files)
         return orig(repo, matcher, added, removed, *args, **kwargs)