##// END OF EJS Templates
revlog: subclass the new `repository.iverifyproblem` Protocol class...
revlog: subclass the new `repository.iverifyproblem` Protocol class This is the same transformation as 3a90a6fd710d did for dirstate, but the CamelCase naming was already cleaned up here. We shouldn't have to explicitly subclass, but I'm doing so to test the interplay of regular attributes and the `attrs` class. Also, PyCharm has a nifty feature that puts a jump point in the gutter to navigate back and forth between the base class and subclasses (and override functions and base class functions) when there's an explicit subclassing. Additionally, PyCharm will immediately flag signature mismatches without a 40m pytype run.

File last commit:

r52843:93a533fa default
r53365:4ef6dbc2 default
Show More
test-sparse.t
465 lines | 10.0 KiB | text/troff | Tads3Lexer
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 test sparse
$ hg init myrepo
$ cd myrepo
$ cat > .hg/hgrc <<EOF
> [extensions]
> sparse=
> strip=
> EOF
$ echo a > show
$ echo x > hide
$ hg ci -Aqm 'initial'
$ echo b > show
$ echo y > hide
$ echo aa > show2
$ echo xx > hide2
$ hg ci -Aqm 'two'
Verify basic --include
$ hg up -q 0
Arseniy Alekseyev
rhg: fix the bug where sparse config is interpreted as relglob instead of glob...
r51714
Test that sparse pattern by default is interpreted as "glob:", and is interpreted relative to the root.
$ hg debugsparse --reset
$ hg debugsparse -X 'foo*bar'
$ cat .hg/sparse
[exclude]
foo*bar
$ mk() { mkdir -p "$1"; touch "$1"/"$2"; }
$ mk 'foo' bar
$ mk 'foo-bar' x
$ mk 'unanchoredfoo-bar' x
Matt Harbison
tests: stabilize `test-sparse.t` on Windows...
r52843 #if no-windows
Arseniy Alekseyev
rhg: fix the bug where sparse config is interpreted as relglob instead of glob...
r51714 $ mk 'foo*bar' x
Matt Harbison
tests: stabilize `test-sparse.t` on Windows...
r52843 #endif
Arseniy Alekseyev
rhg: fix the bug where sparse config is interpreted as relglob instead of glob...
r51714 $ mk 'dir/foo-bar' x
$ hg status --config rhg.on-unsupported=abort
? dir/foo-bar/x
? foo/bar
? unanchoredfoo-bar/x
$ hg clean -a --no-confirm
$ rm -r foo*bar
$ hg debugsparse --reset
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --include 'hide'
Joerg Sonnenberger
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems...
r45218 $ ls -A
.hg
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 hide
Absolute paths outside the repo should just be rejected
Matt Harbison
tests: stabilize on Windows...
r33337 #if no-windows
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --include /foo/bar
Kostia Balytskyi
sparse: properly error out when absolute paths are used...
r33646 abort: paths cannot be absolute
[255]
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --include '/root'
Kostia Balytskyi
sparse: properly error out when absolute paths are used...
r33646 abort: paths cannot be absolute
[255]
Matt Harbison
tests: stabilize on Windows...
r33337 #else
TODO: See if this can be made to fail the same way as on Unix
$ hg debugsparse --include /c/foo/bar
Kostia Balytskyi
sparse: properly error out when absolute paths are used...
r33646 abort: paths cannot be absolute
Matt Harbison
tests: stabilize on Windows...
r33337 [255]
$ hg debugsparse --include '$TESTTMP/myrepo/hide'
$ hg debugsparse --include '/c/root'
Kostia Balytskyi
sparse: properly error out when absolute paths are used...
r33646 abort: paths cannot be absolute
Matt Harbison
tests: stabilize on Windows...
r33337 [255]
#endif
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289
Kostia Balytskyi
sparse: treat paths as cwd-relative...
r33648 Paths should be treated as cwd-relative, not repo-root-relative
$ mkdir subdir && cd subdir
$ hg debugsparse --include path
$ hg debugsparse
[include]
$TESTTMP/myrepo/hide
hide
Matt Harbison
test-sparse: drop unnecessary globs
r33792 subdir/path
Kostia Balytskyi
sparse: treat paths as cwd-relative...
r33648
$ cd ..
$ echo hello > subdir/file2.ext
$ cd subdir
$ hg debugsparse --include '**.ext' # let us test globs
$ hg debugsparse --include 'path:abspath' # and a path: pattern
$ cd ..
$ hg debugsparse
[include]
$TESTTMP/myrepo/hide
hide
path:abspath
subdir/**.ext
Matt Harbison
test-sparse: drop unnecessary globs
r33792 subdir/path
Kostia Balytskyi
sparse: treat paths as cwd-relative...
r33648
$ rm -rf subdir
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 Verify commiting while sparse includes other files
$ echo z > hide
$ hg ci -Aqm 'edit hide'
Joerg Sonnenberger
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems...
r45218 $ ls -A
.hg
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 hide
$ hg manifest
hide
show
Verify --reset brings files back
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --reset
Joerg Sonnenberger
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems...
r45218 $ ls -A
.hg
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 hide
show
$ cat hide
z
$ cat show
a
Gregory Szorc
sparse: rename command to debugsparse...
r33293 Verify 'hg debugsparse' default output
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289
$ hg up -q null
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --include 'show*'
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [include]
show*
Verify update only writes included files
$ hg up -q 0
Joerg Sonnenberger
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems...
r45218 $ ls -A
.hg
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 show
$ hg up -q 1
Joerg Sonnenberger
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems...
r45218 $ ls -A
.hg
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 show
show2
Verify status only shows included files
$ touch hide
$ touch hide3
$ echo c > show
$ hg status
M show
Adding an excluded file should fail
$ hg add hide3
abort: cannot add 'hide3' - it is outside the sparse checkout
Gregory Szorc
sparse: rename command to debugsparse...
r33293 (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [255]
Yuya Nishihara
dirstate: drop explicit files that shouldn't match (BC) (issue4679)...
r36218 But adding a truly excluded file shouldn't count
$ hg add hide3 -X hide3
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 Verify deleting sparseness while a file has changes fails
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --delete 'show*'
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 pending changes to 'hide'
abort: cannot change sparseness due to pending changes (delete the files or use --force to bring them back dirty)
[255]
Verify deleting sparseness with --force brings back files
Valentin Gatien-Baron
sparse: rework debugsparse's interface...
r49588 $ hg debugsparse -f --delete 'show*'
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 pending changes to 'hide'
Joerg Sonnenberger
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems...
r45218 $ ls -A
.hg
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 hide
hide2
hide3
show
show2
$ hg st
M hide
M show
? hide3
Verify editing sparseness fails if pending changes
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --include 'show*'
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 pending changes to 'hide'
abort: could not update sparseness due to pending changes
[255]
Verify adding sparseness hides files
Valentin Gatien-Baron
sparse: rework debugsparse's interface...
r49588 $ hg debugsparse -f --exclude 'hide*'
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 pending changes to 'hide'
Joerg Sonnenberger
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems...
r45218 $ ls -A
.hg
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 hide
hide3
show
show2
$ hg st
M show
$ hg up -qC .
Martin von Zweigbergk
sparse: override dirstate.walk() instead of dirstate._ignore...
r33496 TODO: add an option to purge to also purge files outside the sparse config?
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ hg purge --all --config extensions.purge=
Joerg Sonnenberger
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems...
r45218 $ ls -A
.hg
Martin von Zweigbergk
sparse: override dirstate.walk() instead of dirstate._ignore...
r33496 hide
hide3
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 show
show2
Martin von Zweigbergk
sparse: override dirstate.walk() instead of dirstate._ignore...
r33496 For now, manually remove the files
$ rm hide hide3
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289
Verify rebase temporarily includes excluded files
$ hg rebase -d 1 -r 2 --config extensions.rebase=
Martin von Zweigbergk
rebase: change and standarize template for rebase's one-line summary...
r46356 rebasing 2:b91df4f39e75 tip "edit hide"
Pulkit Goyal
sparse: add local files to temporaryfiles if they exist out of sparse...
r39563 temporarily included 2 file(s) in the sparse checkout for merging
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 merging hide
warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
Daniel Ploch
error: unify the error message formats for 'rebase' and 'unshelve'...
r45710 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
Martin von Zweigbergk
errors: add config that lets user get more detailed exit codes...
r46430 [240]
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [exclude]
hide*
Temporarily Included Files (for merge/rebase):
hide
$ cat hide
Martin von Zweigbergk
merge: set custom conflict label for base commit...
r49435 <<<<<<< dest: 39278f7c08a9 - test: two
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 y
=======
z
Martin von Zweigbergk
merge: set custom conflict label for base commit...
r49435 >>>>>>> source: b91df4f39e75 - test: edit hide
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289
Verify aborting a rebase cleans up temporary files
$ hg rebase --abort --config extensions.rebase=
cleaned up 1 temporarily added file(s) from the sparse checkout
rebase aborted
$ rm hide.orig
Joerg Sonnenberger
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems...
r45218 $ ls -A
.hg
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 show
show2
Verify merge fails if merging excluded files
$ hg up -q 1
$ hg merge -r 2
Pulkit Goyal
sparse: add local files to temporaryfiles if they exist out of sparse...
r39563 temporarily included 2 file(s) in the sparse checkout for merging
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 merging hide
warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
Pulkit Goyal
merge: add `--abort` flag which can abort the merge...
r35722 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [1]
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [exclude]
hide*
Temporarily Included Files (for merge/rebase):
hide
$ hg up -C .
cleaned up 1 temporarily added file(s) from the sparse checkout
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [exclude]
hide*
Valentin Gatien-Baron
sparse: rework debugsparse's interface...
r49588 Multiple -I and -X can be passed at once
$ hg debugsparse --reset -I '*2' -X 'hide2'
$ ls -A
.hg
hide.orig
show2
$ hg debugsparse --reset -X 'hide*'
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 Verify strip -k resets dirstate correctly
$ hg status
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [exclude]
hide*
$ hg log -r . -T '{rev}\n' --stat
1
hide | 2 +-
hide2 | 1 +
show | 2 +-
show2 | 1 +
4 files changed, 4 insertions(+), 2 deletions(-)
$ hg strip -r . -k
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/39278f7c08a9-ce59e002-backup.hg
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ hg status
M show
? show2
Verify rebase succeeds if all changed files are in sparse checkout
$ hg commit -Aqm "add show2"
$ hg rebase -d 1 --config extensions.rebase=
Martin von Zweigbergk
rebase: change and standarize template for rebase's one-line summary...
r46356 rebasing 2:bdde55290160 tip "add show2"
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/bdde55290160-216ed9c6-rebase.hg
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289
Verify log --sparse only shows commits that affect the sparse checkout
$ hg log -T '{rev} '
2 1 0 (no-eol)
$ hg log --sparse -T '{rev} '
2 0 (no-eol)
Test status on a file in a subdir
$ mkdir -p dir1/dir2
$ touch dir1/dir2/file
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse -I dir1/dir2
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ hg status
? dir1/dir2/file
Hollis Blanchard
sparse: --include 'dir1/dir2' should not include 'dir1/*'...
r35760 Mix files and subdirectories, both "glob:" and unprefixed
$ hg debugsparse --reset
$ touch dir1/notshown
$ hg commit -A dir1/notshown -m "notshown"
$ hg debugsparse --include 'dir1/dir2'
Mads Kiilerich
tests: use grep -E instead of obsolescent egrep...
r51618 $ "$PYTHON" $TESTDIR/list-tree.py . | grep -E -v '\.[\/]\.hg'
Hollis Blanchard
sparse: --include 'dir1/dir2' should not include 'dir1/*'...
r35760 ./
./dir1/
./dir1/dir2/
./dir1/dir2/file
./hide.orig
$ hg debugsparse --delete 'dir1/dir2'
$ hg debugsparse --include 'glob:dir1/dir2'
Mads Kiilerich
tests: use grep -E instead of obsolescent egrep...
r51618 $ "$PYTHON" $TESTDIR/list-tree.py . | grep -E -v '\.[\/]\.hg'
Hollis Blanchard
sparse: --include 'dir1/dir2' should not include 'dir1/*'...
r35760 ./
./dir1/
./dir1/dir2/
./dir1/dir2/file
./hide.orig
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 Test that add -s adds dirs to sparse profile
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --reset
$ hg debugsparse --include empty
$ hg debugsparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [include]
empty
$ mkdir add
$ touch add/foo
$ touch add/bar
$ hg add add/foo
abort: cannot add 'add/foo' - it is outside the sparse checkout
Gregory Szorc
sparse: rename command to debugsparse...
r33293 (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [255]
$ hg add -s add/foo
$ hg st
A add/foo
? add/bar
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [include]
add
empty
$ hg add -s add/*
add/foo already tracked!
$ hg st
A add/bar
A add/foo
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 [include]
add
empty
$ cd ..
Test non-sparse repos work while sparse is loaded
$ hg init sparserepo
$ hg init nonsparserepo
$ cd sparserepo
$ cat > .hg/hgrc <<EOF
> [extensions]
> sparse=
> EOF
$ cd ../nonsparserepo
$ echo x > x && hg add x && hg commit -qAm x
$ cd ../sparserepo
$ hg clone ../nonsparserepo ../nonsparserepo2
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Test debugrebuilddirstate
$ cd ../sparserepo
$ touch included
$ touch excluded
$ hg add included excluded
$ hg commit -m 'a commit' -q
$ cp .hg/dirstate ../dirstateboth
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse -X excluded
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ cp ../dirstateboth .hg/dirstate
$ hg debugrebuilddirstate
$ hg debugdirstate
n 0 -1 unset included
Test debugdirstate --minimal where file is in the parent manifest but not the
dirstate
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse -X included
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ hg debugdirstate
$ cp .hg/dirstate ../dirstateallexcluded
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --reset
$ hg debugsparse -X excluded
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ cp ../dirstateallexcluded .hg/dirstate
$ touch includedadded
$ hg add includedadded
Martin von Zweigbergk
debugdirstate: deprecate --nodates in favor of --no-dates...
r39796 $ hg debugdirstate --no-dates
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 a 0 -1 unset includedadded
$ hg debugrebuilddirstate --minimal
Martin von Zweigbergk
debugdirstate: deprecate --nodates in favor of --no-dates...
r39796 $ hg debugdirstate --no-dates
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 n 0 -1 unset included
a 0 -1 * includedadded (glob)
Test debugdirstate --minimal where a file is not in parent manifest
but in the dirstate. This should take into account excluded files in the
manifest
$ cp ../dirstateboth .hg/dirstate
$ touch includedadded
$ hg add includedadded
$ touch excludednomanifest
$ hg add excludednomanifest
$ cp .hg/dirstate ../moreexcluded
$ hg forget excludednomanifest
$ rm excludednomanifest
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse -X excludednomanifest
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ cp ../moreexcluded .hg/dirstate
$ hg manifest
excluded
included
We have files in the dirstate that are included and excluded. Some are in the
manifest and some are not.
Martin von Zweigbergk
debugdirstate: deprecate --nodates in favor of --no-dates...
r39796 $ hg debugdirstate --no-dates
sparse: apply update with in a `parentchange` context...
r48508 n * excluded (glob)
a * excludednomanifest (glob)
n * included (glob)
a * includedadded (glob)
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ hg debugrebuilddirstate --minimal
Martin von Zweigbergk
debugdirstate: deprecate --nodates in favor of --no-dates...
r39796 $ hg debugdirstate --no-dates
sparse: apply update with in a `parentchange` context...
r48508 n * included (glob)
a * includedadded (glob)
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289