sapling/tests/test-treemanifest-diff-t.py
Stefan Filip 5d7a31d5dd tests: add treemanifest diff test
Summary:
Tree manifests want to have a different order than flat manifests.
This difference in orders can cause algorithms like diff to give wrong
results. This test aims to validate that the treemanifest implemetations
work correctly for cases where the orders are different.

Reviewed By: quark-zju

Differential Revision: D17492500

fbshipit-source-id: eabb5d0fed5804b3d81c12667621ec6d38e0bfce
2019-09-19 19:45:08 -07:00

32 lines
849 B
Python

# 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 or any later version.
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
# Setup the repository
sh % "hg init myrepo"
sh % "cd myrepo"
sh % "mkdir -p foo/bar-test foo/bartest"
sh % "echo a" > "foo/bar-test/a.txt"
sh % "echo b" > "foo/bartest/b.txt"
sh % "hg add ." == r"""
adding foo/bar-test/a.txt
adding foo/bartest/b.txt"""
sh % "hg commit -m Init"
sh % "mkdir foo/bar"
sh % "echo c" > "foo/bar/c.txt"
sh % "hg add ." == r"""
adding foo/bar/c.txt"""
sh % "hg commit -m 'Add foo/bar/c.txt'"
sh % "hg diff -r .^ -r . --stat" == r"""
foo/bar/c.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)"""