comparison tests/test-hidden.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
children cc7569bffb26
comparison
equal deleted inserted replaced
122:e05b0cf920bb 123:cdde1656346f
1 import common, hglib, datetime
2 from hglib.error import CommandError
3
4 class test_obsolete_reference(common.basetest):
5 '''make sure obsolete changesets are disabled'''
6 def test_debugobsolete_failure(self):
7 f = open('gna1','w')
8 f.write('g')
9 f.close()
10 self.client.add('gna1')
11 cs = self.client.commit('gna1')[1] #get id
12 with self.assertRaises(CommandError):
13 self.client.rawcommand(['debugobsolete', cs])
14
15
16 class test_obsolete(common.basetest):
17 '''test a few client methods with obsolete changesets enabled'''
18 def setUp(self):
19 #create an extension which only activates obsolete
20 super(test_obsolete, self).setUp()
21 self.append('.hg/obs.py','''import mercurial.obsolete\nmercurial.obsolete._enabled = True''')
22 self.append('.hg/hgrc','\n[extensions]\nobs=.hg/obs.py')
23
24 def test_debugobsolete_success(self):
25 self.append('gna1','ga')
26 self.client.add('gna1')
27 cs = self.client.commit('gna1')[1] #get id
28 self.client.rawcommand(['debugobsolete', cs])
29
30 def test_obsolete_in(self):
31 self.append('gna1','ga')
32 self.client.add('gna1')
33 cs0 = self.client.commit('gna1')[1] #get id
34 self.append('gna2','gaaa')
35 self.client.add('gna2')
36 cs1 = self.client.commit('gna2')[1] #get id
37 self.client.rawcommand(['debugobsolete', cs1])
38 self.client.update(cs0)
39 self.assertFalse(cs1 in self.client)
40 self.assertTrue(cs0 in self.client)
41 self.client.hidden = True
42 self.assertTrue(cs1 in self.client)
43