# HG changeset patch # User Gábor Stefanik # Date 1518443649 -3600 # Node ID 7da1dad166b56c4db3e01be48915229973ed26cd # Parent 1085c904d8c04d51c6897027fe9c7bae0964b64b client: ignore close() on non-open clients (issue5751) Closing a client twice currently triggers a rather confusing exception. Instead, follow the convention set by Python's file objects, and ignore close() commands on non-open clients. diff -r 1085c904d8c0 -r 7da1dad166b5 hglib/client.py --- a/hglib/client.py Thu Feb 01 15:10:02 2018 -0500 +++ b/hglib/client.py Mon Feb 12 14:54:09 2018 +0100 @@ -291,6 +291,8 @@ Attempting to call any function afterwards that needs to communicate with the server will raise a ValueError. """ + if not self.server: + return 0 return self._close()[0] def _close(self):