checkout: print removed cwd warning in nativecheckout

Summary:
This warning was printed by old checkout, keeping it in nativecheckout too
The warning tells user that current working directory was removed during checkout

This diff also makes test-update-names.t to use nativecheckout. Otherwise last test fails on remote repo, because pyworker does not emit the deleted cwd warning

Reviewed By: quark-zju

Differential Revision: D26558188

fbshipit-source-id: 1f6ea2ea1ac7358ce2f06fed25069656481b30e6
This commit is contained in:
Andrey Chursin 2021-02-20 01:24:06 -08:00 committed by Facebook GitHub Bot
parent d8e40c89a0
commit 987e6426fc
2 changed files with 15 additions and 1 deletions

View File

@ -2305,6 +2305,7 @@ def update(
repo.localvfs.writeutf8("updatestate", p2.hex())
fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ""
cwd = pycompat.getcwdsafe()
with progress.spinner(repo.ui, _("updating")):
repo.ui.debug("Applying to %s \n" % repo.wvfs.base)
@ -2312,6 +2313,17 @@ def update(
repo.ui.debug("Apply done\n")
stats = plan.stats()
if cwd and not pycompat.getcwdsafe():
# cwd was removed in the course of removing files; print a helpful
# warning.
repo.ui.warn(
_(
"current directory was removed\n"
"(consider changing to repo root: %s)\n"
)
% repo.root
)
if not partial and not wc.isinmemory():
with repo.dirstate.parentchange():
repo.setparents(fp1, fp2)

View File

@ -3,6 +3,8 @@
Test update logic when there are renames or weird same-name cases between dirs
and files
$ setconfig experimental.nativecheckout=true
Setup server
$ newserver server
@ -80,7 +82,7 @@ Test update when two commits have symlinks that point to different folders
#if rmcwd
Test that warning is printed if cwd is deleted during update
$ newrepo r4
$ newremoterepo r4
$ mkdir dir
$ cd dir
$ echo a > a