Wed, 31 Jan 2018 14:05:11 -0800 wireproto: define and use types for wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 31 Jan 2018 14:05:11 -0800] rev 35981
wireproto: define and use types for wire protocol commands Wire protocol commands have historically been declared as 2-tuples in wireproto.commands. There are some additional features I'd like to implement that require going beyond 2-tuples. But because the 2-tuple API (both destructuring assignment and direct assignment into the dict) is used throughout the code base and in 3rd party extensions, we can't do a trivial type change. This commit creates a new "commandentry" type to represent declared wire protocol commands. It implements __getitem__ and __iter__ so it can quack like a 2-tuple. The @wireprotocommand decorator now creates "commandentry" instances. We also create a "commanddict" type to represent the dictionary of declared wire protocol commands. It inherits from "dict" but provides a custom __setitem__ to coerce passed 2-tuples to "commandentry" instances. wireproto.commands is now an instance of this type. Various callers in core rely on the new functionality. And tests pass. So I'm reasonably confident things will "just work" in 3rd party extensions as well. Differential Revision: https://phab.mercurial-scm.org/D1998
Tue, 30 Jan 2018 15:21:59 -0800 wireproto: improve docstring for @wireprotocommand
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 30 Jan 2018 15:21:59 -0800] rev 35980
wireproto: improve docstring for @wireprotocommand I'm about to add more arguments and want them to be documented. Plus, good documentation is nice to have. Differential Revision: https://phab.mercurial-scm.org/D1997
Wed, 31 Jan 2018 10:06:39 -0800 wireproto: remove unnecessary exception trapping
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 31 Jan 2018 10:06:39 -0800] rev 35979
wireproto: remove unnecessary exception trapping The `try..except error.Abort` was added in 8474be4412ca back in 2012. The intent was to ensure a failing pushkey hook didn't crash the server. Since that changeset, repo.pushkey() and the hooks mechanism is now much more robust about trapping errors itself. As such, we no longer need this try..except block. So it has been removed. Differential Revision: https://phab.mercurial-scm.org/D1996
(0) -30000 -10000 -3000 -1000 -300 -100 -30 -10 -3 +3 +10 +30 +100 +300 +1000 +3000 +10000 tip