sapling/tests/test-treestate-downgrade.t
Jun Wu ef31cb9a4b treestate: filter nonnormalset etc when downgrade
Summary:
Treestate tracks untracked files while treedirstate doesn't. The
treedirstate importmap logic changed by D7912557 will remove untracked files
from the tree. But it missed other places like nonnormalset, otherparentset
and copymap. This patch changes it to make sure paths in those sets are
tracked.

Reviewed By: DurhamG

Differential Revision: D8560022

fbshipit-source-id: 8ac39bfe634804ea94125fe42e11382acae35d94
2018-06-22 13:20:49 -07:00

48 lines
1.2 KiB
Perl

#require fsmonitor
Fsmonitor is required for treestate to track untracked files.
Nonnormalset, otherparentset, copymap might have reference to untracked files.
They should be filtered out when downgrading from treestate to treedirstate.
Create a treestate repo
$ hg init repo1 --config format.dirstate=2
$ cd repo1
$ touch x
Write the untracked file to treestate
$ hg status
? x
$ hg debugtree
dirstate v2 (* 1 files tracked) (glob)
Downgrade to treedirstate
$ hg debugtree v1
Check nonnormalset
$ hg debugshell --command 'print(repr(sorted(repo.dirstate._map.nonnormalset)))'
[]
Check downgrade with "hg pull"
$ hg init $TESTTMP/repo2 --config format.dirstate=2
$ cd $TESTTMP/repo2
$ touch x
$ hg ci -m init -A x -q
$ hg init $TESTTMP/repo3 --config format.dirstate=2
$ cd $TESTTMP/repo3
$ hg pull ../repo2 --config format.dirstate=1 --config treedirstate.migrateonpull=1 --config extensions.rebase= --rebase -q
fsmonitor state is invalidated after upgrade
$ ls .hg/fsmonitor.state
.hg/fsmonitor.state
$ hg pull ../repo2 --config format.dirstate=2 --config treedirstate.migrateonpull=1 --config extensions.rebase= --rebase -q
$ [ -f .hg/fsmonitor.state ]
[1]