diff 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
line wrap: on
line diff
--- a/tests/test-context.py	Sat Feb 01 15:30:18 2014 -0600
+++ b/tests/test-context.py	Wed Apr 30 16:44:59 2014 +0200
@@ -67,3 +67,23 @@
         # from revset
         ctx = context.changectx(self.client, 'all()')
         self.assertEquals(ctx.node(), tip.node)
+
+    def test_in_keyword(self):
+        """
+        test the 'in' keyword using both revision numbers or changeset ids.
+        """
+        self.append('a', 'a')
+        rev0, node0 = self.client.commit('first', addremove=True)
+        self.append('a', 'a')
+        rev1, node1 = self.client.commit('second')
+
+        self.assertIn(1, self.client)
+        hash_1 = self.client.log(0)[0][1]
+        self.assertIn(hash_1, self.client)
+        self.assertNotIn(2, self.client)
+        hash_2 = self.client.log(1)[0][1]
+        self.assertIn(hash_2,self.client)
+        hash_2 = 'deadbeef'
+        self.assertNotIn(hash_2, self.client)
+
+