sapling/eden/scm/tests/test-locate-t.py
Xavier Deguillard e0e01cbc81 bundle2: backout D19656773
Summary: This broke a bunch of tests. Revert it and re-enable all the tests.

Reviewed By: DurhamG

Differential Revision: D19665042

fbshipit-source-id: c3c17e3ac7e2ea028be5b5836bc8349cdf56184e
2020-01-31 10:48:19 -08:00

165 lines
2.8 KiB
Python

# Portions 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.
# Copyright (c) Mercurial Contributors.
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
sh % "setconfig 'extensions.treemanifest=!'"
sh % "hg init repo"
sh % "cd repo"
sh % "echo 0" > "a"
sh % "echo 0" > "b"
sh % "echo 0" > "t.h"
sh % "mkdir t"
sh % "echo 0" > "t/x"
sh % "echo 0" > "t/b"
sh % "echo 0" > "t/e.h"
sh % "mkdir dir.h"
sh % "echo 0" > "dir.h/foo"
sh % "hg ci -A -m m" == r"""
adding a
adding b
adding dir.h/foo
adding t.h
adding t/b
adding t/e.h
adding t/x"""
sh % "touch nottracked"
sh % "hg locate a" == "a"
sh % "hg locate NONEXISTENT" == "[1]"
sh % "hg locate" == r"""
a
b
dir.h/foo
t.h
t/b
t/e.h
t/x"""
sh % "hg rm a"
sh % "hg ci -m m"
sh % "hg locate a" == "[1]"
sh % "hg locate NONEXISTENT" == "[1]"
sh % "hg locate 'relpath:NONEXISTENT'" == "[1]"
sh % "hg locate" == r"""
b
dir.h/foo
t.h
t/b
t/e.h
t/x"""
sh % "hg locate -r 0 a" == "a"
sh % "hg locate -r 0 NONEXISTENT" == "[1]"
sh % "hg locate -r 0 'relpath:NONEXISTENT'" == "[1]"
sh % "hg locate -r 0" == r"""
a
b
dir.h/foo
t.h
t/b
t/e.h
t/x"""
# -I/-X with relative path should work:
sh % "cd t"
sh % "hg locate" == r"""
b
dir.h/foo
t.h
t/b
t/e.h
t/x"""
sh % "hg locate -I ../t" == r"""
t/b
t/e.h
t/x"""
# Issue294: hg remove --after dir fails when dir.* also exists
sh % "cd .."
sh % "rm -r t"
sh % "hg rm t/b"
sh % "hg locate 't/**'" == r"""
t/b
t/e.h
t/x"""
sh % "hg files" == r"""
b
dir.h/foo
t.h
t/e.h
t/x"""
sh % "hg files b" == "b"
sh % "mkdir otherdir"
sh % "cd otherdir"
sh % "hg files 'path:'" == r"""
../b
../dir.h/foo
../t.h
../t/e.h
../t/x"""
sh % "hg files 'path:.'" == r"""
../b
../dir.h/foo
../t.h
../t/e.h
../t/x"""
sh % "hg locate b" == r"""
../b
../t/b"""
sh % "hg locate '*.h'" == r"""
../t.h
../t/e.h"""
sh % "hg locate 'path:t/x'" == "../t/x"
sh % "hg locate 're:.*\\.h$'" == r"""
../t.h
../t/e.h"""
sh % "hg locate -r 0 b" == r"""
../b
../t/b"""
sh % "hg locate -r 0 '*.h'" == r"""
../t.h
../t/e.h"""
sh % "hg locate -r 0 'path:t/x'" == "../t/x"
sh % "hg locate -r 0 're:.*\\.h$'" == r"""
../t.h
../t/e.h"""
sh % "hg files" == r"""
../b
../dir.h/foo
../t.h
../t/e.h
../t/x"""
sh % "hg files ." == "[1]"
# Convert native path separator to slash (issue5572)
sh % "hg files -T '{path|slashpath}\\n'" == r"""
../b
../dir.h/foo
../t.h
../t/e.h
../t/x"""
sh % "cd ../.."