sapling/eden/scm/tests/test-merge-revert-t.py
Jun Wu 0562c1220f tests: enable template-new-builtin
Summary: This makes tests depend less on revision numbers.

Reviewed By: DurhamG

Differential Revision: D22468669

fbshipit-source-id: 74a06930faa3e6ee9d246ecc718c2a3740f57a54
2020-07-20 17:27:53 -07:00

64 lines
1.8 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"
sh % "echo 'added file1'" > "file1"
sh % "echo 'added file2'" > "file2"
sh % "hg add file1 file2"
sh % "hg commit -m 'added file1 and file2'"
sh % "echo 'changed file1'" >> "file1"
sh % "hg commit -m 'changed file1'"
sh % "hg -q log" == r"""
08a16e8e4408
d29c767a4b52"""
sh % "hg id" == "08a16e8e4408"
sh % "hg update -C 0" == "1 files updated, 0 files merged, 0 files removed, 0 files unresolved"
sh % "hg id" == "d29c767a4b52"
sh % "echo 'changed file1'" >> "file1"
sh % "hg id" == "d29c767a4b52+"
sh % "hg revert --all" == "reverting file1"
sh % "hg diff"
sh % "hg status" == "? file1.orig"
sh % "hg id" == "d29c767a4b52"
sh % "hg update" == "1 files updated, 0 files merged, 0 files removed, 0 files unresolved"
sh % "hg diff"
sh % "hg status" == "? file1.orig"
sh % "hg id" == "08a16e8e4408"
sh % "hg update -C 0" == "1 files updated, 0 files merged, 0 files removed, 0 files unresolved"
sh % "echo 'changed file1'" >> "file1"
sh % "hg update" == "1 files updated, 0 files merged, 0 files removed, 0 files unresolved"
sh % "hg diff"
sh % "hg status" == "? file1.orig"
sh % "hg id" == "08a16e8e4408"
sh % "hg revert --all"
sh % "hg diff"
sh % "hg status" == "? file1.orig"
sh % "hg id" == "08a16e8e4408"
sh % "hg revert -r tip --all"
sh % "hg diff"
sh % "hg status" == "? file1.orig"
sh % "hg id" == "08a16e8e4408"
sh % "hg update -C" == "0 files updated, 0 files merged, 0 files removed, 0 files unresolved"
sh % "hg diff"
sh % "hg status" == "? file1.orig"
sh % "hg id" == "08a16e8e4408"