Skip to content
Snippets Groups Projects
  1. Aug 11, 2017
    • Gregory Szorc's avatar
      wireproto: use new peer interface · dedab036
      Gregory Szorc authored
      The wirepeer class provides concrete implementations of peer interface
      methods for calling wire protocol commands. It makes sense for this
      class to inherit from the peer abstract base class. So we change
      that.
      
      Since httppeer and sshpeer have already been converted to the new
      interface, peerrepository is no longer adding any value. So it has
      been removed. httppeer and sshpeer have been updated to reflect the
      loss of peerrepository and the inheritance of the abstract base
      class in wirepeer.
      
      The code changes in wirepeer are reordering of methods to group
      by interface.
      
      Some Python code in tests was updated to reflect changed APIs.
      
      .. api::
      
         peer.peerrepository has been removed. Use repository.peer abstract
         base class to represent a peer repository.
      
      Differential Revision: https://phab.mercurial-scm.org/D338
      dedab036
  2. Aug 07, 2017
    • Gregory Szorc's avatar
      httppeer: use peer interface · f913e90f
      Gregory Szorc authored
      This is similar to what we did to sshpeer. Quirks and all.
      
      Differential Revision: https://phab.mercurial-scm.org/D337
      f913e90f
    • Gregory Szorc's avatar
      sshpeer: use peer interface · 1f8460b5
      Gregory Szorc authored
      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
      1f8460b5
  3. Aug 10, 2017
    • Gregory Szorc's avatar
      localrepo: use peer interfaces · 707750e5
      Gregory Szorc authored
      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
      707750e5
  4. Aug 06, 2017
  5. Aug 13, 2017
    • Gregory Szorc's avatar
      repository: formalize wire protocol interface · 558f5b2e
      Gregory Szorc authored
      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
      558f5b2e
    • Gregory Szorc's avatar
      repository: formalize peer interface with abstract base class · f257943e
      Gregory Szorc authored
      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
      f257943e
  6. Aug 15, 2017
    • Jun Wu's avatar
      util: make nogc effective for CPython · 05264fc9
      Jun Wu authored
      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
      05264fc9
  7. Jul 27, 2017
  8. Aug 14, 2017
  9. Aug 15, 2017
  10. Jul 29, 2017
  11. Aug 14, 2017
  12. Jul 29, 2017
  13. Aug 13, 2017
  14. Aug 14, 2017
  15. Aug 04, 2017
    • Jun Wu's avatar
      phabricator: add --amend option to phabsend · fa3aa6c9
      Jun Wu authored
      Previously `hg phabsend` was imitating `hg email` and won't mutate
      changesets. That works fine with reviewer-push workflow, reviewers run
      `phabread`, `import`.
      
      However, it does not work well with author-push workflow. Namely, the author
      needs to run extra commands to get the right commit message, and remove the
      local tag after push.
      
      This patch solves those issues by adding the `--amend` option, so local
      changesets will have the right commit message, and tags become unnecessary.
      
      Test Plan:
      Given the following DAG:
      
        o  17
        o  16
        | o  15
        | @  14
        |/
        o  13
        o  12
      
      Run `hg phabsend '(13::)-17'  --amend`, check the new DAG looks like:
      
      
        o  21
        | o  20
        | @  19
        |/
        o  18
        | o  17
        | x  16
        | x  13
        |/
        o  12
      
      And commit messages are updated to contain the `Differential Revision` lines.
      Use `phabread` to make sure Phabricator has the amended node recorded.
      
      Also check `phabsend .` followed by a `phabsend . --amend`, the commit
      message will be updated and the tag will be removed.
      
      Differential Revision: https://phab.mercurial-scm.org/D122
      fa3aa6c9
  16. Aug 11, 2017
    • Jun Wu's avatar
      rebase: rewrite core algorithm (issue5578) (issue5630) · 09755061
      Jun Wu authored
      "defineparents" is the core algorithm of rebase. The old code has too many
      tech debts (like outdated comments, confusing assertions, etc) and is very
      error-prone to be improved. This patch rewrites "defineparents" to make the
      code easier to reason about, and solve a bunch of issues, including:
      
        - Assertion error: no base found (demonstrated by D212, issue5578)
        - Asymmetric result (demonstrated by D211, "F with one parent")
        - Wrong new parent (demonstrated by D262, "C':A'A'")
        - "revlog index out of range" (demonstrated by D262, issue5630)
        - "nothing to merge" (demonstrated by D262)
      
      As a side effect, merge base decision has been made more solid - rebase now
      prints out explicitly what could go wrong when it cannot find a unique
      suitable merge base.
      
      .. fix:: Issue 5578, Issue 5630
      
         Core rebase algorithm has been rewritten to be more robust.
      
      Differential Revision: https://phab.mercurial-scm.org/D21
      09755061
  17. Aug 13, 2017
  18. Aug 12, 2017
  19. Aug 03, 2017
  20. Aug 04, 2017
  21. Aug 03, 2017
  22. Aug 04, 2017
  23. Aug 03, 2017
  24. Aug 02, 2017
    • Pulkit Goyal's avatar
      morestatus: move fb extension to core by plugging to `hg status --verbose` · 96f43981
      Pulkit Goyal authored
      morestatus extension in fbext use to show more context about the state of the
      repo like the repository is in a unfinished merge state, or a rebase is going
      on, or histedit is going on, listing the files which need to be resolved and
      also suggesting ways to handle the situation.
      
      This patch moves the extension directly to core by plugging it into the
      --verbose flag of the status command. So now if you are in any unfinished state
      and you do hg status -v, it will show you details and help related to the state.
      
      The extension in fbext also shows context about unfinished update state
      which is not ported to core as that plug in hooks to update command which need
      to be tackled somewhat differently.
      
      The following configuration will turn the behaviour on by default
      
      [commands]
      status.verbose = 1
      
      You can also skip considering some states like bisect as follows:
      
      [commands]
      status.skipstates=bisect
      
      This patch also adds test for the feature.
      
      .. feature::
      
         ``hg status -v`` can now show unfinished state. For example, when in
         an unfinished rebase state, ``hg status -v`` might show::
      
         # The repository is in an unfinished *rebase* state.
         # No unresolved merge conflicts.
         # To continue:                hg rebase --continue
         # To abort:                   hg rebase --abort
      
      Differential Revision: https://phab.mercurial-scm.org/D219
      96f43981
  25. Aug 09, 2017
  26. Aug 10, 2017
    • Jun Wu's avatar
      fsmonitor: correct an error message · dd35abc4
      Jun Wu authored
      Without the change, the error looks like:
      
        warning: Watchman unavailable: "watchman" executable not in PATH (%s),
        while executing [Errno 2] No such file or directory
      
      With the change, it now looks like:
      
        warning: Watchman unavailable: "watchman" executable not in PATH
        ([Errno 2] No such file or directory)
      
      Differential Revision: https://phab.mercurial-scm.org/D322
      dd35abc4
  27. Aug 11, 2017
    • Gregory Szorc's avatar
      sshpeer: make instance attributes and methods internal · 82d564d5
      Gregory Szorc authored
      Peer types are supposed to conform to a formal interface defined by
      peer.peerrepository and wireproto.wirepeer. Every "public" attribute on
      *peer types makes it harder to understand what attributes are part
      of the interface and what are instance specific.
      
      This commit converts a number of "public" instance attributes and
      methods on sshpeer to internal so they can't be confused to be part of
      the peer API.
      
      The URL-related instance attributes were introduced in 876333a295ff
      in 2005. AFAICT most of them aren't used and could potentially be
      removed. But I kept them around anyway.
      
      I also reorded some code to make things slightly easier to read.
      
      .. api::
      
         Rename attributes on sshpeer to reflect peer API
      
      Differential Revision: https://phab.mercurial-scm.org/D331
      82d564d5
  28. Aug 10, 2017
    • Gregory Szorc's avatar
      peer: remove non iterating batcher (API) · b47fe973
      Gregory Szorc authored
      The last use of this API was removed in b6e71f8af5b8 in 2016. While
      not formally deprecated, as of the last commit the code is no longer
      explicitly tested. I think the new API has existed long enough for
      people to transition to it.
      
      I also have plans to more formalize the peer API and removing batch()
      makes that work easier.
      
      I'm not convinced the current client-side API around batching is
      great. But it's the best we have at the moment.
      
      .. api:: remove peer.batch()
      
         Replace with peer.iterbatch().
      
      Differential Revision: https://phab.mercurial-scm.org/D320
      b47fe973
Loading