Пример #1
0
sh % "hg revert -r0 a"
sh % "hg st a" == "A a"
sh % "hg rm d"
sh % "hg st d" == "R d"

# should keep d removed

sh % "hg revert -r0 d" == "no changes needed to d"
sh % "hg st d" == "R d"

sh % "hg update -C" == "1 files updated, 0 files merged, 0 files removed, 0 files unresolved"

# revert of exec bit
# ------------------

if feature.check(["execbit"]):
    sh % "chmod +x c"
    sh % "hg revert --all" == "reverting c"

    sh % "test -x c" == "[1]"

    sh % "chmod +x c"
    sh % "hg commit -m exe"

    sh % "chmod -x c"
    sh % "hg revert --all" == "reverting c"

    sh % "test -x c"
    sh % "echo executable" == "executable"

Пример #2
0
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.

from __future__ import absolute_import

from testutil.dott import feature, sh

exist_dirs = ["a", "a/b", "a/b/c", "a/b/d", "b/c/", "b/d"]
non_exist_dirs = ["m", "m/n", "a/b/m", "b/m/", "b/m/n"]
all_dirs = " ".join(non_exist_dirs + exist_dirs)

for testcase in ["flat", "tree"]:

    sh % "cd $TESTTMP"

    if feature.check(["flat"]):
        sh % "setconfig 'extensions.treemanifest=!'"

    if feature.check(["tree"]):
        sh % "setconfig 'extensions.treemanifest='"

    sh % "newrepo"

    for d in exist_dirs:
        sh % ("mkdir -p %s" % d)
        sh % ("touch %s/x" % d)

    sh % "hg commit -Aqm init"

    sh % ("hg debugdirs %s" % all_dirs) == "\n".join(exist_dirs)
Пример #3
0
# Ensure the repo is as we hope
sh % "hg parents -T '{node|short}'" == "c2e78cacc5ac"
sh % "hg heads -q" == "201e9c39b40b"
sh % "hg status -C" == r"""
    A b.rename/b
      b/b
    A c.copy
      c
    A foo/foo
    R b/b
    ? a/a.orig"""

# There should be no shelves left
sh % "hg shelve -l"

if feature.check(["execbit"]):
    # Ensure that metadata-only changes are shelved
    os.chmod("a/a", 0o777)
    sh % "hg shelve -q -n execbit a/a"
    sh % "hg status a/a"
    sh % "hg unshelve -q execbit"
    sh % "hg status a/a" == "M a/a"
    sh % "hg revert a/a"

if feature.check(["symlink"]):
    # Ensure symlinks are properly handled
    sh % "rm a/a"
    sh % "ln -s foo a/a"
    sh % "hg shelve -q -n symlink a/a"
    sh % "hg status a/a"
    sh % "hg unshelve -q symlink"
Пример #4
0
# GNU General Public License version 2 or any later version.

from __future__ import absolute_import

from testutil.dott import feature, sh, testtmp  # noqa: F401

feature.require(["py2"])

feature.require(["no-windows", "no-osx"])

# Test that trying to add invalid utf8 files to the repository will fail.

sh % "hg init"
open("\x9d\xc8\xac\xde\xa1\xee", "w").write("test")

sh % "hg status" == "skipping invalid utf-8 filename: '\x9d\xc8\xac\xde\xa1\xee'"

# fsmonitor ignores the file once, so it has slightly different output from here
if feature.check("fsmonitor"):
    sh % "hg addremove" == ''
    sh % "hg commit -m 'adding a filename that is invalid utf8'" == r"""
        nothing changed
        [1]"""
else:
    sh % "hg addremove" == "skipping invalid utf-8 filename: '\x9d\xc8\xac\xde\xa1\xee'"
    sh % "hg commit -m 'adding a filename that is invalid utf8'" == """
        skipping invalid utf-8 filename: '\x9d\xc8\xac\xde\xa1\xee'
        skipping invalid utf-8 filename: '\x9d\xc8\xac\xde\xa1\xee'
        nothing changed
        [1]"""
Пример #5
0
                   details

    (some details hidden, use --verbose to show complete help)"""

open("c", "wb").write(bytearray([0, 1, 2, 10]))

sh % "hg commit -A c -m 'c is a binary file'"
sh % "echo c" >> "c"

sh % "cat b" == r"""
    b line 1
    b line 2
"""
sh % "cat" << "b line 1\nINS\nb line 2\n" > "b"

if feature.check(["py2"]):
    sh % "echo END" >> "b"
    sh % "hg rm a"
    sh % "echo y" | "hg amend --correlated --config 'ui.interactive=1'" == r"""
        showing changes for b
                @@ -1,0 +1,1 @@
                +INS
                @@ -2,0 +3,1 @@
        a478955 +END

        1 changeset affected
        a478955 commit b 2
        apply changes (yn)?  y
        1 of 2 chunks applied

        # changes not applied and left in working directory:
Пример #6
0
[simplecache]
showdebug=true
cachedir=$TESTTMP/hgsimplecache
""" > ".hg/hgrc"

# Test integration with simplecache for profile reads

sh % "printf '[include]\\nfoo\\n.gitignore\\n'" > ".hgsparse"
sh % "hg add .hgsparse"
sh % "hg commit -qm 'Add profile'"
sh % "hg sparse --enable-profile .hgsparse"
sh % "hg status --debug" == r"""
    got value for key sparseprofile:.hgsparse:090ca0df22bcfedb0d8c8cb8c66865529e714404:v2 from local
    got value for key sparseprofile:.hgsparse:090ca0df22bcfedb0d8c8cb8c66865529e714404:v2 from local"""

if feature.check(["fsmonitor"]):
    # Test fsmonitor integration (if available)

    sh % "touch .watchmanconfig"
    sh % "echo ignoredir1" >> ".gitignore"
    sh % "hg commit -Am ignoredir1" == "adding .gitignore"
    sh % "echo ignoredir2" >> ".gitignore"
    sh % "hg commit -m ignoredir2"

    sh % "hg sparse reset"
    sh % "hg sparse -I ignoredir1 -I ignoredir2 -I dir1 -I .gitignore"

    sh % "mkdir ignoredir1 ignoredir2 dir1"
    sh % "touch ignoredir1/file ignoredir2/file dir1/file"

    # Run status twice to compensate for a condition in fsmonitor where it will check
Пример #7
0
#
# 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


feature.require(["symlink"])

for testcase in ["v0", "v1", "v2"]:

    sh % "cd $TESTTMP"

    if feature.check(["v0"]):
        sh % "setconfig 'format.dirstate=0'"

    if feature.check(["v1"]):
        sh % "setconfig 'format.dirstate=1'"

    if feature.check(["v2"]):
        sh % "setconfig 'format.dirstate=2'"

    sh % "newrepo"
    sh % "mkdir a b"
    sh % "touch a/x"

    sh % "hg ci -m init -A a/x"

    # Replace the directory with a symlink