Skip to content
Snippets Groups Projects
  1. Jul 02, 2015
    • Katsunori FUJIWARA's avatar
      hghave: allow adding customized features at runtime · b94df10c
      Katsunori FUJIWARA authored
      Before this patch, there is no way to add customized features to
      `hghave` without changing `hghave` and `hghave.py` themselves.
      
      This decreases reusability of `run-tests.py` framework for third party
      tools, because they may want to examine custom features at runtime
      (e.g.  existence of some external tools).
      
      To allow adding customized features at runtime, this patch makes
      `hghave` import `hghaveaddon` module, only when `hghaveaddon.py` file
      can be found in directories below:
      
        - `TESTDIR` for invocation via `run-tests.py`
        - `.` for invocation via command line
      
      The path to the directory where `hghaveaddon.py` should be placed is
      added to `sys.path` only while importing `hghaveaddon`, because:
      
        - `.` may not be added to `PYTHONPATH`
      
        - adding additional path to `sys.path` may change behavior of
          subsequent `import` for other features
      
      `hghave` is terminated with exit code '2' at failure of `import
      hghaveaddon`, because exit code '2' terminates `run-tests.py`
      immediately.
      
      This is a one of preparations for issue4677.
      b94df10c
    • Katsunori FUJIWARA's avatar
      import-checker.py: exit with code 0 if no error is detected · cd1daab5
      Katsunori FUJIWARA authored
      Before this patch, `import-checker.py` exits with non-0 code, if no
      error is detected. This is unusual as Unix command.
      
      This change may be a one of preparations for issue4677, because this
      can avoid extra explanation about unusual exit code of
      `import-checker.py` for third party tool developers.
      cd1daab5
    • Katsunori FUJIWARA's avatar
      run-tests.py: add TESTDIR to PATH if it differs from RUNTESTDIR · c380d527
      Katsunori FUJIWARA authored
      Before this patch, `RUNTESTDIR` is added to `PATH`, but `TESTDIR`
      isn't.
      
      This doesn't cause any problems, if `run-tests.py` runs in `tests`
      directory of Mercurial source tree. In this case, `RUNTESTDIR` should
      be equal to `TESTDIR`.
      
      On the other hand, if `run-tests.py` runs in `tests` of third party
      tools, commands in that directory should be executed with explicit
      `$TESTDIR/` prefix in `*.t` test scripts. This isn't suitable for the
      policy "drop explicit $TESTDIR from executables" of Mercurial itself
      (see 4d2b9b304ad0).
      
      BTW, 4d2b9b304ad0 describes that "$TESTDIR is added to the path" even
      though `TESTDIR` isn't added to `PATH` exactly speaking, because
      `TESTDIR` and `RUNTESTDIR` weren't yet distinguished from each other
      at that time.
      
      This is a one of preparations for issue4677.
      c380d527
    • Katsunori FUJIWARA's avatar
      run-tests.py: add RUNTESTDIR to refer `tests` of Mercurial · 57dfadc4
      Katsunori FUJIWARA authored
      Before this patch, there is no way to refer files under `tests` or so
      of Mercurial source tree, when `run-tests.py` runs in `tests` of third
      party tools. In this case, `TESTDIR` refers the latter `tests`.
      
      This prevents third party tools from using useful tools in Mercurial
      source tree (e.g. `contrib/check-code.py`).
      
      This patch adds `RUNTESTDIR` environment variable to refer `tests` of
      Mercurial source tree, in which `run-tests.py` now running is
      placed. For example, tests of third party tools can refer
      `contrib/check-code.py` in Mercurial source tree as
      `$RUNTESTDIR/../contrib/check-code.py`.
      
      BTW, for similarity with `TESTDIR` referring `test*s*` directory,
      newly added environment variable isn't named as `RUNTEST*S*DIR`. In
      addition to it, the corresponded local variable is also named as
      `runtestdir`.
      
      This is a one of preparations for issue4677.
      57dfadc4
    • Katsunori FUJIWARA's avatar
      run-tests.py: execute hghave by the path relative to run-tests.py · 905c3232
      Katsunori FUJIWARA authored
      Before this patch, `run-tests.py` executes `hghave` by the path
      relative to `TESTDIR` (= cwd of `run-tests.py` running).
      
      This prevents third party tools for Mercurial from running
      `run-tests.py`, which is placed in `tests` of Mercurial source tree,
      in `tests` of own source tree. In such cases, `TESTDIR` refers the
      latter `tests`, and `hghave` doesn't exist in it.
      
      This is a one of preparations for issue4677.
      905c3232
  2. Jul 07, 2015
  3. Jul 01, 2015
  4. Jun 27, 2015
    • Matt Harbison's avatar
      templatekw: introduce the changessincelatesttag keyword · 4474a750
      Matt Harbison authored
      Archive is putting a value with the same name in the metadata file, to count all
      of the changes not covered by the latest tag, instead of just along the longest
      path.  It seems that this would be useful to have on the command line as well.
      It might be nice for the name to start with 'latesttag' so that it is grouped
      with the other tag keywords, but I can't think of a better name.
      
      The initial version of this counted a clean wdir() and '.' as the same value,
      and a dirty wdir() as the same value after it is committed.  Yuya objected on
      the grounds of consistency [1].  Since revsets can be used to conditionally
      select a dirty wdir() or '.' when clean, I can build the version string I need
      and will defer to him on this.
      
      [1] https://www.selenic.com/pipermail/mercurial-devel/2015-June/071588.html
      4474a750
  5. Jul 05, 2015
  6. Jul 02, 2015
    • Matt Harbison's avatar
      test-convert-git: use a relative gitmodule url · eb15c5be
      Matt Harbison authored
      The absolute URL was causing this error with 1.9.5 on Windows, which had a
      cascading effect:
      
        @@ -466,22 +466,24 @@
           >   url = $TESTTMP/git-repo5
           > EOF
           $ git commit -a -m "weird white space submodule"
        -  [master *] weird white space submodule (glob)
        -   Author: nottest <test@example.org>
        -   1 file changed, 3 insertions(+)
        +  fatal: bad config file line 6 in $TESTTMP/git-repo6/.gitmodules
        +  [128]
           $ cd ..
           $ hg convert git-repo6 hg-repo6
           initializing destination hg-repo6 repository
           scanning source...
      
      For reasons unknown, there is still this delta on Windows:
      
        @@ -490,7 +490,6 @@
           $ git commit -q -m "missing .gitmodules"
           $ cd ..
           $ hg convert git-repo6 hg-repo6 --traceback
        -  fatal: Path '.gitmodules' does not exist in '*' (glob)
           initializing destination hg-repo6 repository
           scanning source...
           sorting...
      eb15c5be
    • Matt Harbison's avatar
      test-convert-git: stablize for git 1.7.7.6 · 5b9b7063
      Matt Harbison authored
      The output has apparently changed slightly since this version.  Since they are
      just commits without any obvious importance to the test, and I can't figure out
      how to glob them away, silence them.
      
      Sample diffs were like this:
      
        @@ -468,7 +468,7 @@
           $ git commit -a -m "weird white space submodule"
           [master *] weird white space submodule (glob)
            Author: nottest <test@example.org>
        -   1 file changed, 3 insertions(+)
        +   1 files changed, 3 insertions(+), 0 deletions(-)
           $ cd ..
           $ hg convert git-repo6 hg-repo6
           initializing destination hg-repo6 repository
      5b9b7063
  7. Jul 01, 2015
    • Pierre-Yves David's avatar
      hgweb: also monitor change to bookmarks · bd2e171d
      Pierre-Yves David authored
      This makes changes to bookmarks visible to hgweb through the official
      way. There is no change to tests because there is currently another
      hack in place to ensure the same behavior.
      bd2e171d
    • Pierre-Yves David's avatar
      hgweb: also refresh the repo on changes to the obsstore · c51a1860
      Pierre-Yves David authored
      Before this change, hgweb could miss update to the obsolescence markers store
      if that was the only change between two commands.
      c51a1860
    • Pierre-Yves David's avatar
      hgweb: use an extensible list of files to check for refresh · 2e32f089
      Pierre-Yves David authored
      The refresh feature was explicitly testing if '00changelog.i' and 'phaseroots'
      changed. This is overlooking other important information like bookmarks and
      obsstore (bookmark have their own hack to work around it).
      
      We move to a more extensible system with a list of files of interest
      that will be used to build the repo state. The system should probably
      move into a more central place so that the command server and other
      systems are able to use it. Extension writers will also be able to add
      entries to ensure that changes to extension data are properly detected.
      
      Also the current key (mtime, size) is notably weak for bookmarks and phases
      whose files can easily change content without effect on their size.
      
      Still, this patch seems like a valuable minimal first step.
      2e32f089
  8. Jul 03, 2015
  9. Jul 01, 2015
    • Colin Chan's avatar
      shelve: only keep the latest N shelve backups · 2ca11661
      Colin Chan authored
      This will keep the backup directory from growing indefinitely. The number of
      backups to keep can be set using the shelve.maxbackups config option (defaults
      to 10 backups).
      2ca11661
    • Colin Chan's avatar
      shelve: always backup shelves instead of deleting them · 8a6264a2
      Colin Chan authored
      Instead of being deleted, shelve files are now moved into the .hg/shelve-backup
      directory. This is designed similarly to how strip saves backups into
      .ht/strip-backup. The goal is to prevent data loss especially when using
      unshelve. There are cases in which a user can complete an unshelve but lose
      some of the data that was shelved by, for example, resolving merge conflicts
      incorrectly. Storing backups will allow the user to recover the data that was
      shelved, at the expense of using more disk space over time.
      8a6264a2
    • Pierre-Yves David's avatar
      wireproto: remove a debug print · 26579a91
      Pierre-Yves David authored
      This looks like someone forgot something here.
      26579a91
  10. Sep 28, 2014
  11. Jul 01, 2015
    • Pierre-Yves David's avatar
      amend: move createmarkers evaluation earlier · c8737317
      Pierre-Yves David authored
      The value is used at multiple points in the function. Retrieving the
      value in the middle of the transaction scope gives the false
      impression that it has a single user. We move it at the start of the
      function to clarify this.
      c8737317
  12. Jun 30, 2015
    • Augie Fackler's avatar
      wireproto: correctly escape batched args and responses (issue4739) · d3d32643
      Augie Fackler authored
      This issue appears to be as old as wireproto batching itself: I can
      reproduce the failure as far back as 08ef6b5f3715 trivially by
      rebasing the test changes in this patch, which was back in the 1.9
      era. I didn't test before that change, because prior to that the
      testfile has a different name and I'm lazy.
      
      Note that the test thought it was checking this case, but it actually
      wasn't: it put a literal ; in the arg and response for its greet
      command, but the mangle/unmangle step defined in the test meant that
      instead of "Fo, =;o" going over the wire, "Gp-!><p" went instead,
      which doesn't contain any special characters (those being [.=;]) and
      thus not exercising the escaping. The test has been updated to use
      pre-unmangled special characters, so the request is now "Fo+<:o",
      which mangles to "Gp,=;p". I have confirmed that the test fails
      without the adjustment to the escaping rules in wireproto.py.
      
      No existing clients of RPC batching were depending on the old behavior
      in any way. The only *actual* users of batchable RPCs in core were:
      
      1) largefiles, wherein it batches up many statlfile calls. It sends
      hexlified hashes over the wire and gets a 0, 1, or 2 back as a
      response. No risk of special characters.
      
      2) setdiscovery, which was using heads() and known(), both of which
      communicate via hexlified nodes. Again, no risk of special characters.
      
      Since the escaping functionality has been completely broken since it
      was introduced, we know that it has no users. As such, we can change
      the escaping mechanism without having to worry about backwards
      compatibility issues.
      
      For the curious, this was detected by chance: it happens that the
      lz4-compressed text of a test file for remotefilelog compressed to
      something containing a ;, which then caused the failure when I moved
      remotefilelog to using batching for file content fetching.
      d3d32643
  13. Jul 01, 2015
  14. Jun 28, 2015
  15. Jun 27, 2015
    • Yuya Nishihara's avatar
      revset: add function to build dict of positional and keyword arguments · 48919d24
      Yuya Nishihara authored
      Keyword arguments will be convenient for functions that will take more than
      one optional or boolean flags. For example,
      
        file(pattern[, subrepos=false])
        subrepo([[pattern], status])
      
      Because I don't think all functions should accept key=value syntax, getkwargs()
      does not support variadic functions such as 'ancestor(*changeset)'.
      
      The core logic is placed in the parser module because keyword arguments will
      be more useful in the templater, where functions take more options. Test cases
      will be added by the next patch.
      48919d24
    • Yuya Nishihara's avatar
      revset: add parsing rule for key=value pair · 70a2082f
      Yuya Nishihara authored
      It will be used as an keyword argument.
      
      Note that our "=" operator is left-associative. In general, the assignment
      operator is right-associative, but we don't care because it isn't allowed to
      chain "=" operations.
      70a2082f
  16. Jun 28, 2015
    • Gregory Szorc's avatar
      import-checker: establish modern import convention · 1a6a117d
      Gregory Szorc authored
      We introduce a new convention for declaring imports and enforce it via
      the import checker script.
      
      The new convention is only active when absolute imports are used, which is
      currently nowhere. Keying off "from __future__ import absolute_import" to
      engage the new import convention seems like the easiest solution. It is
      also beneficial for Mercurial to use this mode because it means less work
      and ambiguity for the importer and potentially better performance due to
      fewer stat() system calls because the importer won't look for modules in
      relative paths unless explicitly asked.
      
      Once all files are converted to use absolute import, we can refactor
      this code to again only have a single import convention and we can
      require use of absolute import in the style checker.
      
      The rules for the new convention are documented in the docstring of the
      added function. Tests have been added to test-module-imports.t. Some
      tests are sensitive to newlines and source column position, which makes
      docstring testing difficult and/or impossible.
      1a6a117d
    • Gregory Szorc's avatar
      import-checker: establish new function for verifying import conventions · ab2c5163
      Gregory Szorc authored
      A future patch will formalize the modern import convention. In
      preparation for that, introduce a new wrapper function that will invoke
      the proper function.
      ab2c5163
    • Gregory Szorc's avatar
      import-checker: resolve relative imports · 1f88c0f6
      Gregory Szorc authored
      "from . import X" will produce an ImportFrom ast node with .module =
      None. This resulted in a run-time error from attempting to concatenate
      None with a str.
      
      Another problem with relative imports is that the prefix may be dynamic
      based on the "level" attribute of the import. e.g. "from ." has level 1
      and "from .." has level 2.
      
      We teach the "fromlocal" function how to cope with relative imports.
      Where appropriate, the consumer passes in the level so relative module
      names may be resolved properly.
      1f88c0f6
  17. Jun 27, 2015
    • Matt Harbison's avatar
      templatekw: use a list of tags in getlatesttags() instead of joining them · 0fca47b2
      Matt Harbison authored
      This will be used in the next patch.
      
      It also points out that the documentation for '{latesttag}' is not quite
      accurate, since it says "most recent global tag" (singular).  I assume it is too
      radical of a change to convert it to a list of strings.  At least ':' is
      currently a reserved character in tag names.
      0fca47b2
  18. Jun 30, 2015
  19. Jun 29, 2015
    • Durham Goode's avatar
      convert: fix bug with converting the same commit twice · 1538e722
      Durham Goode authored
      Convert had a bug where it relied on repo.tip() to be the newly committed
      commit. This was not the case if the commit already existed in the repository
      (since repo.commitctx() did nothing, the tip() referenced some random other
      commit and the revmap got corrupted).
      
      This fixes it by using the node returned by repo.commitctx().
      1538e722
  20. Jun 27, 2015
  21. Jul 01, 2015
  22. Jun 29, 2015
    • Augie Fackler's avatar
      sshserver: drop ancient do_{lock,unlock,addchangegroup} methods · 9f6e0e7e
      Augie Fackler authored
      These were marked as deprecated and dangerous way back in
      e8c4f3d3df8c, which was first included in Mercurial 0.9.1. While it's
      possible that clients from that long ago are still around somewhere,
      they're risky for servers in that they want to lock the repo, and then
      might leave it locked if they died before finishing their transaction.
      
      Given that it's been 9 years, let's go ahead and cut this last
      lingering tie with a basically-untested protocol.
      9f6e0e7e
    • Mike Edgar's avatar
      wireproto: add config knob for http header length limit · 5cda0ce0
      Mike Edgar authored
      Well-behaved Mercurial clients will respect the httpheader capability by not
      sending http headers longer than the given limit in bytes. The limit is
      currently hard-coded at 1024 bytes, a safe value for any web server.
      
      Since parsing headers is a notable factor in web server performance, tuning
      header size can nontrivially improve performance for request-heavy operations
      (eg. obsolete marker negotiation). Exposing the maximum header length limit
      as a configuration setting is a simple way to enable such tuning.
      5cda0ce0
Loading