sapling/eden/hg-server/tests/test-status-terse-t.py
Durham Goode 98d9269874 server: copy hg to a new hg-server directory
Summary:
Create a fork of the Mercurial code that we can use to build server
rpms. The hg servers will continue to exist for a few more months while we move
the darkstorm and ediscovery use cases off them. In the mean time, we want to
start making breaking changes to the client, so let's create a stable copy of
the hg code to produce rpms for the hg servers.

The fork is based off c7770c78d, the latest hg release.

This copies the files as is, then adds some minor tweaks to get it to build:
- Disables some lint checks that appear to be bypassed by path
- sed replace eden/scm with eden/hg-server
- Removed a dependency on scm/telemetry from the edenfs-client tests since
  scm/telemetry pulls in the original eden/scm/lib/configparser which conflicts
  with the hg-server conflict parser.

allow-large-files

Reviewed By: quark-zju

Differential Revision: D27632557

fbshipit-source-id: b2f442f4ec000ea08e4d62de068750832198e1f4
2021-04-09 10:09:06 -07:00

195 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
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]"""