Mercurial > hg
changeset 35167:9fb2b0b41bec stable
test-largefiles: demonstrate problems with renaming and reverting a directory
These things were uncovered looking at issue5738.
First, if the destination directory exists under .hglf, the source is moved
under the destination instead of renaming the last component for `hg mv srcdir
dstdir`. This is extra confusing, because it occurs even if the user visible
destination (i.e. the path _not_ under .hglf) does not exist.
Additionally, when a largefile is forgotten via revert, any modifications end up
getting clobbered. For normal files, the forgotten file is left unchanged, as
shown by test-import.t. The forget command on a largefile will correctly leave
the file unmodified.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 12 Nov 2017 00:24:38 -0500 |
parents | ba6324ee49e9 |
children | b175e54c1103 |
files | tests/test-import.t tests/test-largefiles-misc.t |
diffstat | 2 files changed, 167 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-import.t Sat Nov 11 12:37:05 2017 -0500 +++ b/tests/test-import.t Sun Nov 12 00:24:38 2017 -0500 @@ -972,6 +972,7 @@ adding b recording removal of a as rename to b (88% similar) applied to working directory + $ echo 'mod b' > b $ hg st -C A b a @@ -979,6 +980,8 @@ $ hg revert -a undeleting a forgetting b + $ cat b + mod b $ rm b $ hg import --no-commit -v -s 100 ../rename.diff -p2 applying ../rename.diff
--- a/tests/test-largefiles-misc.t Sat Nov 11 12:37:05 2017 -0500 +++ b/tests/test-largefiles-misc.t Sun Nov 12 00:24:38 2017 -0500 @@ -390,8 +390,12 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg status -S +Forget doesn't change the content of the file + $ echo 'pre-forget content' > subrepo/large.txt $ hg forget -v subrepo/large.txt removing subrepo/large.txt (glob) + $ cat subrepo/large.txt + pre-forget content Test reverting a forgotten file $ hg revert -R subrepo subrepo/large.txt @@ -1060,7 +1064,9 @@ > largefiles= > EOF $ echo large > subrepo-root/large - $ hg -R subrepo-root add --large subrepo-root/large + $ mkdir -p subrepo-root/dir/subdir + $ echo large2 > subrepo-root/dir/subdir/large.bin + $ hg -R subrepo-root add --large subrepo-root/large subrepo-root/dir/subdir/large.bin $ hg clone -q no-largefiles subrepo-root/no-largefiles $ cat > subrepo-root/.hgsub <<EOF > no-largefiles = no-largefiles @@ -1069,6 +1075,7 @@ $ hg -R subrepo-root commit -m '#0' Invoking status precommit hook A .hgsub + A dir/subdir/large.bin A large ? .hgsubstate $ echo dirty >> subrepo-root/large @@ -1085,8 +1092,163 @@ reverting subrepo no-largefiles reverting subrepo-root/no-largefiles/normal1 (glob) - $ cd .. +Move (and then undo) a directory move with only largefiles. + + $ listtree() { + > find $@ \( -type d -printf "%p/\n" -o -type f -printf "%p\n" \) \ + > -a -name .hg -prune | sort + > } + + $ cd subrepo-root + $ listtree .hglf dir* large* + .hglf/ + .hglf/dir/ + .hglf/dir/subdir/ + .hglf/dir/subdir/large.bin + .hglf/large + dir/ + dir/subdir/ + dir/subdir/large.bin + large + large.orig + + $ hg mv dir/subdir dir/subdir2 + moving .hglf/dir/subdir/large.bin to .hglf/dir/subdir2/large.bin (glob) + + $ listtree .hglf dir* large* + .hglf/ + .hglf/dir/ + .hglf/dir/subdir2/ + .hglf/dir/subdir2/large.bin + .hglf/large + dir/ + dir/subdir2/ + dir/subdir2/large.bin + large + large.orig + $ hg status -C + A dir/subdir2/large.bin + dir/subdir/large.bin + R dir/subdir/large.bin + ? large.orig + + $ echo 'modified' > dir/subdir2/large.bin + $ hg status -C + A dir/subdir2/large.bin + dir/subdir/large.bin + R dir/subdir/large.bin + ? large.orig + + $ hg revert --all + undeleting .hglf/dir/subdir/large.bin (glob) + forgetting .hglf/dir/subdir2/large.bin (glob) + reverting subrepo no-largefiles + + $ hg status -C + ? dir/subdir2/large.bin + ? large.orig + +BUG: The content of the forgotten file shouldn't be clobbered + + $ cat dir/subdir2/large.bin + large2 + +BUG: the standin for subdir2 should be deleted, not just dropped + + $ listtree .hglf dir* large* + .hglf/ + .hglf/dir/ + .hglf/dir/subdir/ + .hglf/dir/subdir/large.bin + .hglf/dir/subdir2/ + .hglf/dir/subdir2/large.bin + .hglf/large + dir/ + dir/subdir/ + dir/subdir/large.bin + dir/subdir2/ + dir/subdir2/large.bin + large + large.orig + $ rm -r dir/subdir2 + +BUG: subdir should not be in the destination. This is caused by the directory +existing under .hglf/. + $ hg mv dir/subdir dir/subdir2 + moving .hglf/dir/subdir/large.bin to .hglf/dir/subdir2/subdir/large.bin (glob) + + $ hg status -C + A dir/subdir2/subdir/large.bin + dir/subdir/large.bin + R dir/subdir/large.bin + ? large.orig + + $ listtree .hglf dir* large* + .hglf/ + .hglf/dir/ + .hglf/dir/subdir2/ + .hglf/dir/subdir2/large.bin + .hglf/dir/subdir2/subdir/ + .hglf/dir/subdir2/subdir/large.bin + .hglf/large + dir/ + dir/subdir2/ + dir/subdir2/subdir/ + dir/subdir2/subdir/large.bin + large + large.orig + +Start from scratch, and rename something other than the final path component. + + $ hg up -qC . + $ hg --config extensions.purge= purge + + $ hg mv dir/subdir dir2/subdir + moving .hglf/dir/subdir/large.bin to .hglf/dir2/subdir/large.bin (glob) + + $ hg status -C + A dir2/subdir/large.bin + dir/subdir/large.bin + R dir/subdir/large.bin + + $ listtree .hglf dir* large* + .hglf/ + .hglf/dir2/ + .hglf/dir2/subdir/ + .hglf/dir2/subdir/large.bin + .hglf/large + dir2/ + dir2/subdir/ + dir2/subdir/large.bin + large + + $ hg revert --all + undeleting .hglf/dir/subdir/large.bin (glob) + forgetting .hglf/dir2/subdir/large.bin (glob) + reverting subrepo no-largefiles + + $ hg status -C + ? dir2/subdir/large.bin + + $ listtree .hglf dir* large* + .hglf/ + .hglf/dir/ + .hglf/dir/subdir/ + .hglf/dir/subdir/large.bin + .hglf/dir2/ + .hglf/dir2/subdir/ + .hglf/dir2/subdir/large.bin + .hglf/large + dir/ + dir/subdir/ + dir/subdir/large.bin + dir2/ + dir2/subdir/ + dir2/subdir/large.bin + large + + $ cd ../.. Test "pull --rebase" when rebase is enabled before largefiles (issue3861) =========================================================================