tests/test_hgrc.py @ cc789a5baf4a

Fix error with tags

Tags are defined on a commit, such as the current commit `repo['.']`.
They are not defined on the working directory, which `repo[None]` gives.
author Sietse Brouwer <sbbrouwer@gmail.com>
date Tue, 26 May 2020 15:08:02 +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'