sapling/eden/hg-server/tests/test-addremove-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

109 lines
2.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 % "hg init rep"
sh % "cd rep"
sh % "mkdir dir"
sh % "touch foo dir/bar"
sh % "hg -v addremove" == r"""
adding dir/bar
adding foo"""
sh % "hg -v commit -m 'add 1'" == r"""
committing files:
dir/bar
foo
committing manifest
committing changelog
committed 6f7f953567a2"""
sh % "cd dir/"
sh % "touch ../foo_2 bar_2"
sh % "hg -v addremove" == r"""
adding dir/bar_2
adding foo_2"""
sh % "hg -v commit -m 'add 2'" == r"""
committing files:
dir/bar_2
foo_2
committing manifest
committing changelog
committed e65414bf35c5"""
sh % "cd .."
sh % "hg forget foo"
sh % "hg -v addremove" == "adding foo"
sh % "hg forget foo"
sh % "hg -v addremove nonexistent" == r"""
nonexistent: $ENOENT$
[1]"""
sh % "cd .."
sh % "hg init subdir"
sh % "cd subdir"
sh % "mkdir dir"
sh % "cd dir"
sh % "touch a.py"
sh % "hg addremove 'glob:*.py'" == "adding a.py"
sh % "hg forget a.py"
sh % "hg addremove -I 'glob:*.py'" == "adding a.py"
sh % "hg forget a.py"
sh % "hg addremove" == "adding dir/a.py"
sh % "cd .."
sh % "cd .."
sh % "hg init sim"
sh % "cd sim"
sh % "echo a" > "a"
sh % "echo a" >> "a"
sh % "echo a" >> "a"
sh % "echo c" > "c"
sh % "hg commit -Ama" == r"""
adding a
adding c"""
sh % "mv a b"
sh % "rm c"
sh % "echo d" > "d"
sh % "hg addremove -n -s 50" == r"""
removing a
adding b
removing c
adding d
recording removal of a as rename to b (100% similar)"""
sh % "hg addremove -s 50" == r"""
removing a
adding b
removing c
adding d
recording removal of a as rename to b (100% similar)"""
sh % "hg commit -mb"
sh % "cp b c"
sh % "hg forget b"
sh % "hg addremove -s 50" == r"""
adding b
adding c"""
sh % "rm c"
sh % "hg ci -A -m c nonexistent" == r"""
nonexistent: $ENOENT$
abort: failed to mark all new/missing files as added/removed
[255]"""
sh % "hg st" == "! c"
sh % "hg forget c"
sh % "touch foo"
sh % "hg addremove" == "adding foo"
sh % "rm foo"
sh % "hg addremove" == "removing foo"
sh % "cd .."