Mercurial > python-hglib
comparison hglib/client.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 | 5d3783aebe5f |
children | cdde1656346f |
comparison
equal
deleted
inserted
replaced
121:cc905ee18449 | 122:e05b0cf920bb |
---|---|
1529 | 1529 |
1530 return self._version | 1530 return self._version |
1531 | 1531 |
1532 def __getitem__(self, changeid): | 1532 def __getitem__(self, changeid): |
1533 return context.changectx(self, changeid) | 1533 return context.changectx(self, changeid) |
1534 | |
1535 def __contains__(self, changeid): | |
1536 """ | |
1537 check if changeid, which can be either a local revision number or a | |
1538 changeset id, matches a changeset in the client. | |
1539 """ | |
1540 try: | |
1541 context.changectx(self, changeid) | |
1542 return True | |
1543 except ValueError: | |
1544 return False |