sapling/eden/integration/debug_hg_get_dirstate_tuple_test.py
Michael Bolin 70050affcc Introduce eden debug hg_get_dirstate_tuple.
Summary:
This is a convenient way to test the `hgGetDirstateTuple()` endpoint in
`eden.thrift`.

Reviewed By: quark-zju, wez

Differential Revision: D5654237

fbshipit-source-id: 0b285e056002d4556733a53293582345f36780b2
2017-08-18 21:49:59 -07:00

33 lines
1010 B
Python

#!/usr/bin/env python3
#
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from .lib import testcase
import os
from textwrap import dedent
@testcase.eden_repo_test
class DebugHgGetDirstateTupleTest:
def populate_repo(self):
self.repo.write_file('hello', 'hola\n')
self.repo.write_file(os.path.join('dir', 'file'), 'blah\n')
self.repo.commit('Initial commit.')
def test_get_dirstate_tuple_normal_file(self):
output = self.eden.run_cmd(
'debug', 'hg_get_dirstate_tuple', os.path.join(self.mount, 'hello')
)
expected = dedent('''\
hello
status = Normal
mode = 0o100644
mergeState = NotApplicable
''')
self.assertEqual(expected, output)