view tests/test-annotate.py @ 141:ea80bd2775f6

hglib: introduce util.b() (issue4520) The util.b() function will be used to mark all string literals in the code base which should be treated as bytes instead of text. This is to help with supporting Python 3.
author Brett Cannon <brett@python.org>
date Sat, 07 Mar 2015 10:08:52 -0500
parents 1b47146a4a2c
children 4359cabcb0cc
line wrap: on
line source

import common

class test_annotate(common.basetest):
    def test_basic(self):
        self.append('a', 'a\n')
        rev, node0 = self.client.commit('first', addremove=True)
        self.append('a', 'a\n')
        rev, node1 = self.client.commit('second')

        self.assertEquals(list(self.client.annotate('a')), [('0',
                                                             'a'), ('1', 'a')])
        self.assertEquals(list(
            self.client.annotate(
                'a', user=True, file=True,
                number=True, changeset=True, line=True, verbose=True)),
                          [('test 0 %s a:1' % node0[:12], 'a'),
                           ('test 1 %s a:2' % node1[:12], 'a')])

    def test_files(self):
        self.append('a', 'a\n')
        rev, node0 = self.client.commit('first', addremove=True)
        self.append('b', 'b\n')
        rev, node1 = self.client.commit('second', addremove=True)
        self.assertEquals(list(self.client.annotate(['a', 'b'])),
                          [('0', 'a'), ('1', 'b')])

    def test_two_colons(self):
        self.append('a', 'a: b\n')
        self.client.commit('first', addremove=True)
        self.assertEquals(list(self.client.annotate('a')), [('0', 'a: b')])