Mercurial > python-hglib
comparison tests/test-context.py @ 122:e05b0cf920bb
client: implement the 'in' keyword for a client object
Check if a revision number or a changeset hex matches a changeset in the client
repository. The internal tries to create a ctx object. Returns False If the ctx
creation fails.
This patch also adds the corresponding tests.
author | Paul Tonelli <paul.tonelli@logilab.fr> |
---|---|
date | Wed, 30 Apr 2014 16:44:59 +0200 |
parents | 27591b5bb9d9 |
children | 838c5a91ed44 |
comparison
equal
deleted
inserted
replaced
121:cc905ee18449 | 122:e05b0cf920bb |
---|---|
65 self.assertEquals(ctx.node(), tip.node) | 65 self.assertEquals(ctx.node(), tip.node) |
66 | 66 |
67 # from revset | 67 # from revset |
68 ctx = context.changectx(self.client, 'all()') | 68 ctx = context.changectx(self.client, 'all()') |
69 self.assertEquals(ctx.node(), tip.node) | 69 self.assertEquals(ctx.node(), tip.node) |
70 | |
71 def test_in_keyword(self): | |
72 """ | |
73 test the 'in' keyword using both revision numbers or changeset ids. | |
74 """ | |
75 self.append('a', 'a') | |
76 rev0, node0 = self.client.commit('first', addremove=True) | |
77 self.append('a', 'a') | |
78 rev1, node1 = self.client.commit('second') | |
79 | |
80 self.assertIn(1, self.client) | |
81 hash_1 = self.client.log(0)[0][1] | |
82 self.assertIn(hash_1, self.client) | |
83 self.assertNotIn(2, self.client) | |
84 hash_2 = self.client.log(1)[0][1] | |
85 self.assertIn(hash_2,self.client) | |
86 hash_2 = 'deadbeef' | |
87 self.assertNotIn(hash_2, self.client) | |
88 | |
89 |