view tests/test-status.py @ 123:cdde1656346f

client: add 'hidden' property to show hidden changesets. This enables interactions with the obsolete changesets in the repository: - add the attribute in client class - add the keyword to the relevant commands - enable log without hidden changesets even when self.hidden is True - add a few tests with the hidden keyword This changeset mirrors the behavior of the mercurial global command --hidden: an attribute is added to the client library. If set at True, adds the hidden keyword to all command which can use it to show hidden changesets. The alternative would be to add the keyword in rawcommand, but the hidden flag is not relevant for commands such as add or branch.
author Paul Tonelli <paul.tonelli@logilab.fr>
date Thu, 22 May 2014 15:23:12 +0200
parents 1e33bbea23e5
children 4359cabcb0cc
line wrap: on
line source

import common, os

class test_status(common.basetest):
    def test_empty(self):
        self.assertEquals(self.client.status(), [])

    def test_one_of_each(self):
        self.append('.hgignore', 'ignored')
        self.append('ignored', 'a')
        self.append('clean', 'a')
        self.append('modified', 'a')
        self.append('removed', 'a')
        self.append('missing', 'a')
        self.client.commit('first', addremove=True)
        self.append('modified', 'a')
        self.append('added', 'a')
        self.client.add(['added'])
        os.remove('missing')
        self.client.remove(['removed'])
        self.append('untracked')

        l = [('M', 'modified'),
             ('A', 'added'),
             ('R', 'removed'),
             ('C', '.hgignore'),
             ('C', 'clean'),
             ('!', 'missing'),
             ('?', 'untracked'),
             ('I', 'ignored')]

        st = self.client.status(all=True)

        for i in l:
            self.assertTrue(i in st)

    def test_copy(self):
        self.append('source', 'a')
        self.client.commit('first', addremove=True)
        self.client.copy('source', 'dest')
        l = [('A', 'dest'), (' ', 'source')]
        self.assertEquals(self.client.status(copies=True), l)

    def test_copy_origin_space(self):
        self.append('s ource', 'a')
        self.client.commit('first', addremove=True)
        self.client.copy('s ource', 'dest')
        l = [('A', 'dest'), (' ', 's ource')]
        self.assertEquals(self.client.status(copies=True), l)