Fix error: don't assume status is a tuple
This fix also works with older versions of Mercurial. `repo.status()` used to
return a named tuple; since 5.2.1 it returns an object. So `st[:5]` no longer
works, but `st.modified` works with both old and new versions of Mercurial.
author |
Sietse Brouwer <sbbrouwer@gmail.com> |
date |
Tue, 26 May 2020 14:57:58 +0200 |
parents |
003e92ae20da |
children |
(none) |
'''Test evaluation of prompt template in HGRC.'''
from nose import *
from util import *
@with_setup(setup_sandbox, teardown_sandbox)
def test_hgrc():
with open(os.path.join(sandbox_path, '.hg', 'hgrc'), 'w') as fp:
fp.write('[prompt]\ntemplate = foo\n')
output = prompt(fs='')
assert output == 'foo'
output = prompt(fs='bar')
assert output == 'bar' # command line overwrites hgrc
with open(os.path.join(sandbox_path, '.hg', 'hgrc'), 'w') as fp:
fp.write('[prompt]\ntemplate = { at node {node}}\n')
output = prompt(fs='')
assert output == ' at node 0000000000000000000000000000000000000000'