sapling/eden/scm/tests/test-clone-resume.t
Durham Goode a77f847eab clone: add UX to hint for users to use 'hg checkout --continue'
Summary:
Adds a message for users to use 'hg checkout --continue' if there's a
.hg/updatestate file (indicating an aborted checkout) and if they're on the null
rev (indicating they likely just cloned).

Also adds support for 'hg checkout --continue' to work with non-merge commits.
Note, it really only currently works when checking out from null, since
otherwise there will be a lot of modified files in the way. Once native checkout
is more mature, we can teach it to ignore modified files that match the desired
checkout destination.

Reviewed By: quark-zju

Differential Revision: D26967976

fbshipit-source-id: 7397c5fe82027e22bf1b4db0f14bb180239fae25
2021-04-26 16:49:53 -07:00

64 lines
2.0 KiB
Perl

#chg-compatible
$ configure modern
$ setconfig clone.nativecheckout=True
$ newserver server
Create a repo that touches a few files
$ newremoterepo client1
$ mkdir dir1 dir2
$ for i in {0..5000} ; do touch dir1/$i ; done
$ touch dir2/x
$ hg commit -Aqm 'initial commit' 2>/dev/null
$ hg push --to master --create -q
$ cd ..
Bare clone the repo
$ newremoterepo client2
$ hg pull -q
#if no-windows
Make some of the directories we are about to checkout read-only so we encounter
an error mid-checkout.
$ mkdir dir2
$ chmod -R a-w dir2
$ hg checkout tip --config remotefilelog.debug=False
abort: Permission denied* (glob)
[255]
Verify we see the warning for other commands
$ hg log -r .
warning: this repository appears to have not finished cloning - run 'hg checkout --continue' to resume the clone
commit: 000000000000
user:
date: Thu Jan 01 00:00:00 1970 +0000
Verify we cannot specify --continue and a rev
$ hg checkout master --continue
warning: this repository appears to have not finished cloning - run 'hg checkout --continue' to resume the clone
abort: cannot specify --continue and a update revision
[255]
Verify the checkout resumes where it left off
- [^0].* tells it to not match "0", so we can ensure some files were skipped.
$ chmod -R a+w dir2
$ EDENSCM_LOG=checkout=debug hg checkout --continue
warning: this repository appears to have not finished cloning - run 'hg checkout --continue' to resume the clone
continuing checkout to '185c975eb20e8e95b3b30bdf745d83263817832c'
DEBUG checkout: Skipping checking out [^0].* files since they're already written (re)
5002 files updated, 0 files merged, 0 files removed, 0 files unresolved
Verify we can disable resumable checkouts
$ hg checkout -q null
$ mkdir dir2
$ chmod -R a-w dir2
$ hg checkout tip --config checkout.resumable=False
abort: * (glob)
[255]
$ chmod -R a+w dir2
$ test -f .hg/updateprogress
[1]
$ chmod -R a-w dir2
#endif