# 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

feature.require(["py2"])

# Load extensions

sh % "cat" << r"""
[extensions]
arcconfig=$TESTDIR/../edenscm/hgext/extlib/phabricator/arcconfig.py
arcdiff=
""" >> "$HGRCPATH"

# Diff with no revision

sh % "hg init repo"
sh % "cd repo"
sh % "touch foo"
sh % "hg add foo"
sh % "hg ci -qm 'No rev'"
sh % "hg diff --since-last-submit" == r"""
    abort: local changeset is not associated with a differential revision
    [255]"""

sh % "hg log -r 'lastsubmitted(.)' -T '{node} {desc}\\n'" == r"""
Exemplo n.º 2
0
# 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

feature.require(["symlink"])

sh % "mkdir -p a"
sh % "ln -s a/b a/c"
sh % "hg debugshell -c 'm.util.makedirs(\"a/c/e/f\")'" == r"""
    abort: Symlink '$TESTTMP/a/c' points to non-existed destination 'a/b' during makedir: $TESTTMP/a/c/e
    [255]"""
Exemplo n.º 3
0
# 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

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

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

sh % "hg init"
open("invalid\x80utf8", "w").write("test")
sh % "hg addremove" == "adding invalid\\x80utf8 (esc)"
sh % "hg commit -m 'adding a filename that is invalid utf8'" == r"""
    abort: invalid file name encoding: invalid\x80utf8! (esc)
    [255]"""
# 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


feature.require(["no-icasefs"])

sh % "newrepo"
sh % "mkdir -p dirA/SUBDIRA dirA/subdirA dirB dirA/mixed DIRB"
sh % "touch dirA/SUBDIRA/file1 dirA/subdirA/file2 dirA/mixed/file3 dirA/Mixed dirA/MIXED dirB/file4 dirB/FILE4 DIRB/File4"
sh % "hg commit -Aqm base"

# Check for all collisions
sh % "hg debugexistingcasecollisions" == r"""
    <root> contains collisions: DIRB, dirB
    "dirA" contains collisions: MIXED, Mixed, mixed
    "dirA" contains collisions: SUBDIRA, subdirA
    "dirB" contains collisions: FILE4, file4"""

# Check for collisions in a directory
sh % "hg debugexistingcasecollisions dirB" == '"dirB" contains collisions: FILE4, file4'
Exemplo n.º 5
0
# 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.

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

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


def test_nested_lock():
    from edenscm.mercurial import hg, ui as uimod

    ui = uimod.ui.load()
    repo1 = hg.repository(ui, testtmp.TESTTMP, create=True)
    repo2 = hg.repository(ui, testtmp.TESTTMP)
    # repo2.lock() should detect deadlock.
    try:
        with repo1.lock(), repo2.lock(wait=False):
            pass
    except Exception as ex:
        msg = str(ex)
        assert "deadlock" in msg


test_nested_lock()
Exemplo n.º 6
0
# Copyright (c) Meta Platforms, Inc. and affiliates.
# Copyright (c) Mercurial Contributors.
#
# 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(["no-fsmonitor"])

sh % "hg init a"
sh % "cd a"
sh % "hg init b"
sh % "echo x" > "b/x"

# Should print nothing:

sh % "hg add b"
sh % "hg st"

sh % "echo y" > "b/y"
sh % "hg st"

# Should fail:

sh % "hg st b/x" == r"""
    abort: path 'b/x' is inside nested repo 'b'
    [255]"""
sh % "hg add b/x" == r"""
Exemplo n.º 7
0
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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, testtmp  # noqa: F401

feature.require(["killdaemons"])

sh % "enable share"

# prepare repo1

sh % "newrepo"
sh % "echo a" > "a"
sh % "hg commit -A -q -m init"

# make a bundle we will use later

sh % "cd .."
sh % "hg -R repo1 bundle -q -a testbundle.hg"

# share it without bookmarks

sh % "hg share repo1 repo2" == r"""
    updating working directory
    1 files updated, 0 files merged, 0 files removed, 0 files unresolved"""

# share it with bookmarks