Skip to content
Snippets Groups Projects
  1. Sep 20, 2018
    • Gregory Szorc's avatar
      lfs: don't add extension to hgrc after clone or share (BC) · bcf72d7b
      Gregory Szorc authored
      Now that repository loading in core supports automatically loading
      the lfs extension when the "lfs" requirement is present, we no
      longer need to update the .hg/hgrc of newly-created repos to load
      the lfs extension!
      
      I'm marking this as BC because it is a change in behavior. But users
      should not notice unless they create an LFS repo with new Mercurial
      and then attempt to use it with an old versions that doesn't support
      automatic extension loading.
      
      Differential Revision: https://phab.mercurial-scm.org/D4712
      bcf72d7b
    • Gregory Szorc's avatar
      localrepo: automatically load lfs extension when required (BC) · 2c2fadbc
      Gregory Szorc authored
      If an unrecognized requirement is present (possibly due to an unloaded
      extension), the user will get an error message telling them to go to
      https://mercurial-scm.org/wiki/MissingRequirement for more info.
      
      And some requirements clearly map to known extensions shipped by
      Mercurial.
      
      This commit teaches repository loading to automatically map
      requirements to extensions. We implement support for loading the
      lfs extension when the "lfs" requirement is present.
      
      This behavior feels more user-friendly to me and I'm having trouble
      coming up with a compelling reason to not do it. The strongest
      argument I have against is that - strictly speaking - requirements
      are general repository features and there could be N providers of that
      feature. e.g. in the case of LFS, there could be another extension
      implementing LFS support. And the user would want to use this
      non-official extension rather than the built-in one. The way this
      patch implements things, the non-official extension could be
      missing and Mercurial would load the official lfs extension, leading
      to unexpected behavior. But this feels like a highly marginal use
      case to me and doesn't outweigh the user benefit of "it just works."
      If someone really wanted to e.g. use a custom LFS extension, they
      could prevent the built-in one from being loaded by either defining
      "extensions.lfs=/path/to/custom/extension" or "extensions.lfs=!",
      as the automatic extension loading only occurs if there is no config
      entry for that extension.
      
      Differential Revision: https://phab.mercurial-scm.org/D4711
      2c2fadbc
  2. Sep 19, 2018
    • Gregory Szorc's avatar
      lfs: add repository feature denoting the use of LFS · 1f7b3b98
      Gregory Szorc authored
      Whether LFS is enabled seems like a useful feature to expose. This
      will also facilitate some future work around LFS feature compatibility.
      
      Differential Revision: https://phab.mercurial-scm.org/D4710
      1f7b3b98
    • Gregory Szorc's avatar
      localrepo: define "features" on repository instances (API) · d89d5bc0
      Gregory Szorc authored
      There are a handful of attributes/methods on repository instances that
      describe the behavior of the repository. Furthermore, there is
      an unbound set of repository descriptors that we may wish to expose.
      For example, an extension may wish to add a descriptor and have
      monkeypatched functions look for the presence of an attribute before
      taking actions.
      
      This commit introduces a "features" mechanism to allow repositories
      to self-advertise an arbitrary set of strings that describe repository
      behavior or capabilities.
      
      We implement basic support for advertising a few features to give an
      idea of what I want to use this for.
      
      Differential Revision: https://phab.mercurial-scm.org/D4709
      d89d5bc0
  3. Sep 20, 2018
    • Gregory Szorc's avatar
      localrepo: support writing shared file (API) · d3d4b4b5
      Gregory Szorc authored
      Now that we can create a shared repository via creation options, we
      can handle other special actions related to share at repo creation time
      as well.
      
      One of the things we do after creating a shared repository is write
      out a .hg/shared file containing the list of additional things to
      share. Of which only "bookmarks" is supported.
      
      We add a creation option to hold the set of additional items to
      share. If items are defined, we write out the .hg/shared file at
      repo creation time.
      
      As part of this, we no longer hold the repo lock when writing the
      file. I'm pretty sure we don't care about the tiny race condition
      window. I'm also pretty sure the reason we used the lock was because
      the vfs auditor on the repo instance complained otherwise. Since the
      repo creation code doesn't have an audited vfs, we don't need to
      appease it.
      
      Because we no longer need to tell the post share hook what items
      are shared, the "bookmarks" argument to that function has been
      dropped, incurring an API change.
      
      Differential Revision: https://phab.mercurial-scm.org/D4708
      d3d4b4b5
    • Gregory Szorc's avatar
      localrepo: support shared repo creation · 4ece3cdf
      Gregory Szorc authored
      Previously, hg.share() had its own logic for creating a new
      repository on the filesystem.
      
      With the recent introduction of the createopts dict for passing
      options to influence repository creation, it is now possible
      to consolidate the repo creation code for both the normal and
      shared use cases.
      
      This commit teaches the repo creation code in localrepo to
      recognize when we're creating a shared repo and to act
      appropriately.
      
      Meaningful behavior should be identical. However, there are a
      few subtle changes:
      
      * The .hg/requires file is written out in sorted order (rather
        than having share-related requirements appended at end).
      * The .hg directory is created with notindexed=True when a shared
        repo is being created.
      
      Differential Revision: https://phab.mercurial-scm.org/D4707
      4ece3cdf
  4. Sep 19, 2018
    • Gregory Szorc's avatar
      localrepo: validate directories before creating any · b504ff81
      Gregory Szorc authored
      There is no meaningful change in behavior because wdir would
      already exist in the case where we raised RepoError. But I think
      the code is easier to read if we do all validation first then
      take actions with side-effects.
      
      Differential Revision: https://phab.mercurial-scm.org/D4706
      b504ff81
    • Gregory Szorc's avatar
      localrepo: add missing join() · d3e761f9
      Gregory Szorc authored
      Differential Revision: https://phab.mercurial-scm.org/D4705
      d3e761f9
    • Gregory Szorc's avatar
      revlog: use proper version comparison during verify · e6d3d39c
      Gregory Szorc authored
      Verify appears to want to compare the changelog's revlog version
      number with the version number of filelogs and error if they are
      different. But what it was actually doing was comparing the full
      32-bit header integer, which contains 2 shorts: 1 for the revlog
      version number and 1 for feature flags.
      
      This commit tweaks the verification code so it only looks at the
      version number component of the header and emits a warning if they
      differ.
      
      The new code is more robust because it accounts for future revlog
      version numbers without them needing to be special cased.
      
      Differential Revision: https://phab.mercurial-scm.org/D4704
      e6d3d39c
    • Gregory Szorc's avatar
      filelog: stop proxying checksize() (API) · 0cb3e02e
      Gregory Szorc authored
      This was only used by verify code. And the check using it is now
      implemented as part of verifyintegrity(). The method is unused
      and is revlog-centric, which means it isn't appropriate for the file
      storage interface. So remove it.
      
      Differential Revision: https://phab.mercurial-scm.org/D4703
      0cb3e02e
    • Gregory Szorc's avatar
      filelog: remove version attribute (API) · 68282a7b
      Gregory Szorc authored
      This was only used by verify code. The check it was used for is now
      implemented as part of the verifyintegrity() implementation. The
      attribute is now unused, is revlog-specific, and isn't appropriate
      to be exposing on the file storage interface. So drop it.
      
      Differential Revision: https://phab.mercurial-scm.org/D4702
      68282a7b
    • Gregory Szorc's avatar
      verify: start to abstract file verification · 97986c9c
      Gregory Szorc authored
      Currently, the file storage interface has a handful of attributes
      that are exclusively or near-exclusively used by repo verification
      code. In order to support verification on non-revlog/alternate
      storage backends, we'll need to abstract verification so it can
      be performed in a storage-agnostic way.
      
      This commit starts that process.
      
      We establish a new verifyintegrity() method on revlogs and expose
      it to the file storage interface. Most of verify.verifier.checklog()
      has been ported to this new method.
      
      We need a way to represent verification problems. So we invent an
      interface to represent a verification problem, invent a revlog type
      to implement that interface, and use it.
      
      The arguments to verifyintegrity() will almost certainly change in
      the future, once more functionality is ported from the verify code.
      And the "revlogv1" version check is very hacky. (The code in verify
      is actually buggy because it is comparing the full 32-bit header
      integer instead of just the revlog version short. I'll likely fix
      this in a subsequent commit.)
      
      Differential Revision: https://phab.mercurial-scm.org/D4701
      97986c9c
  5. Sep 24, 2018
  6. Sep 26, 2018
  7. Sep 25, 2018
  8. Sep 26, 2018
  9. Sep 25, 2018
  10. Sep 26, 2018
  11. Sep 25, 2018
  12. Sep 23, 2018
  13. Sep 22, 2018
  14. Sep 24, 2018
  15. Sep 21, 2018
  16. Sep 25, 2018
  17. Sep 17, 2018
  18. Sep 20, 2018
    • Gregory Szorc's avatar
      wireprotov2: allow multiple fields to follow revision maps · d059cb66
      Gregory Szorc authored
      The *data wire protocol commands emit a series of CBOR values.
      Because revision/delta data may be large, their data is emitted
      outside the map as a top-level bytestring value.
      
      Before this commit, we'd emit a single optional bytestring
      value after the revision descriptor map. This got the job done.
      But it was limiting in that we could only send a single field.
      And, it required the consumer to know that the presence of a
      key in the map implied the existence of a following bytestring
      value.
      
      This commit changes the encoding strategy so top-level bytestring
      values in the stream are explicitly denoted in a "fieldsfollowing"
      key. This key contains an array defining what fields that follow
      and the expected size of each field.
      
      By defining things this way, we can easily send N bytestring
      values without any ambiguity about their order. In addition,
      clients only need to know how to parse ``fieldsfollowing`` to
      know if extra values are present.
      
      Because this breaks backwards compatibility, we've bumped the version
      number of the wire protocol version 2 API endpoint.
      
      Differential Revision: https://phab.mercurial-scm.org/D4620
      d059cb66
Loading