Skip to content
Snippets Groups Projects
  1. May 09, 2017
  2. Apr 16, 2017
  3. Mar 10, 2017
    • Gregory Szorc's avatar
      url: support auth.cookiesfile for adding cookies to HTTP requests · 806f9a88
      Gregory Szorc authored
      Mercurial can't currently send cookies as part of HTTP requests.
      Some authentication systems use cookies. So, it seems like adding
      support for sending cookies seems like a useful feature.
      
      This patch implements support for reading cookies from a file
      and automatically sending them as part of the request. We rely
      on the "cookiejar" Python module to do the heavy lifting of
      parsing cookies files. We currently only support the Mozilla
      (really Netscape-era) cookie format. There is another format
      supported by cookielib and we may want to consider using that,
      especially since the Netscape cookie parser can't parse ports.
      It wasn't immediately obvious to me what the format of the other
      parser is, so I didn't know how to test it. I /think/ it might
      be literal "Cookie" header values, but I'm not sure. If it is
      more robust than the Netscape format, we may want to just
      support it.
      806f9a88
  4. Apr 01, 2017
  5. Mar 31, 2017
  6. Mar 30, 2017
    • Pierre-Yves David's avatar
      run-tests: auto-replace 'TXNID' output · 728d3735
      Pierre-Yves David authored
      Hooks related to the transaction are aware of the transaction id. By definition
      this txn-id is unique and different for each transaction. As a result it can
      never be predicted in test and always needs matching. As a result, touching any
      like with this data is annoying. We solve the problem once and for all by
      installing an automatic replacement. In test, this will now show as:
      
        TXNID=TXN:$ID$
      728d3735
  7. Feb 16, 2017
    • Jun Wu's avatar
      runtests: set web.address to localhost · 161ab32b
      Jun Wu authored
      Previously, "hg serve" will listen on "", which is not clear which interface
      it will actually listen on - it could listen on all interfaces (ex. 0.0.0.0
      on IPv4).
      
      The run-tests.py script only checks "localhost" for available ports. So
      let's make it the same for "hg serve" by explicitly setting "web.address" to
      "localhost".
      
      This resolves some IPv6 EADDRINUSE errors.
      161ab32b
  8. Feb 10, 2017
    • Pierre-Yves David's avatar
      wireproto: properly report server Abort during 'getbundle' · f3807a13
      Pierre-Yves David authored
      Previously Abort raised during 'getbundle' call poorly reported (HTTP-500 for
      http, some scary messages for ssh). Abort error have been properly reported for
      "push" for a long time, there is not reason to be different for 'getbundle'. We
      properly catch such error and report them back the best way available. For
      bundle, we issue a valid bundle2 reply (as expected by the client) with an
      'error:abort' part. With bundle1 we do as best as we can depending of http or
      ssh.
      f3807a13
  9. Dec 24, 2016
    • Gregory Szorc's avatar
      httppeer: advertise and support application/mercurial-0.2 · a520aefb
      Gregory Szorc authored
      Now that servers expose a capability indicating they support
      application/mercurial-0.2 and compression, clients can key off
      this to say they support responses that are compressed with
      various compression formats.
      
      After this commit, the HTTP wire protocol client now sends an
      "X-HgProto-<N>" request header indicating its support for
      "application/mercurial-0.2" media type and various compression
      formats.
      
      This commit also implements support for handling
      "application/mercurial-0.2" responses. It simply reads the header
      compression engine identifier then routes the remainder of the
      response to the appropriate decompressor.
      
      There were some test changes, but only to logging. That points to
      an obvious gap in our test coverage. This will be addressed in a
      subsequent commit once server support is in place (it is hard to
      test without server support).
      a520aefb
  10. Oct 28, 2016
    • Katsunori FUJIWARA's avatar
      tests: invoke printenv.py via sh -c for test portability · 34a5f6c6
      Katsunori FUJIWARA authored
      On Windows platform, invoking printenv.py directly via hook is
      problematic, because:
      
        - unless binding between *.py suffix and python runtime, application
          selector dialog is displayed, and running test is blocked at each
          printenv.py invocations
      
        - it isn't safe to assume binding between *.py suffix and python
          runtime, because application binding is easily broken
      
          For example, installing IDE (VisualStudio with Python Tools, or
          so) often requires binding between source files and IDE itself.
      
      This patch invokes printenv.py via sh -c for test portability. This is
      a kind of follow up for d19787db6fe0, which eliminated explicit
      "python" for printenv.py. There are already other 'sh -c "printenv.py"'
      in *.t files, and this fix should be reasonable.
      
      This changes were confirmed in cases below:
      
        - without any application binding for *.py suffix
        - with binding between *.py suffix and VisualStudio
      
      This patch also replaces "echo + redirection" style with "heredoc"
      style, because:
      
        - hook command line is parsed by cmd.exe as shell at first, and
        - single quotation can't quote arguments on cmd.exe, therefore,
        - "printenv.py foobar" should be quoted by double quotation, but
        - nested quoting (or tricky escaping) isn't readable
      34a5f6c6
  11. Jul 15, 2016
  12. May 05, 2016
  13. Apr 21, 2016
    • timeless's avatar
      tests: tolerate http2 · b74ca9ac
      timeless authored
      You can run tests like this:
      run-tests.py -l --extra-config-opt ui.usehttp2=true
      
      And ideally, no tests should fail...
      b74ca9ac
  14. Mar 15, 2016
    • Jun Wu's avatar
      tests: reorder hg serve commands · e01bd738
      Jun Wu authored
      chg currently does not support hg serve -d. It has a quick path testing if the
      command is hg serve -d and fallbacks to hg if so. But the test only works if
      "serve" is the first argument since the test wants to avoid false positives
      (for example, "-r serve" is different).
      This patch reorders "hg server" commands in tests, making them chg friendly.
      e01bd738
  15. Jan 13, 2016
  16. Jan 06, 2016
    • Mateusz Kwapich's avatar
      hooks: add HG_NODE_LAST to txnclose and changegroup hook environments · d6d3cf5f
      Mateusz Kwapich authored
      Sometimes a txnclose or changegroup hook wants to iterate through all
      the changesets in transaction: in that situation usually the revset
      `$HG_NODE:` is used to select the revisions. Unfortunately this revset
      sometimes may contain too many changesets because we don't have the
      write lock while the hook runs newer changes may be added to
      repository in the meantime.
      
      That's why there is a need for extra variable carrying the information about
      the last change in the transaction.
      d6d3cf5f
  17. Dec 11, 2015
    • Augie Fackler's avatar
      changegroup: introduce cg3, which has support for exchanging treemanifests · 77d25b91
      Augie Fackler authored
      I'm not entirely happy with using a trailing / on a "file" entry for
      transferring a treemanifest. We've discussed putting some flags on
      each file header[0], but I'm unconvinced that's actually any better:
      if we were going to add another feature to the cg format we'd still be
      doing a version bump anyway to cg4, so I'm inclined to not spend time
      coming up with a more sophisticated format until we actually know what
      the next feature we want to stuff in a changegroup will be.
      
      Test changes outside test-treemanifest.t are only due to the new CG3
      bundlecap showing up in the wire protocol.
      
      Many thanks to adgar@google.com and martinvonz@google.com for helping
      me with various odd corners of the changegroup and treemanifest API.
      
      0: It's not hard refactoring, nor is it a lot of work. I'm just
      disinclined to do speculative work when it's not clear what the
      customer would actually be.
      77d25b91
  18. Jun 10, 2015
  19. Jun 06, 2015
  20. Jun 08, 2015
  21. May 28, 2015
  22. Jun 02, 2015
    • Gregory Szorc's avatar
      bundle2: part handler for processing .hgtags fnodes mappings · d2920135
      Gregory Szorc authored
      .hgtags fnodes cache entries can be expensive to compute, especially
      if there are hundreds of even thousands of them. This patch implements
      support for receiving a bundle2 part that contains a mapping of
      changeset to .hgtags fnodes.
      
      An upcoming patch will teach the server to send this part, allowing
      clients to bypass having to redundantly compute these values.
      
      A number of tests changed due to the client advertising the "hgtagsfnodes"
      capability.
      d2920135
  23. May 27, 2015
    • Pierre-Yves David's avatar
      test: use bundle2 in test-http · 98b56763
      Pierre-Yves David authored
      Now that we have a bundle1 version of this test, we can move the
      original to bundle2. This lets us handle the ouput change from using
      the bundle2 protocol earlier.
      98b56763
  24. May 15, 2015
  25. Apr 15, 2015
  26. Dec 12, 2014
  27. Oct 31, 2014
  28. Oct 16, 2014
    • Mike Hommey's avatar
      changegroup: use a copy of hookargs when invoking the changegroup hook · 7c13c940
      Mike Hommey authored
      addchangegroup creates a runhook function that is used to invoke the
      changegroup and incoming hooks, but at the time the function is called,
      the contents of hookargs associated with the transaction may have been
      modified externally. For instance, bundle2 code affects it with
      obsolescence markers and bookmarks info.
      
      It also creates problems when a single transaction is used with multiple
      changegroups added (as per an upcoming change), whereby the contents
      of hookargs are that of after adding a latter changegroup when invoking
      the hook for the first changegroup.
      7c13c940
  29. Oct 12, 2014
  30. Sep 26, 2014
  31. Aug 16, 2014
  32. Aug 06, 2014
  33. Jul 31, 2014
  34. Apr 08, 2014
    • Pierre-Yves David's avatar
      phase: apply publishing enforcement for "serve" source · 63659b80
      Pierre-Yves David authored
      When a changegroup is added by a push on a publishing server, we ensure they
      are added as public. This is used to enforce publishing on server when the
      client is not aware of phases. It also prevents race conditions where a reader
      could see the changesets as draft before they get turned public by the client.
      Finally, this save rounds trip as the client does not need additional request to
      turn them public.
      
      However, this logic was only enforced when the changegroup was from a "push"
      source. And "push" is used for local pushes only. Wireprotocol push uses "serve"
      as source since Mercurial 1.9. We now enforce this logic for both "push" and
      "serve" sources.
      
      One could note that this logic was mainly useful during wireprotocol exchanges.
      So this code is finally put into good use, 9 versions after its introduction.
      63659b80
  35. Dec 20, 2013
    • Stéphane Klein's avatar
      http: reuse authentication info after the first failed request (issue3567) · a939eeb9
      Stéphane Klein authored
      [This was applied in 181108726ea5 but backed out again in af02783dea65 because
      of Python 2.4 issues. This edition and test-http.t works with Python 2.4.]
      
      Context: mercurial access to repository server with http access, and this
      server is protected by basic auth.
      
      Before patch:
      
      * mercurial try an anonymous access to server, server return 401 response and
        mercurial resend request with login / password information
      
      After patch:
      
      * mercurial try an anonymous access to server, server return
        401 response. For all next requests, mercurial keep in memory this
        information (this server need basic auth information).
      
      This patch reduce the number of http access against mercurial server.
      
      Example, before patch:
      
      10.10.168.170 - - [25/Oct/2013:15:44:51 +0200] "GET /hg/testagt?cmd=capabilities
      HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:44:52 +0200] "GET /hg/testagt?cmd=capabilities
      HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:45:00 +0200] "GET /hg/testagt?cmd=capabilities
      HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:45:01 +0200] "GET /hg/testagt?cmd=capabilities
      HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:45:03 +0200] "GET /hg/testagt?cmd=batch
      HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:45:04 +0200] "GET /hg/testagt?cmd=batch
      HTTP/1.1" 200 42 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:45:06 +0200] "GET /hg/testagt?cmd=getbundle
      HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:45:07 +0200] "GET /hg/testagt?cmd=getbundle
      HTTP/1.1" 200 61184 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:45:09 +0200] "GET /hg/testagt?cmd=listkeys
      HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:45:10 +0200] "GET /hg/testagt?cmd=listkeys
      HTTP/1.1" 200 15 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:45:12 +0200] "GET /hg/testagt?cmd=listkeys
      HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [25/Oct/2013:15:45:12 +0200] "GET /hg/testagt?cmd=listkeys
      HTTP/1.1" 200 - "-" "mercurial/proto-1.0"
      
      Example after patch:
      
      10.10.168.170 - - [28/Oct/2013:11:49:14 +0100] "GET /hg/testagt?cmd=capabilities
      HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [28/Oct/2013:11:49:15 +0100] "GET /hg/testagt?cmd=capabilities
      HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [28/Oct/2013:11:49:17 +0100] "GET /hg/testagt?cmd=batch
      HTTP/1.1" 200 42 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [28/Oct/2013:11:49:19 +0100] "GET /hg/testagt?cmd=getbundle
      HTTP/1.1" 200 61184 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [28/Oct/2013:11:49:22 +0100] "GET /hg/testagt?cmd=listkeys
      HTTP/1.1" 200 15 "-" "mercurial/proto-1.0"
      10.10.168.170 - - [28/Oct/2013:11:49:24 +0100] "GET /hg/testagt?cmd=listkeys
      HTTP/1.1" 200 - "-" "mercurial/proto-1.0"
      
      In this last example, you can see only one 401 response.
      a939eeb9
  36. Feb 05, 2014
  37. Jan 16, 2014
  38. Aug 08, 2012
Loading