Sun, 06 Aug 2017 17:59:48 -0700 sshpeer: use peer interface
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Aug 2017 17:59:48 -0700] rev 33804
sshpeer: use peer interface We need the same @property conversion of ui like we did for localpeer. We renamed _capabilities() to capabilities() to satisfy the new naming requirement. However, since we're inheriting from wireproto.wirepeer which inherits from peer.peerrepository and provides its own code accessing _capabilities(), we need to keep the old alias around. This wonkiness will disappear once wirepeer is cleaned up in subsequent commits. We also implement methods for basepeer that are identical to the defaults in peer.peerrepository in preparation for the removal of peerrepository. Differential Revision: https://phab.mercurial-scm.org/D336
Wed, 09 Aug 2017 23:52:25 -0700 localrepo: use peer interfaces
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 09 Aug 2017 23:52:25 -0700] rev 33803
localrepo: use peer interfaces We now have a formal abstract base class for peers. Let's transition the peer classes in localrepo to it. As part of the transition, we reorder methods so they are grouped by interface and match the order they are defined in the interface. We also had to change self.ui from an instance attribute to a property to satisfy the @abstractproperty requirement. As part of this change, we uncover the first "bug" as part of enforcing interfaces: stream_out() wasn't implemented on localpeer! This isn't technically a bug since the repo isn't advertising the stream capability, so clients shouldn't be attempting to call it. But I don't think there's a good reason why this is the case. We implement a dummy method to satisfy the interface requriements. We can make localpeer instances streamable as a future enhancement. # no-check-commit Differential Revision: https://phab.mercurial-scm.org/D335
Sun, 06 Aug 2017 16:47:25 -0700 repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Aug 2017 16:47:25 -0700] rev 33802
repository: implement generic capability methods on peer class These methods are part of the peer interface, are generic, and can be implemented in terms of other members of the peer interface. So we implement them on the peer base class as a convenience. The implementation is essentially copied from peer.py. The code in peer.py will eventually be deleted. Differential Revision: https://phab.mercurial-scm.org/D334
Sun, 13 Aug 2017 11:04:42 -0700 repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 13 Aug 2017 11:04:42 -0700] rev 33801
repository: formalize wire protocol interface There are a well-defined set of commands constituting the wire protocol. Interaction with these and methods for calling them in batches are exposed via methods on peer instances. Let's formalize support for these features in abstract classes. The command parts come from the existing wireproto.wirepeer class. The batch methods come from peer.peerrepository. Ample documentation has been added as part of defining the interfaces. # no-check-commit Differential Revision: https://phab.mercurial-scm.org/D333
Sun, 13 Aug 2017 10:58:48 -0700 repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 13 Aug 2017 10:58:48 -0700] rev 33800
repository: formalize peer interface with abstract base class There are various interfaces for interacting with repositories and peers. They form a contract for how one should interact with a repo or peer object. The contracts today aren't very well-defined or enforced. There have been several bugs over the years where peers or repo types have forgotten to implement certain methods. In addition, the inheritance of some classes is wonky. For example, localrepository doesn't inherit from an interface and the god-object nature of that class means the repository interface isn't well-defined. Other repository types inherit from localrepository then stub out methods that don't make sense (e.g. statichttprepository re-defining locking methods to fail fast). Not having well-defined interfaces makes implementing alternate storage backends, wire protocol transports, and repository types difficult because it isn't clear what exactly needs to be implemented. This patch starts the process of attempting to establish more order to the type system around repositories and peers. Our first patch starts with a problem space that already has a partial solution: peers. The peer.peerrepository class already somewhat defines a peer interface. But it is missing a few things and the total interface isn't well-defined because it is combined with wireproto.wirepeer. Our newly-established basepeer class uses the abc module to declare an abstract base class with the properties and methods that a generic peer must implement. We create a new class that inherits from it. This class will hold our other future abstract base classes / interfaces so we can expose a unified base class/interface. We don't yet use the new interface because subsequent additions will break existing code without some refactoring first. A new module (repository.py) was created to hold the interfaces. I could have put things in peer.py. However, I have plans to eventually add interfaces to define repository and storage types. These almost certainly require a new module. And I figured having all the interfaces live in one module makes sense. So I created repository.py to be that future home. Differential Revision: https://phab.mercurial-scm.org/D332
Mon, 14 Aug 2017 22:28:59 -0700 util: make nogc effective for CPython
Jun Wu <quark@fb.com> [Mon, 14 Aug 2017 22:28:59 -0700] rev 33799
util: make nogc effective for CPython 279cd80059d4 made `util.nogc` a no-op. It was to optimize PyPy. But it slows down CPython if many objects (like 300k+) are created. For example, running `hg log -r .` without extensions in `hg-committed` with 14k+ obsmarkers have the following times: before | after hg | chg | hg | chg ----------------------------- 1.262 | 0.860 | 1.077 | 0.619 (seconds, best of 20 runs) Therefore let's re-enable nogc for CPython. Differential Revision: https://phab.mercurial-scm.org/D402
Wed, 26 Jul 2017 23:47:54 -0400 scmutil: use util.shellquote instead of %r
Augie Fackler <augie@google.com> [Wed, 26 Jul 2017 23:47:54 -0400] rev 33798
scmutil: use util.shellquote instead of %r Changes some output, but also resolves differences with Python 3. Differential Revision: https://phab.mercurial-scm.org/D301
(0) -30000 -10000 -3000 -1000 -300 -100 -30 -10 -7 +7 +10 +30 +100 +300 +1000 +3000 +10000 tip