2016-12-22 08:57:28 +03:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
#
|
2017-01-21 09:02:33 +03:00
|
|
|
# Copyright (c) 2016-present, Facebook, Inc.
|
2016-12-22 08:57:28 +03:00
|
|
|
# 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.hg_extension_test_base import HgExtensionTestBase
|
|
|
|
|
|
|
|
|
|
|
|
class StatusTest(HgExtensionTestBase):
|
2017-03-31 21:33:49 +03:00
|
|
|
def populate_backing_repo(self, repo):
|
|
|
|
repo.write_file('hello.txt', 'hola')
|
|
|
|
repo.commit('Initial commit.')
|
2016-12-22 08:57:28 +03:00
|
|
|
|
|
|
|
def test_status(self):
|
|
|
|
'''Test various `hg status` states in the root of an Eden mount.'''
|
2017-05-12 19:10:43 +03:00
|
|
|
self.assert_status_empty()
|
2016-12-22 08:57:28 +03:00
|
|
|
|
|
|
|
self.touch('world.txt')
|
2017-05-12 19:10:43 +03:00
|
|
|
self.assert_status({'world.txt': '?'})
|
2016-12-22 08:57:28 +03:00
|
|
|
|
|
|
|
self.hg('add', 'world.txt')
|
2017-05-12 19:10:43 +03:00
|
|
|
self.assert_status({'world.txt': 'A'})
|
2016-12-22 08:57:28 +03:00
|
|
|
|
|
|
|
self.rm('hello.txt')
|
2017-05-12 19:10:43 +03:00
|
|
|
self.assert_status({
|
|
|
|
'hello.txt': '!',
|
|
|
|
'world.txt': 'A',
|
|
|
|
})
|
2016-12-22 08:57:28 +03:00
|
|
|
|
|
|
|
with open(self.get_path('hello.txt'), 'w') as f:
|
|
|
|
f.write('new contents')
|
2017-05-12 19:10:43 +03:00
|
|
|
self.assert_status({
|
|
|
|
'hello.txt': 'M',
|
|
|
|
'world.txt': 'A',
|
|
|
|
})
|
2016-12-22 08:57:28 +03:00
|
|
|
|
|
|
|
self.hg('rm', '--force', 'hello.txt')
|
2017-05-12 19:10:43 +03:00
|
|
|
self.assert_status({
|
|
|
|
'hello.txt': 'R',
|
|
|
|
'world.txt': 'A',
|
|
|
|
})
|