sapling/eden/scm/tests/test-status-terse-t.py
Zeyi (Rice) Fan 92f6f35e7a mark all tests requiring Python 2
Summary:
This diff marks **ALL** mercurial tests requiring Python 2 feature.

After you fixes some tests, simply remove the `py2` feature requirement and that tests will be continuously run after your diff is landed.

To bypass this feature requirement, run the tests command with `HGTEST_FORCE_PY2=1`. For example:

```
HGTEST_FORCE_PY2=1 buck test //eden/scm/tests:hg_run_tests
```

or

```
HGTEST_FORCE_PY2=1 python run-tests.py
```

----

Basically this diff are created with the following commands:

```
$ sed -i 's/import feature\(.*\)$/import feature\1\n\nfeature.require(["py2"])/' test-*-t.py
$ sed -i '1s/^/#require py2\n/' test-*.t
$ ls | grep -P "^test.*(?<\!-t)\.py$" > list && vim -p $(cat list)
# manually adding feature requires for these Python tests.
```

(Note: this ignores all push blocking failures!)

ignore-conflict-markers

Reviewed By: singhsrb

Differential Revision: D19655148

fbshipit-source-id: 985e3ccb4010cc559049f1d89f8909bc2d9b5e20
2020-01-30 18:49:21 -08:00

198 lines
3.3 KiB
Python

# Copyright (c) Facebook, Inc. and its 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(["py2"])
sh % "mkdir folder"
sh % "cd folder"
sh % "hg init"
sh % "mkdir x x/l x/m x/n x/l/u x/l/u/a"
sh % "touch a b x/aa.o x/bb.o"
sh % "hg status" == r"""
? a
? b
? x/aa.o
? x/bb.o"""
sh % "hg status --terse u" == r"""
? a
? b
? x/"""
sh % "hg status --terse maudric" == r"""
? a
? b
? x/"""
sh % "hg status --terse madric" == r"""
? a
? b
? x/aa.o
? x/bb.o"""
sh % "hg status --terse f" == r"""
abort: 'f' not recognized
[255]"""
# Add a .gitignore so that we can also have ignored files
sh % "echo '*\\.o'" > ".gitignore"
sh % "hg status" == r"""
? .gitignore
? a
? b"""
sh % "hg status -i" == r"""
I x/aa.o
I x/bb.o"""
# Tersing ignored files
sh % "hg status -t i --ignored" == "I x/"
# Adding more files
sh % "mkdir y"
sh % "touch x/aa x/bb y/l y/m y/l.o y/m.o"
sh % "touch x/l/aa x/m/aa x/n/aa x/l/u/bb x/l/u/a/bb"
sh % "hg status" == r"""
? .gitignore
? a
? b
? x/aa
? x/bb
? x/l/aa
? x/l/u/a/bb
? x/l/u/bb
? x/m/aa
? x/n/aa
? y/l
? y/m"""
sh % "hg status --terse u" == r"""
? .gitignore
? a
? b
? x/
? y/"""
sh % "hg add x/aa x/bb .gitignore"
sh % "hg status --terse au" == r"""
A .gitignore
A x/aa
A x/bb
? a
? b
? x/l/
? x/m/
? x/n/
? y/"""
# Including ignored files
sh % "hg status --terse aui" == r"""
A .gitignore
A x/aa
A x/bb
? a
? b
? x/l/
? x/m/
? x/n/
? y/l
? y/m"""
sh % "hg status --terse au -i" == r"""
I x/aa.o
I x/bb.o
I y/l.o
I y/m.o"""
# Committing some of the files
sh % "hg commit x/aa x/bb .gitignore -m 'First commit'"
sh % "hg status" == r"""
? a
? b
? x/l/aa
? x/l/u/a/bb
? x/l/u/bb
? x/m/aa
? x/n/aa
? y/l
? y/m"""
sh % "hg status --terse mardu" == r"""
? a
? b
? x/l/
? x/m/
? x/n/
? y/"""
# Modifying already committed files
sh % "echo Hello" >> "x/aa"
sh % "echo World" >> "x/bb"
sh % "hg status --terse maurdc" == r"""
M x/aa
M x/bb
? a
? b
? x/l/
? x/m/
? x/n/
? y/"""
# Respecting other flags
sh % "hg status --terse marduic --all" == r"""
M x/aa
M x/bb
? a
? b
? x/l/
? x/m/
? x/n/
? y/l
? y/m
I x/aa.o
I x/bb.o
I y/l.o
I y/m.o
C .gitignore"""
sh % "hg status --terse marduic -a"
sh % "hg status --terse marduic -c" == "C .gitignore"
sh % "hg status --terse marduic -m" == r"""
M x/aa
M x/bb"""
# Passing 'i' in terse value will consider the ignored files while tersing
sh % "hg status --terse marduic -u" == r"""
? a
? b
? x/l/
? x/m/
? x/n/
? y/l
? y/m"""
# Omitting 'i' in terse value does not consider ignored files while tersing
sh % "hg status --terse marduc -u" == r"""
? a
? b
? x/l/
? x/m/
? x/n/
? y/"""
# Trying with --rev
sh % "hg status --terse marduic --rev 0 --rev 1" == r"""
abort: cannot use --terse with --rev
[255]"""