sapling/tests/test-fb-hgext-sparse-verbose-json.t
Martijn Pieters 422a95de10 sparse: provide subcommands for other common tasks
Summary: Now all commands can be subcommands. The command-line switches will be hidden in a next commit (but remain available for backwards compatibility).

Reviewed By: ryanmce

Differential Revision: D7365393

fbshipit-source-id: 29b8ed2ac6bffccda41ed3f738087dde23312a8c
2018-04-13 21:51:37 -07:00

93 lines
2.0 KiB
Perl

test sparse with --verbose and -T json
$ hg init myrepo
$ cd myrepo
$ cat > .hg/hgrc <<EOF
> [extensions]
> sparse=$TESTDIR/../hgext/fbsparse.py
> 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 and reset
$ hg up -q 0
$ hg sparse --include 'hide' -Tjson
[
{
"exclude_rules_added": 0,
"files_added": 0,
"files_conflicting": 0,
"files_dropped": 1,
"include_rules_added": 1,
"profiles_added": 0
}
]
$ hg sparse --clear-rules
$ hg sparse --include 'hide' --verbose
calculating actions for refresh
applying changes to disk (1 actions)
removing show
updating dirstate
Profile # change: 0
Include rule # change: 1
Exclude rule # change: 0
$ hg sparse reset -Tjson
[
{
"exclude_rules_added": 0,
"files_added": 1,
"files_conflicting": 0,
"files_dropped": 0,
"include_rules_added": -1,
"profiles_added": 0
}
]
$ hg sparse --include 'hide'
$ hg sparse reset --verbose
calculating actions for refresh
applying changes to disk (1 actions)
getting show
updating dirstate
Profile # change: 0
Include rule # change: -1
Exclude rule # change: 0
Verifying that problematic files still allow us to see the deltas when forcing:
$ hg sparse --include 'show*'
$ touch hide
$ hg sparse --delete 'show*' --force -Tjson
pending changes to 'hide'
[
{
"exclude_rules_added": 0,
"files_added": 0,
"files_conflicting": 1,
"files_dropped": 0,
"include_rules_added": -1,
"profiles_added": 0
}
]
$ hg sparse --include 'show*' --force
pending changes to 'hide'
$ hg sparse --delete 'show*' --force --verbose
calculating actions for refresh
verifying no pending changes in newly included files
pending changes to 'hide'
applying changes to disk (1 actions)
updating dirstate
Profile # change: 0
Include rule # change: -1
Exclude rule # change: 0