Skip to content
Snippets Groups Projects
  1. Oct 28, 2014
    • Durham Goode's avatar
      revset: fix O(2^n) perf regression in addset · ac494b08
      Durham Goode authored
      hg log -r 1 ... -r 100 was never returning due to a regression in the
      way addset computes __nonzero__. It used 'bool(self._r1 or self._r2)'
      which required executing self._r1.__nonzero__ twice (once for the or,
      once for the bool). hg log with a lot of -r's happens to build a one
      sided addset tree of N length, which ends up being 2^N performance.
      
      This patch fixes it by converting to bool before or'ing.
      
      This problem can be repro'd with something as simple as:
      
      hg log `for x in $(seq 1 50) ; do echo "-r $x "; done`
      
      Adding '1 + 2 + ... + 20' to the revsetbenchmark.txt didn't seem to repro the
      problem, so I wasn't able to add a revset benchmark for this issue.
      ac494b08
    • Matt Mackall's avatar
      tests: add missing glob for Windows · 6df4bc39
      Matt Mackall authored
      6df4bc39
  2. Oct 27, 2014
  3. Oct 24, 2014
    • Siddharth Agarwal's avatar
      util.fspath: use a dict rather than a linear scan for lookups · 30124c40
      Siddharth Agarwal authored
      Previously, we'd scan through the entire directory listing looking for a
      normalized match.  This is O(N) in the number of files in the directory. If we
      decide to call util.fspath on each file in it, the overall complexity works out
      to O(N^2). This becomes a problem with directories a few thousand files or
      larger.
      
      Switch to using a dictionary instead. There is a slightly higher upfront cost
      to pay, but for cases like the above this is amortized O(1). Plus there is a
      lower constant factor because generator comprehensions are faster than for
      loops, so overall it works out to be a very small loss in performance for 1
      file, and a huge gain when there's more.
      
      For a large repo with around 200k files in it on a case-insensitive file
      system, for a large directory with over 30,000 files in it, the following
      command was tested:
      
      ls | shuf -n $COUNT | xargs hg status
      
      This command leads to util.fspath being called on $COUNT files in the
      directory.
      
      COUNT  before  after
          1   0.77s  0.78s
        100   1.42s  0.80s
       1000    6.3s  0.96s
      
      I also tested with COUNT=10000, but before took too long so I gave up.
      30124c40
  4. Oct 27, 2014
  5. Oct 24, 2014
  6. Oct 27, 2014
    • Katsunori FUJIWARA's avatar
      largefiles: add examination of exec bit in "hg status --rev REV" case · 24600c9d
      Katsunori FUJIWARA authored
      Before this patch, "hg status --rev REV" doesn't list largefiles up
      with "M" mark, even if exec bit of them is changed, because
      "lfilesrepo.status" doesn't examine exec bit in such case.
      24600c9d
    • Katsunori FUJIWARA's avatar
      largefiles: ignore removal status of files not managed in the target context · 197dc458
      Katsunori FUJIWARA authored
      Before this patch, "hg status --rev REV" listed largefiles removed in
      the working directory up with "R" mark, even if they aren't managed in
      the REV. Normal files aren't listed up in such case.
      
      When "lfilesrepo.status" is invoked for "hg status --rev REV", it
      treats files on conditions below as "removed" (to avoid manifest full
      scan in "ctx.status" ?):
      
        - marked as "R" in lfdirstate, or
      
        - files managed in the target revision but unknown in the manifest
          of the working context (= not including "R" files)
      
      But the former can include files not managed in the target context.
      
      To ignore removal status of files not managed in the target context,
      this patch drops files unknown in the target revision from "removed"
      list.
      197dc458
  7. Oct 26, 2014
    • Mads Kiilerich's avatar
      changelog: use headrevsfiltered · fe5f044b
      Mads Kiilerich authored
      2b5940f64750 introduced use of the new filtering headrevs C implementation. It
      caught TypeError to detect when to fall back to the implementation that was
      compatible with old extensions. That method was however not reliable.
      
      Instead, use the new headrevsfiltered function when passing a filter. It will
      reliably fail with AttributeError when an old extension that predates
      headrevsfiltered is used.
      fe5f044b
    • Mads Kiilerich's avatar
      parsers: introduce headrevsfiltered in C extension · 42342f9a
      Mads Kiilerich authored
      All extensions that have this function do support filtering. The existing
      headrevs function may support filtering but we cannot reliably detect whether
      it does.
      42342f9a
    • Matt Harbison's avatar
      httppeer: close the temporary bundle file after two-way streaming it · cde6904f
      Matt Harbison authored
      This fixes several push tests in test-bundle2-exchange.t that were failing on
      Windows with messages like the following:
      
         $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 \
              --bookmark book_32af
         pushing to http://localhost:$HGPORT2/
         searching for changes
         remote: adding changesets
         remote: adding manifests
         remote: adding file changes
         remote: added 1 changesets with 1 changes to 1 files
         remote: 1 new obsolescence markers
         updating bookmark book_32af
         abort: The process cannot access the file because it is being used by another
                  process: 'C:\path\to\tmp\bundle.hg'
         [255]
      cde6904f
  8. Oct 24, 2014
    • Martin von Zweigbergk's avatar
      status: make 'hg status --rev' faster when there are deleted files · e9165c18
      Martin von Zweigbergk authored
      In order not to avoid listing files as both added and deleted, for
      example, we check for every file in the manifest if it is in the
      _list_ of deleted files. This can get quite slow when there are many
      deleted files. Change it to a set to make the containment check
      faster. On a somewhat contrived example of the Mozilla repo with the
      entire testing/ directory deleted (~14k files), this makes
      'hg status --rev .^' go from 26s to 2s.
      e9165c18
  9. Oct 27, 2014
  10. Oct 24, 2014
    • Gregory Szorc's avatar
      exchange: don't report failure from identical bookmarks · 0fc4686d
      Gregory Szorc authored
      b901645a8784 regressed the behavior of pushing an unchanged bookmark to
      a remote. Before that commit, pushing a unchanged bookmark would result
      in "exporting bookmark @" being printed. After that commit, we now see
      an incorrect message "bookmark %s does not exist on the local or remote
      repository!"
      
      This patch fixes the regression introduced by b901645a8784 by having
      the bookmark error reporting code filter identical bookmarks and adds
      a test for the behavior.
      0fc4686d
    • Gregory Szorc's avatar
      bookmarks: explicitly track identical bookmarks · e62c330a
      Gregory Szorc authored
      bookmarks.compare() previously lumped identical bookmarks in the
      "invalid" bucket. This patch adds a "same" bucket.
      
      An 8-tuple for holding this state is pretty gnarly. The return value
      should probably be converted into a class to increase readability. But
      that is beyond the scope of a patch intended to be a late arrival to
      stable.
      e62c330a
    • Martin von Zweigbergk's avatar
      context.status: remove incorrect swapping of added/removed in workingctx · c586cb50
      Martin von Zweigbergk authored
      The comment in workingctx.status() says that "calling 'super' subtly
      reveresed the contexts", but that is simply not true, so we should not
      be swapping added and removed fields.
      c586cb50
  11. Oct 23, 2014
    • Martin von Zweigbergk's avatar
      keyword: use parent of working copy as base for status · c4ce50a3
      Martin von Zweigbergk authored
      Instead of calling repo[None].status(), use the more common form that
      uses the parent of the working copy as the base:
      repo['.'].status(). Note that the former defaults to comparing to
      revision '.', while the latter defaults to revision None, so the
      contexts being compared are the same.
      
      It might seem like this would result in a reverse diff, but it turns
      out that workingctx.status() incorrectly reverses the result. That bug
      will be fixed in a later commit.
      c4ce50a3
    • Yuya Nishihara's avatar
      revset: avoid O(n) lookup of invalid revision in rev() · eb763217
      Yuya Nishihara authored
      ba89f7b542c9 was not the final version of that patch.  It was really slow
      because `l not in repo.changelog` iterates revisions up to `l`.  Instead,
      rev() should utilize spanset.__contains__().
      
      revset #0: rev(210000)
      0) wall 0.000039 comb 0.000000 user 0.000000 sys 0.000000 (best of 67978)
      1) wall 0.002721 comb 0.000000 user 0.000000 sys 0.000000 (best of 1055)
      2) wall 0.000059 comb 0.000000 user 0.000000 sys 0.000000 (best of 45599)
      (0: 3.2-rc, 1: ba89f7b542c9, 2: this patch)
      
      Note that the benchmark result described in ba89f7b542c9 is wrong because
      it is the one of the initial version.
      eb763217
    • Matt Mackall's avatar
      run-tests: output diffs with only forward slashes · 605a8cb6
      Matt Mackall authored
      This removes some gratuitous variance when testing on Windows with
      test-run-tests.t.
      605a8cb6
    • Wagner Bruna's avatar
      i18n: add hint to digest mismatch message · c312ef38
      Wagner Bruna authored
      c312ef38
    • Wagner Bruna's avatar
      help/config: fix typo · 2b3189ec
      Wagner Bruna authored
      2b3189ec
    • Wagner Bruna's avatar
      files: fix example list syntax · 21a55dbc
      Wagner Bruna authored
      21a55dbc
    • Mads Kiilerich's avatar
      parsers: use 'k' format for Py_BuildValue instead of 'n' because Python 2.4 · 5715c93c
      Mads Kiilerich authored
      'n' was introduced in Mercurial in 2b5940f64750 and broke Python 2.4 support in
      mysterious ways that only showed failure in test-glog.t. Py_BuildValue failed
      because of the unknown format and a TypeError was thrown ... but it never
      showed up on the Python side and it happily continued processing with wrong
      data.
      
      Quoting https://docs.python.org/2/c-api/arg.html :
      
        n (integer) [Py_ssize_t]
          Convert a Python integer or long integer to a C Py_ssize_t.
          New in version 2.5.
      
        k (integer) [unsigned long]
          Convert a Python integer or long integer to a C unsigned long without
          overflow checking.
      
      This will use unsigned long instead of Py_ssize_t. That is not a good solution,
      but good is not an option when we have to support Python 2.4.
      5715c93c
  12. Oct 21, 2014
    • Durham Goode's avatar
      rebase: improve base revset performance · d583f1cf
      Durham Goode authored
      The old revset had pretty terrible performance on large repositories (12+
      seconds). This new revset achieves the same result in only 0.7s. As we improve
      the underlying revset APIs we can probably get this revset down to 'only(base,
      dest)::', but at the moment that version still takes 2s.
      d583f1cf
  13. Oct 16, 2014
    • Ryan McElroy's avatar
      amend: fix amending rename commit with diverged topologies (issue4405) · 652ab726
      Ryan McElroy authored
      This addresses the bug described in issue4405: when obsolescence markers are
      enabled, amending a commit with a file move can lead to the copy information
      being lost.
      
      However, the bug is more general and can be reproduced without obsmarkers as
      well, as demonstracted by Pierre-Yves and put into the updated test.
      Specifically, graph topology divergences between the filelogs and the changelog
      can cause copy information to be lost during amends.
      652ab726
  14. Oct 21, 2014
  15. Oct 22, 2014
  16. Oct 15, 2014
    • Pierre-Yves David's avatar
      bundle2: transmit exception during part generation · 420a0516
      Pierre-Yves David authored
      If an exception is raised during a bundle2 part payload generation it is now
      recorded in the bundle. If such exception occurs, we capture it, transmit an
      abort exception through the bundle, cleanly close the current part payload and
      raise it again. This allow to generate valid bundle even in case of exception so
      that the consumer does not wait forever for a dead producer. This also allow to
      raise the exception during unbundling at the exact point it happened during
      bundling make debugging easier.
      420a0516
  17. Oct 14, 2014
    • Pierre-Yves David's avatar
      bundle2: add a interrupt mechanism · ad144882
      Pierre-Yves David authored
      It is now possible to emit a single part in the middle of a payload production.
      This part will be processed with limitation (only access to a `ui` object). The
      goal is to let the server raise exception and output while a part is being
      processed. The source motivation is to transmit exception that occurs while
      generating a part.
      
      This change is was the motivation to bump the bundle2 format from HG2X to HG2Y.
      Somehow, the format bump made it into 3.2 without it. So this change go on
      stable. It is low risk as bundle2 is still disabled by default.
      ad144882
  18. Oct 21, 2014
    • Durham Goode's avatar
      transactions: change backupfiles format to use newlines · 963f311e
      Durham Goode authored
      Previously the journal.backupfiles file was delimited by \0. Now we delimit it
      using \n (same as the journal file). This allows us to change the number of
      values in each line more easily, rather than relying on the count of \0's.
      963f311e
    • Durham Goode's avatar
      transactions: add version number to journal.backupfiles · 5dc888b7
      Durham Goode authored
      The transaction format will be changing a bit over the next releases, so let's
      go ahead and add a version number to make backwards compatibility easier. This
      whole file format was broken prior to 3.2 (see previous patch), so changing it
      now is pretty low risk.
      5dc888b7
  19. Oct 20, 2014
    • Durham Goode's avatar
      transactions: fix hg recover with fncache backups · cd86a670
      Durham Goode authored
      The transaction backupfiles logic was broken for 'hg recover'.  The file format
      is XXX\0XXX\0YYY\0YYY\0 but the parser did a couple things wrong. 1) It went one
      step beyond the final \0 and tried to read past the end of the array. 2)
      array[i:i+1] returns a single item, instead of two items as intended.
      
      Added a test to catch it, which turns out to be the first actual 'hg recover'
      test.
      cd86a670
  20. Oct 19, 2014
    • Yuya Nishihara's avatar
      revset: have rev() drop out-of-range or filtered rev explicitly (issue4396) · ba89f7b5
      Yuya Nishihara authored
      The recent optimization of "and" operation relies on the assumption that
      the rhs set does not contain invalid revisions.  So rev() has to remove
      invalid revisions.
      
      This is still faster than using `.filter(lambda r: r == l)`.
      
      revset #0: rev(25)
      0) wall 0.026341 comb 0.020000 user 0.020000 sys 0.000000 (best of 113)
      1) wall 0.000038 comb 0.000000 user 0.000000 sys 0.000000 (best of 66567)
      2) wall 0.000062 comb 0.000000 user 0.000000 sys 0.000000 (best of 43699)
      (0: bbf4f3dfd700^, 1: 3.2-rc, 2: this patch)
      ba89f7b5
  21. Oct 22, 2014
Loading