##// END OF EJS Templates
tests: remove unnecessary explicit args from `failfilemerge.py`...
tests: remove unnecessary explicit args from `failfilemerge.py` The `failfilemerge()` function always raises an exception without looking at its arguments, so let's use `*args` and `**kwargs`. Differential Revision: https://phab.mercurial-scm.org/D11854

File last commit:

r46430:21733e8c default
r49255:de8181c5 default
Show More
test-sparse-profiles.t
303 lines | 5.6 KiB | text/troff | Tads3Lexer
/ tests / test-sparse-profiles.t
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 test sparse
$ hg init myrepo
$ cd myrepo
$ cat > .hg/hgrc <<EOF
> [extensions]
> sparse=
> purge=
> strip=
> rebase=
> EOF
Gregory Szorc
sparse: require [section] in sparse config files (BC)...
r33551 Config file without [section] is rejected
$ cat > bad.sparse <<EOF
> *.html
> EOF
$ hg debugsparse --import-rules bad.sparse
abort: sparse config entry outside of section: *.html
(add an [include] or [exclude] line to declare the entry type)
[255]
$ rm bad.sparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ echo a > index.html
$ echo x > data.py
$ echo z > readme.txt
$ cat > webpage.sparse <<EOF
> # frontend sparse profile
> [include]
> *.html
> EOF
$ cat > backend.sparse <<EOF
> # backend sparse profile
> [include]
> *.py
> EOF
$ hg ci -Aqm 'initial'
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --include '*.sparse'
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289
Verify enabling a single profile works
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --enable-profile webpage.sparse
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 backend.sparse
index.html
webpage.sparse
Verify enabling two profiles works
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --enable-profile backend.sparse
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 backend.sparse
data.py
index.html
webpage.sparse
Verify disabling a profile works
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --disable-profile webpage.sparse
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 backend.sparse
data.py
webpage.sparse
Verify that a profile is updated across multiple commits
$ cat > webpage.sparse <<EOF
> # frontend sparse profile
> [include]
> *.html
> EOF
$ cat > backend.sparse <<EOF
> # backend sparse profile
> [include]
> *.py
> *.txt
> EOF
$ echo foo >> data.py
$ hg ci -m 'edit profile'
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 backend.sparse
data.py
readme.txt
webpage.sparse
$ 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 backend.sparse
data.py
webpage.sparse
$ 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 backend.sparse
data.py
readme.txt
webpage.sparse
Introduce a conflicting .hgsparse change
$ hg up -q 0
$ cat > backend.sparse <<EOF
> # Different backend sparse profile
> [include]
> *.html
> EOF
$ echo bar >> data.py
$ hg ci -qAm "edit profile other"
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 backend.sparse
index.html
webpage.sparse
Verify conflicting merge pulls in the conflicting changes
$ hg merge 1
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 backend.sparse
merging data.py
warning: conflicts while merging backend.sparse! (edit, then use 'hg resolve --mark')
warning: conflicts while merging data.py! (edit, then use 'hg resolve --mark')
0 files updated, 0 files merged, 0 files removed, 2 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]
$ rm *.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 backend.sparse
data.py
index.html
webpage.sparse
Verify resolving the merge removes the temporarily unioned files
$ cat > backend.sparse <<EOF
> # backend sparse profile
> [include]
> *.html
> *.txt
> EOF
$ hg resolve -m backend.sparse
$ cat > data.py <<EOF
> x
> foo
> bar
> EOF
$ hg resolve -m data.py
(no more unresolved files)
$ hg ci -qAm "merge profiles"
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 backend.sparse
index.html
readme.txt
webpage.sparse
$ hg cat -r . data.py
x
foo
bar
Verify stripping refreshes dirstate
$ hg strip -q -r .
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 backend.sparse
index.html
webpage.sparse
Verify rebase conflicts pulls in the conflicting changes
$ 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 backend.sparse
data.py
readme.txt
webpage.sparse
$ hg rebase -d 2
rebasing 1:a2b1de640a62 "edit profile"
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 backend.sparse
merging data.py
warning: conflicts while merging backend.sparse! (edit, then use 'hg resolve --mark')
warning: conflicts while merging data.py! (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 $ rm *.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 backend.sparse
data.py
index.html
webpage.sparse
Verify resolving conflict removes the temporary files
$ cat > backend.sparse <<EOF
> [include]
> *.html
> *.txt
> EOF
$ hg resolve -m backend.sparse
$ cat > data.py <<EOF
> x
> foo
> bar
> EOF
$ hg resolve -m data.py
(no more unresolved files)
continue: hg rebase --continue
$ hg rebase -q --continue
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 backend.sparse
index.html
readme.txt
webpage.sparse
$ hg cat -r . data.py
x
foo
bar
Test checking out a commit that does not contain the sparse profile. The
warning message can be suppressed by setting missingwarning = false in
[sparse] section of your config:
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --reset
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ hg rm *.sparse
$ hg commit -m "delete profiles"
$ hg up -q ".^"
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --enable-profile backend.sparse
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 index.html
readme.txt
$ hg up tip | grep warning
warning: sparse profile 'backend.sparse' not found in rev bfcb76de99cc - ignoring it
[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 data.py
index.html
readme.txt
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --disable-profile backend.sparse | grep warning
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 warning: sparse profile 'backend.sparse' not found in rev bfcb76de99cc - ignoring it
[1]
$ cat >> .hg/hgrc <<EOF
> [sparse]
> missingwarning = false
> EOF
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --enable-profile backend.sparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289
$ cd ..
Matt Harbison
tests: stabilize on Windows...
r33337 #if unix-permissions
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 Test file permissions changing across a sparse profile change
$ hg init sparseperm
$ cd sparseperm
$ cat > .hg/hgrc <<EOF
> [extensions]
> sparse=
> EOF
$ touch a b
$ cat > .hgsparse <<EOF
Gregory Szorc
sparse: require [section] in sparse config files (BC)...
r33551 > [include]
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 > a
> EOF
$ hg commit -Aqm 'initial'
$ chmod a+x b
$ hg commit -qm 'make executable'
$ cat >> .hgsparse <<EOF
> b
> EOF
$ hg commit -qm 'update profile'
$ hg up -q 0
Gregory Szorc
sparse: rename command to debugsparse...
r33293 $ hg debugsparse --enable-profile .hgsparse
Gregory Szorc
sparse: vendor Facebook-developed extension...
r33289 $ hg up -q 2
$ ls -l b
-rwxr-xr-x* b (glob)
Matt Harbison
tests: stabilize on Windows...
r33337 #endif