Skip to content
Snippets Groups Projects
  1. Aug 01, 2017
    • Katsunori FUJIWARA's avatar
      i18n: make hggettext use original docstring to compute offset · 97ee669f1f6d
      Katsunori FUJIWARA authored
      Before this patch, hggettext uses __doc__ of each functions to compute
      offset of document text.
      
      But __doc__ of many functions is already modified by decorators in
      registrar (e.g. @templatekeyword adds ":NAME: " prefix to it), and
      hggettext can not find it out in original source.
      
      This causes many "unknown offset in ..." warning at "make update-pot",
      and leaving them might cause overlooking serious problems.
      
      This patch makes hggettext use original docstring, which decorators in
      registrar save into _origdoc, to compute offset.
      
      Even after this patch, there are still a few "unknown offset in ..."
      warning at "make update-pot" for specific reasons. These will be fixed
      later one by one.
      97ee669f1f6d
  2. Aug 11, 2017
  3. Aug 13, 2017
    • Filip Filmar's avatar
      crecord: fixes the formatting of the select status in the status line · 1e71a27dee97
      Filip Filmar authored
      The status line in the crecord has the "space" status field which has variable
      length depending on the length of the status label in the language of choice.
      In English, the status labels are "space: deselect" and "space:select".  The
      "deselect" label is 2 glyphs longer.  This makes the terminal output jump
      around if the terminal width is just right so that the shorter label makes
      the status line 1 line long, and the longer label makes it 2 lines long.
      
      This patch formats the selected status into a fixed-width field.  The field
      width is the maximum of the lengths of the two possible labels, to account for
      differing translations and label lengths.  This should make the label behavior
      uniform across localizations.
      
      There does not seem to be a test for crecord, so I verified the change manually
      with a local build of 'hg'.
      1e71a27dee97
  4. Aug 14, 2017
  5. Aug 13, 2017
  6. Jul 14, 2017
  7. Aug 11, 2017
    • Gregory Szorc's avatar
      tests: verify that peer instances only expose interface members · b70029f355a3
      Gregory Szorc authored
      Our abstract interfaces are more useful if we guarantee that
      implementations conform to certain rules. Namely, we want to ensure
      that objects implementing interfaces don't expose new public
      attributes that aren't part of the interface. That way, as long as
      consumers don't access "internal" attributes (those beginning with
      "_") then (in theory) objects implementing interfaces can be swapped
      out and everything will "just work."
      
      We add a test that enforces our "no public attributes not part
      of the abstract interface" rule.
      
      We /could/ implement "interface compliance detection" at run-time.
      However, that is littered with problems.
      
      The obvious solutions are custom __new__ and __init__ methods.
      These rely on derived types actually calling the parent's
      implementation, which is no sure bet. Furthermore, __new__ and
      __init__ will likely be called before instance-specific attributes
      are assigned. In other words, they won't detect public attributes
      set on self.__dict__. This means public attribute detection won't
      be robust.
      
      We could work around lack of robust self.__dict__ public attribute
      detection by having our interfaces implement a custom __getattribute__,
      __getattr__, and/or __setattr__. However, this incurs an undesirable
      run-time penalty. And, subclasses could override our custom
      method, bypassing the check.
      
      The most robust solution is a non-runtime test. So that's what this
      commit implements. We have a generic function for validating that an
      object only has public attributes defined by abstract classes. Then,
      we instantiate some peers and verify a newly constructed object
      plays by the rules.
      
      Differential Revision: https://phab.mercurial-scm.org/D339
      b70029f355a3
    • Gregory Szorc's avatar
      wireproto: use new peer interface · dedab036215d
      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
      dedab036215d
  8. Aug 07, 2017
    • Gregory Szorc's avatar
      httppeer: use peer interface · f913e90f15a0
      Gregory Szorc authored
      This is similar to what we did to sshpeer. Quirks and all.
      
      Differential Revision: https://phab.mercurial-scm.org/D337
      f913e90f15a0
    • Gregory Szorc's avatar
      sshpeer: use peer interface · 1f8460b55986
      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
      1f8460b55986
  9. Aug 10, 2017
    • Gregory Szorc's avatar
      localrepo: use peer interfaces · 707750e5310b
      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
      707750e5310b
  10. Aug 06, 2017
  11. Aug 13, 2017
    • Gregory Szorc's avatar
      repository: formalize wire protocol interface · 558f5b2ee10e
      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
      558f5b2ee10e
    • Gregory Szorc's avatar
      repository: formalize peer interface with abstract base class · f257943e47ab
      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
      f257943e47ab
  12. Aug 15, 2017
    • Jun Wu's avatar
      util: make nogc effective for CPython · 05264fc9d8d6
      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
      05264fc9d8d6
  13. Jul 27, 2017
  14. Aug 14, 2017
  15. Aug 15, 2017
  16. Jul 29, 2017
  17. Aug 14, 2017
  18. Jul 29, 2017
  19. Aug 13, 2017
  20. Aug 14, 2017
  21. Aug 04, 2017
    • Jun Wu's avatar
      phabricator: add --amend option to phabsend · fa3aa6c98bb7
      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
      fa3aa6c98bb7
  22. Aug 11, 2017
    • Jun Wu's avatar
      rebase: rewrite core algorithm (issue5578) (issue5630) · 0975506120fb
      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
      0975506120fb
  23. Aug 13, 2017
  24. Aug 12, 2017
  25. Aug 03, 2017
  26. Aug 04, 2017
  27. Aug 03, 2017
Loading