mirror of
https://github.com/facebook/sapling.git
synced 2024-12-28 23:54:12 +03:00
4f8c30b04e
Summary: These now pass Reviewed By: singhsrb Differential Revision: D19785175 fbshipit-source-id: bf92757e3fe0753e1b61ffddfd30a37fb40a642f
81 lines
1.5 KiB
Python
81 lines
1.5 KiB
Python
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from testutil.dott import feature, sh, testtmp # noqa: F401
|
|
|
|
|
|
# test sparse
|
|
|
|
sh % "hg init myrepo"
|
|
sh % "cd myrepo"
|
|
sh % "cat" << r"""
|
|
[extensions]
|
|
sparse=
|
|
rebase=
|
|
""" >> "$HGRCPATH"
|
|
|
|
sh % "echo a" > "index.html"
|
|
sh % "echo x" > "data.py"
|
|
sh % "echo z" > "readme.txt"
|
|
sh % "cat" << r"""
|
|
[include]
|
|
*.sparse
|
|
""" > "base.sparse"
|
|
sh % "hg ci -Aqm initial"
|
|
sh % "cat" << r"""
|
|
%include base.sparse
|
|
[include]
|
|
*.html
|
|
""" > "webpage.sparse"
|
|
sh % "hg ci -Aqm initial"
|
|
|
|
# Clear rules when there are includes
|
|
|
|
sh % "hg sparse --include '*.py'"
|
|
sh % "ls" == "data.py"
|
|
sh % "hg sparse --clear-rules"
|
|
sh % "ls" == r"""
|
|
base.sparse
|
|
data.py
|
|
index.html
|
|
readme.txt
|
|
webpage.sparse"""
|
|
|
|
# Clear rules when there are excludes
|
|
|
|
sh % "hg sparse --exclude '*.sparse'"
|
|
sh % "ls" == r"""
|
|
data.py
|
|
index.html
|
|
readme.txt"""
|
|
sh % "hg sparse --clear-rules"
|
|
sh % "ls" == r"""
|
|
base.sparse
|
|
data.py
|
|
index.html
|
|
readme.txt
|
|
webpage.sparse"""
|
|
|
|
# Clearing rules should not alter profiles
|
|
|
|
sh % "hg sparse --enable-profile webpage.sparse"
|
|
sh % "ls" == r"""
|
|
base.sparse
|
|
index.html
|
|
webpage.sparse"""
|
|
sh % "hg sparse --include '*.py'"
|
|
sh % "ls" == r"""
|
|
base.sparse
|
|
data.py
|
|
index.html
|
|
webpage.sparse"""
|
|
sh % "hg sparse --clear-rules"
|
|
sh % "ls" == r"""
|
|
base.sparse
|
|
index.html
|
|
webpage.sparse"""
|