mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
remotefilelog: before creating filenode, check in manifest if the file exists
Summary: When hg addremove needs to remove a file, remotefilelog tries to create a filenode in order to prefetch the removed files from the server. If the file is not in the parent context manifest, this throws an exception. To solve this we have to first check if the file exists or not in the parent manifest. If the file does not exist in the manifest then we don't need to prefetch it, and addremove will behave like forget rather than remove. Reviewed By: markbt Differential Revision: D7009649 fbshipit-source-id: 0570bc00db546a455b9c2e4628740e24ca819dd6
This commit is contained in:
parent
3560fd1139
commit
4838457b17
@ -385,8 +385,10 @@ def onetimeclientsetup(ui):
|
||||
if shallowrepo.requirement in repo.requirements:
|
||||
files = []
|
||||
parentctx = repo['.']
|
||||
m1 = parentctx.manifest()
|
||||
for f in removed:
|
||||
files.append((f, hex(parentctx.filenode(f))))
|
||||
if f in m1:
|
||||
files.append((f, hex(parentctx.filenode(f))))
|
||||
# batch fetch the needed files from the server
|
||||
repo.fileservice.prefetch(files)
|
||||
return orig(repo, matcher, added, removed, *args, **kwargs)
|
||||
|
@ -50,6 +50,7 @@
|
||||
$ hg addremove
|
||||
adding dir/a.py
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
|
||||
$ hg init sim
|
||||
$ cd sim
|
||||
@ -91,4 +92,13 @@
|
||||
|
||||
$ hg st
|
||||
! c
|
||||
|
||||
$ hg forget c
|
||||
$ touch foo
|
||||
$ hg addremove
|
||||
adding foo
|
||||
$ rm foo
|
||||
$ hg addremove
|
||||
removing foo
|
||||
|
||||
$ cd ..
|
||||
|
Loading…
Reference in New Issue
Block a user