Skip to content
Snippets Groups Projects
  1. Nov 08, 2019
    • Augie Fackler's avatar
      cleanup: remove pointless r-prefixes on single-quoted strings · 9f70512ae2cf
      Augie Fackler authored
      This is the promised second step on single-quoted strings. These had
      existed because our source transformer didn't turn r'' into b'', so we
      had tagged some strings as r-strings to get "native" strings on both
      Pythons. Now that the transformer is gone, we can dispense with this
      nonsense.
      
      Methodology:
      
      I ran
      
          hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$'  | xargs egrep --color=never -n  -- \[\^b\]\[\^a-z\]r\'\[\^\'\\\\\]\*\'\[\^\'\
      
      in an emacs grep-mode buffer, and then used a keyboard macro to
      iterate over the results and remove the r prefix as needed.
      
      # skip-blame removing unneeded r prefixes left over from Python 3 migration.
      
      Differential Revision: https://phab.mercurial-scm.org/D7306
      9f70512ae2cf
  2. Nov 07, 2019
    • Augie Fackler's avatar
      cleanup: remove pointless r-prefixes on double-quoted strings · 313e3a279828
      Augie Fackler authored
      This is only double-quoted strings. I'll do single-quoted strings as a
      second step. These had existed because our source transformer didn't
      turn r"" into b"", so we had tagged some strings as r-strings to get
      "native" strings on both Pythons. Now that the transformer is gone, we
      can dispense with this nonsense.
      
      Methodology:
      
      I ran
      
          hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$'  | xargs egrep --color=never -n  -- \[\^a-z\]r\"\[\^\"\\\\\]\*\"\[\^\"\]
      
      in an emacs grep-mode buffer, and then used a keyboard macro to
      iterate over the results and remove the r prefix as needed.
      
      # skip-blame removing unneeded r prefixes left over from Python 3 migration.
      
      Differential Revision: https://phab.mercurial-scm.org/D7305
      313e3a279828
  3. Nov 02, 2019
    • Gregory Szorc's avatar
      py3: define and use json.loads polyfill · 579672b347d2
      Gregory Szorc authored
      Python 3.5's json.loads() requires a str. Only Python 3.6+
      supports passing a bytes or bytearray.
      
      This commit implements a json.loads() polyfill on Python 3.5
      so that we can use bytes. The added function to detect encodings
      comes verbatim from Python 3.7.
      579672b347d2
  4. Oct 21, 2019
    • Denis Laxalde's avatar
      lfs: dedent documentation section about .hglfs file · 26caf96a5fa9
      Denis Laxalde authored
      The leading ".hglfs::" is interpreted as a macro in generated man page
      and, as it is unknown, the whole section does not render. Also, having
      the section marked as preformatted (::) makes it render verbatim in
      HTML, which is not desired as the text contains formatting markers. So
      we just dedent the section and remove the ".hglfs::" line. The example
      file is still indented and rendered preformatted.
      26caf96a5fa9
  5. Oct 07, 2019
  6. Oct 06, 2019
  7. Sep 03, 2019
  8. Aug 17, 2019
  9. Aug 07, 2019
  10. Jul 14, 2019
    • sliquister's avatar
      convert: add a config option to help doing identity hg->hg conversion · d98ec36be808
      sliquister authored
      I want to change the computation of the list of files modified by a
      commit. In principle, this would simply change a cache. But since this
      information is stored in commits rather than a cache, changing it
      means changing commit hashes (going forward).
      
      Some users rely on the convert extension from hg to hg not changing
      hashes when nothing changes (usually). Allow these users to preserve
      hashes despite changes to the changelog files computation by reusing
      these files lists when the manifest is unchanged (since these files
      list are derived from the manifest).
      
      Differential Revision: https://phab.mercurial-scm.org/D6643
      d98ec36be808
  11. Jun 14, 2019
  12. May 04, 2019
    • Matt Harbison's avatar
      lfs: add a TODO file · 1756859a65fa
      Matt Harbison authored
      This is a cleaned up and reorganized list of items I sent out about a year ago.
      But tracking this in the repo (like the narrow extension) gives more visibility
      in case anyone wants to help out.
      1756859a65fa
  13. Feb 07, 2019
    • Matt Harbison's avatar
      lfs: disable all authentication except Basic for HTTP(S) connections · 698667eb7523
      Matt Harbison authored
      I ran into a problem pushing to an old Apache server- the normal outgoing
      traffic occurred, the Batch API request and response occurred, and then things
      suddenly halted.  5 minutes later, a 500 was returned, and the server log had a
      timeout reading 32K from `self._req.bodyfh` in hgweb.request.sendresponse().
      Watching in WireShark, the Batch API got a 401, retried properly, then proceeded
      to PUT the blob (without authentication headers).  This got a 401, but the
      client never retried with authentication.  Worse, the blob was sent over the
      wire in the failed attempt.
      
      This kills digests for both the Batch API and the Transfer API.  While in theory
      we could have the Batch API provide external URLs to a place that supports Basic
      Authentication, the LFS spec actually calls out using Basic Authentication[1].
      It's not clear to me if they've been able to shoehorn in other methods.  But
      let's keep it simple until somebody needs it.
      
      If we only had to support python2, we could just not add the handler for digest
      authentication.  However in python3, AbstractBasicAuthHandler raises ValueError
      if it sees a scheme other than Basic.  So we need to intercept all other schemes
      before it gets to that point.
      
      # no-check-commit because of urllib2.OpenerDirector foo_bar calling conventions
      
      [1] https://github.com/git-lfs/git-lfs/blob/master/docs/api/authentication.md
      698667eb7523
  14. Jan 29, 2019
    • Matt Harbison's avatar
      lfs: explicitly add the Content-Length header when uploading blobs, for py3 · 1bc01490178a
      Matt Harbison authored
      This was the reason for test-lfs-test-server.t#git-server complaining about an
      "invalid byte in chunk length".  For some reason if this isn't explicitly added,
      py3.7.1 is adding `transfer-encoding: chunked` as well as `Content-length: x`.
      Wireshark flagged this as malformed.  However, if this is set, it doesn't bother
      with `transfer-encoding`.
      
      Before this patch with py3:
      
        PUT /objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1
        Accept-Encoding: identity
        Content-length: 12
        accept: application/vnd.git-lfs
        content-type: application/octet-stream
        host: localhost:20062
        transfer-encoding: chunked
        user-agent: git-lfs/2.3.4 (Mercurial 4.9rc0+149-7eb7637e34bf)
      
      Before this patch with py27:
      
        PUT /objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1
        Accept-Encoding: identity
        accept: application/vnd.git-lfs
        content-type: application/octet-stream
        content-length: 12
        host: localhost:20062
        user-agent: git-lfs/2.3.4 (Mercurial 4.9rc0+149-7eb7637e34bf+20190128)
      
      With this patch and py3, the content is the same as the py27 example.  RFC2616
      says to ignore `Content-Length` if `Transfer-Encoding` is present, so maybe
      there's nothing to do in the hg-server side (though I'm not sure which it is
      using if presented both).
      
      Maybe chunked encoding is better to do?  If someone knows how to suppress the
      `Content-Length`, we can try that instead.
      1bc01490178a
  15. Jan 28, 2019
  16. Jan 27, 2019
  17. Jan 17, 2019
  18. Dec 30, 2018
  19. Dec 28, 2018
  20. Nov 28, 2018
    • Matt Harbison's avatar
      lfs: convert to using exthelper to wrap functions · 84d61fdcefa5
      Matt Harbison authored
      I'm not 100% sure that upgraderequirements() can be double annotated safely, but
      it seems OK based on printing the address of the function being wrapped.
      
      One thing I've noticed is that @eh.reposetup doesn't do the usual check to
      ensure that it's a local repo.  Should that be baked into @eh.reposetup()
      somehow, possibly with a non-default option to skip the check?  It seems like a
      gaping hole if every function that gets registered needs to add this check.
      84d61fdcefa5
  21. Nov 19, 2018
  22. Nov 16, 2018
  23. Nov 15, 2018
    • Matt Harbison's avatar
      lfs: make the exception messages consistent · 93e5d18251d6
      Matt Harbison authored
      I don't love that it repeats 'HTTP Error' in an already long message, but I
      doubt that we should assume that it will always say that on the original
      exception message.
      93e5d18251d6
    • Matt Harbison's avatar
      lfs: handle URLErrors to add additional information · 380f5131ee7b
      Matt Harbison authored
      Sometimes the blob server is hit first (e.g. on push), and sometimes it's hit
      last (e.g. pull).  Throw in depth first subrepo operations, and things quickly
      get insane.  It wasn't even mentioning LFS, so just saying "connection refused"
      can be confusing- especially if the blob server is a secondary server and
      connecting to the repo server works.
      
      The exception handler for the transfer handler will print the full path to the
      blob, but that seems fine given that it might be necessary to debug a second
      server.  (We don't yet support a standalone blob server, so the handler for the
      Batch API will cover 99.9% of the current problems.  But it might as well be
      handled now while I'm thinking about it.)
      
      The function for translating to a message was mostly borrowed from
      scmutil.catchall().
      380f5131ee7b
    • Matt Harbison's avatar
      lfs: improve the hints for common errors in the Batch API · 9f78d10742af
      Matt Harbison authored
      The previous message was too debug-ish and less action oriented than a hint
      should be.  The remaining errors that aren't handled are more along the lines of
      programming errors (not using POST, bad accept type, etc), so I'm not bothering
      with that.
      
      The friendly errors purposely use `self.baseurl` instead of the full Batch API
      endpoint because I'd expect some copy/paste/modify on the part of the user here,
      and it would be more confusing if '/objects/batch' magically appeared, but
      shouldn't be used in the config setting.  It still seems like the right thing
      for debugging in the catchall case.
      9f78d10742af
    • Matt Harbison's avatar
      lfs: provide more Batch API error info via a hint in the raised exception · 8863f08c1630
      Matt Harbison authored
      A coworker had a typo in `lfs.url`, forgot it was even set because usually the
      blob server is inferred, and then got a 404.  It would have been easier to debug
      with the failing URL printed.
      8863f08c1630
  24. Oct 22, 2018
    • Matt Harbison's avatar
      lfs: consult the narrow matcher when extracting pointers from ctx (issue5794) · 4a81d82474e9
      Matt Harbison authored
      I added a testcase for lfs to all narrow tests, and the following failed:
      
          test-narrow-acl.t
          test-narrow-exchange.t
          test-narrow-patterns.t
          test-narrow-strip.t
          test-narrow-trackedcmd.t
          test-narrow-widen.t
          test-narrow.t
      
      The first two still have errors in the pretxnchangegroup on clone and (receiving
      a) push, which I'm still looking into (4d63f3bc1e1a fixed something in this area
      already).  These two modified tests seem to cover the things that failed in the
      remaining narrow tests, i.e. `hg tracked` and `hg strip`, so I didn't bother
      enabling the testcases elsewhere.  Maybe we should, but it's 68 tests total.
      4a81d82474e9
  25. Oct 19, 2018
  26. Sep 21, 2018
    • Matt Harbison's avatar
      lfs: autoload the extension when cloning from repo with lfs enabled · 6637b079ae45
      Matt Harbison authored
      This is based on a patch by Gregory Szorc.  I made small adjustments to
      clean up the messaging when the server has the extension enabled, but the
      client has it disabled (to prevent autoloading).  Additionally, I added
      a second server capability to distinguish between the server having the
      extension enabled, and the server having LFS commits.  This helps prevent
      unnecessary requirement propagation- the client shouldn't add a requirement
      that the server doesn't have, just because the server had the extension
      loaded.  The TODO I had about advertising a capability when the server can
      natively serve up blobs isn't relevant anymore (we've had 2 releases that
      support this), so I dropped it.
      
      Currently, we lazily add the "lfs" requirement to a repo when we first
      encounter LFS data. Due to a pretxnchangegroup hook that looks for LFS
      data, this can happen at the end of clone.
      
      Now that we have more control over how repositories are created, we can
      do better.
      
      This commit adds a repo creation option to add the "lfs" requirement.
      hg.clone() sets this creation option if the remote peer is advertising
      lfs usage (as opposed to just support needed to push).
      
      So, what this change effectively does is have cloned repos
      automatically inherit the "lfs" requirement.
      
      Differential Revision: https://phab.mercurial-scm.org/D5130
      6637b079ae45
Loading