Skip to content
Snippets Groups Projects
  1. Apr 27, 2016
    • Gregory Szorc's avatar
      exewrapper: add .dll to LoadLibrary() argument · 210bb28c
      Gregory Szorc authored
      LoadLibrary() changes behavior depending on whether the argument
      passed to it contains a period. From the MSDN docs:
      
      If no file name extension is specified in the lpFileName parameter,
      the default library extension .dll is appended. However, the file name
      string can include a trailing point character (.) to indicate that the
      module name has no extension. When no path is specified, the function
      searches for loaded modules whose base name matches the base name of
      the module to be loaded. If the name matches, the load succeeds.
      Otherwise, the function searches for the file.
      
      As the subsequent patch will show, some environments on Windows
      define their Python library as e.g. "libpython2.7.dll." The existing
      code would pass "libpython2.7" into LoadLibrary(). It would assume
      "7" was the file extension and look for a "libpython2.dll" to load.
      
      By passing ".dll" into LoadLibrary(), we force it to search for the
      exact basename we want, even if it contains a period.
      210bb28c
    • Martin von Zweigbergk's avatar
      update: correct description of --check option · 602cc9bf
      Martin von Zweigbergk authored
      The old "update across branches if no uncommitted changes" made
      it sound like updating across branches (with no uncommitted changes)
      was allowed only with this option, which was not true. Also, the option
      did not care whether it was linear or across branches. Instead, it
      checked that there were no uncommitted changes. Let's explain what it
      does instead of trying to suggest what happens without it.
      602cc9bf
  2. Apr 26, 2016
    • Adam Simpkins's avatar
      util: fix race in makedirs() · 07be8682
      Adam Simpkins authored
      Update makedirs() to ignore EEXIST in case someone else has already created the
      directory in question.  Previously the ensuredirs() function existed, and was
      nearly identical to makedirs() except that it fixed this race.  Unfortunately
      ensuredirs() was only used in 3 places, and most code uses the racy makedirs()
      function.  This fixes makedirs() to be non-racy, and replaces calls to
      ensuredirs() with makedirs().
      
      In particular, mercurial.scmutil.origpath() used the racy makedirs() code,
      which could cause failures during "hg update" as it tried to create backup
      directories.
      
      This does slightly change the behavior of call sites using ensuredirs():
      previously ensuredirs() would throw EEXIST if the path existed but was a
      regular file instead of a directory.  It did this by explicitly checking
      os.path.isdir() after getting EEXIST.  The makedirs() code did not do this and
      swallowed all EEXIST errors.  I kept the makedirs() behavior, since it seemed
      preferable to avoid the extra stat call in the common case where this directory
      already exists.  If the path does happen to be a file, the caller will almost
      certainly fail with an ENOTDIR error shortly afterwards anyway.  I checked
      the 3 existing call sites of ensuredirs(), and this seems to be the case for
      them.
      07be8682
  3. Apr 24, 2016
  4. Apr 22, 2016
    • Matt Mackall's avatar
      bdiff: further restrain potential quadratic performance · 87d4a6c5
      Matt Mackall authored
      This causes the longest_match search to limit itself to a window of
      30000 lines during search (roughly 1MB), thus avoiding a full O(N*M)
      search that might occur in repetitive structured inputs. For a
      particular class of many MB pathological test cases, this generated
      the following timings:
      
      size    before      after
      10x     1.25s       1.24s
      100x    57s         33s
      1000x   >8400s      400s
      
      The times on the right quickly become much faster and appear more linear.
      
      While windowing means deltas are no longer "optimal", the resulting
      deltas were within a couple percent of expected size. While we've yet
      to have a report of a file with the level of repetition necessary to
      hit this case, some JSON/XML database dump scenario is fairly likely
      to hit it.
      
      This may also slightly improve the average-case performance for deltas
      of large binaries.
      87d4a6c5
    • Matt Mackall's avatar
      bdiff: balance recursion to avoid quadratic behavior (issue4704) · f1ca2496
      Matt Mackall authored
      For highly structured files like JSON or XML dumps with large numbers
      of duplicate lines (eg braces) and isolated matching lines, bdiff
      could find large numbers of equally good spans. Because it prefers
      earlier matches, this would result in pathologically unbalance
      recursion that resulted in quadratic performance.
      
      This patch makes it prefer matches closer to the middle that tend to
      balance recursion. This change improves the speed of a pathological
      test case from 1100s to 9s.
      
      Included is a smaller test that has a roughly 50x safety margin on the
      performance it accepts. It's likely to fail on pure builds because
      difflib also has a recursion-balancing problem.
      f1ca2496
    • Matt Mackall's avatar
      bdiff: deal better with duplicate lines · 9a8363d2
      Matt Mackall authored
      The longest_match code compares all the possible positions in two
      files to find the best match. Given a pair of sequences, it
      effectively searches a grid like this:
      
        a b b b c . d e . f
        0 1 2 3 4 5 6 7 8 9
      a 1 - - - - - - - - -
      b - 2 1 1 - - - - - -
      b - 1 3 2 - - - - - -
      b - 1 2 4 - - - - - -
      . - - - - - 1 - - 1 -
      
      
      Here, the 4 in the middle says "the first four lines of the
      file match", which it can compute be comparing the fourth lines and
      then adding one to the result found when comparing the third lines in
      the entry to the upper left.
      
      We generally avoid the quadratic worst case by only looking at lines
      that match, which is precomputed. We also avoid quadratic storage by
      only keeping a single column vector and then keeping track of the best
      match.
      
      Unfortunately, this can get us into trouble with the sequences above.
      Because we want to reuse the '3' value when calculating the '4', we
      need to be careful not to overwrite it with the '2' we calculate
      immediately before. If we scan left to right, top to bottom, we're
      going to have a problem: we'll overwrite our 3 before we use it and
      calculate a suboptimal best match.
      
      To address this, we can either keep two column vectors and swap
      between them (which significantly complicates bookkeeping), or change
      our scanning order. If we instead scan from left to right, bottom to
      top, we'll avoid ever overwriting values we'll need in the future.
      
      This unfortunately needs several changes to be made simultaneously:
      
      - change the order we build the initial hash chains for the b sequence
      - change the sentinel values from INT_MAX to -1
      - change the visit order in the longest_match inner loop
      - add a tie-breaker preference for earlier matches
      
      This last is needed because we previously had an implicit tie-breaker
      from our visitation order that our test suite relies on. Later matches
      can also trigger a bug in the normalization code in diff().
      9a8363d2
    • Matt Mackall's avatar
      bdiff: fix latent normalization bug · 4bd67ae7
      Matt Mackall authored
      This bug is hidden by the current bias towards matches at the
      beginning of the file. When this bias is tweaked later to address
      recursion balancing, the normalization code could cause the next block
      to shrink to a negative length, thus creating invalid delta chunks. We
      add checks here to disallow that.
      
      This bug requires test cases that are an awkwardly large size for the test
      suite, but is very rapidly picked up by the included torture tester.
      4bd67ae7
    • Matt Mackall's avatar
      bdiff: fold in shift calculation in normalize · 8bcda4c7
      Matt Mackall authored
      This just makes the code harder to read without any performance
      advantage. We're going to make the check here more complex, let's make
      it simpler first.
      8bcda4c7
    • Matt Mackall's avatar
      bdiff: unify duplicate normalize loops · e868d8ee
      Matt Mackall authored
      We're about to make the while loop check more complicated, so let's simplify
      first.
      e868d8ee
  5. Apr 25, 2016
    • Siddharth Agarwal's avatar
      make: backout changeset 51f5fae84e43 · c05cc1b9
      Siddharth Agarwal authored
      Support for '!=' was only added in GNU Make 4.0, and CentOS versions as new as
      CentOS 7 only carry 3.82.
      
      I will leave figuring out compatibility with BSD make as an exercise for
      interested folks.
      c05cc1b9
  6. Jan 01, 1970
    • timeless's avatar
      tests: test-lock-badness.t message could come later · 38292b22
      timeless authored
      I got this on gcc112:
      @@ -58,8 +58,8 @@
         $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
         $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf"
         waiting for lock on working directory of b held by '*:*' (glob)
      -  got lock after ? seconds (glob)
         $ wait
      +  got lock after 1 seconds
         $ cat stdout
         adding b
      38292b22
  7. Apr 23, 2016
  8. Apr 21, 2016
  9. Apr 23, 2016
    • Yuya Nishihara's avatar
      revset: unindent "if True" block in sort() · ea794f2e
      Yuya Nishihara authored
      It was there to make the previous patch readable.
      ea794f2e
    • Yuya Nishihara's avatar
      revset: make sort() do dumb multi-pass sorting for multiple keys (issue5218) · 923fa9e0
      Yuya Nishihara authored
      Our invert() function was too clever to not take length into account. I could
      fix the problem by appending '\xff' as a terminator (opposite to '\0'), but
      it turned out to be slower than simple multi-pass sorting.
      
      New implementation is pretty straightforward, which just calls sort() from the
      last key. We can do that since Python sort() is guaranteed to be stable. It
      doesn't sound nice to call sort() multiple times, but actually it is faster.
      That's probably because we have fewer Python codes in hot loop, and can avoid
      heavy string and list manipulation.
      
        revset #0: sort(0:10000, 'branch')
        0) 0.412753
        1) 0.393254
      
        revset #1: sort(0:10000, '-branch')
        0) 0.455377
        1) 0.389191  85%
      
        revset #2: sort(0:10000, 'date')
        0) 0.408082
        1) 0.376332  92%
      
        revset #3: sort(0:10000, '-date')
        0) 0.406910
        1) 0.380498  93%
      
        revset #4: sort(0:10000, 'desc branch user date rev')
        0) 0.542996
        1) 0.486397  89%
      
        revset #5: sort(0:10000, '-desc -branch -user -date -rev')
        0) 0.965032
        1) 0.518426  53%
      923fa9e0
  10. Mar 24, 2016
    • Yuya Nishihara's avatar
      log: fix status template to list copy source per dest (issue5155) · 2d3837a4
      Yuya Nishihara authored
      Before, copied files were assumed as "A" (added) and listed followed by
      non-copy added files. This could double entries of a copy if it had "M"
      (modified) state.
      
      So, this patch makes the template check if a file is included in copies dict.
      This way, entries should never be doubled.
      
      The output of "log -Tstatus -C" does not always agree with "status -C --change"
      due to the bug of "status", which is documented in test-status.t. See also
      2963d5c9d90b.
      2d3837a4
  11. Apr 20, 2016
  12. 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
  13. Apr 16, 2016
  14. Apr 17, 2016
  15. Apr 15, 2016
  16. Apr 16, 2016
  17. Apr 17, 2016
  18. Mar 26, 2016
    • Yuya Nishihara's avatar
      help: avoid using "$n" parameter in revsetalias example · 97811ff7
      Yuya Nishihara authored
      Because parsing "$n" requires a crafted tokenizer, it exists only for backward
      compatibility (as documented in revset._tokenizealias.) This patch updates the
      examples so that users are encouraged to use symbolic names instead of "$n"s.
      
      I'm going to implement alias expansion in templater, which won't support "$n"
      parameters to make my life easier. Templater is more complicated than revset
      because tokenizer and parser call each other.
      97811ff7
  19. Apr 17, 2016
  20. Apr 16, 2016
  21. Apr 15, 2016
  22. Apr 14, 2016
  23. Apr 10, 2016
    • Jun Wu's avatar
      chg: forward SIGWINCH to worker · b89e4457
      Jun Wu authored
      Before this patch, if the user uses chg and ncurses interface, resizing the
      terminal window will mess up its content.
      
      This patch fixes the issue by forwarding SIGWINCH to the worker process.
      b89e4457
Loading