Skip to content
Snippets Groups Projects
  1. Oct 20, 2016
    • Yuya Nishihara's avatar
      scmutil: move util.termwidth() · 4b1af1c867fa
      Yuya Nishihara authored
      I'm going to get rid of sys.stderr|out|in references from posix.termwidth().
      In order to do that, termwidth() needs to take a ui, but functions in util.py
      shouldn't depend on a ui object. So moves termwidth() to scmutil.py.
      4b1af1c867fa
  2. Nov 06, 2016
    • Gregory Szorc's avatar
      bdiff: don't check border condition in loop · d500ddae7494
      Gregory Szorc authored
      `plast = a + len - 1`. So, this "for" loop iterates from "a" to "plast",
      inclusive. So, `p == plast` can only be true on the final iteration
      of the loop. So checking for it on every loop iteration is wasteful.
      
      This patch simply decreases the upper bound of the loop by 1 and
      adds an explicit check after iteration for the `p == plast` case.
      We can't simply add 1 to the initial value for "i" because that
      doesn't do the correct thing on empty input strings.
      
      `perfbdiff -m 3041e4d59df2` on the Firefox repo becomes significantly
      faster:
      
      ! wall 0.072763 comb 0.070000 user 0.070000 sys 0.000000 (best of 100)
      ! wall 0.053221 comb 0.060000 user 0.060000 sys 0.000000 (best of 100)
      
      For the curious, this code has its origins in 8b067bde6679, which is
      the changeset that introduced bdiff.c in 2005.
      
      Also, GNU diffutils is able to perform a similar line-based diff in
      under 20ms. So there's likely more perf wins to be found in this code.
      One of them is the hashing algorithm. But it looks like mpm spent
      some time testing hash collisions in d0c48891dd4a. I'd like to do the
      same before switching away from lyhash, just to be on the safe side.
      d500ddae7494
    • Gregory Szorc's avatar
      perf: add perfbdiff · c8fa7ad1ff90
      Gregory Szorc authored
      bdiff shows up a lot in profiling. I think it would be useful to have
      a perf command that runs bdiff over and over so we can find hot spots.
      c8fa7ad1ff90
    • Pulkit Goyal's avatar
      help: show help for disabled extensions (issue5228) · 5581b294f3c6
      Pulkit Goyal authored
      This patch does not exactly solve issue5228 but it results in a better
      condition on this issue. For disabled extensions, we used to parse the
      module and get the first occurrences of docstring and then return the first
      line of that as an introductory heading of extension. This is what we get
      today.
      
      This patch returns the whole docstring of the module as a help for extension,
      which is more informative. There are some modules which don't have much
      docstring at top level except the heading so those are unaffected by this
      change. To follow the existing trend of showing commands either we have to
      load the extension or have a very ugly parsing method which don't even assure
      correctness.
      5581b294f3c6
  3. Nov 05, 2016
    • Pulkit Goyal's avatar
      py3: make scmutil.rcpath() return bytes · af7c60988f6e
      Pulkit Goyal authored
      This patch make sure scmutil.rcpath() returns bytes independent of
      which platform is used on Python 3. If we want to change type for windows we
      can just conditionalize the return variable.
      af7c60988f6e
    • Pulkit Goyal's avatar
      py3: use pycompat.ossep at certain places · ba2c04059317
      Pulkit Goyal authored
      Certain instances of os.sep has been converted to pycompat.ossep where it was
      sure to use bytes only. There are more such instances which needs some more
      attention and will get surely.
      ba2c04059317
    • Pulkit Goyal's avatar
      py3: have pycompat.ospathsep and pycompat.ossep · ad40d307a9f0
      Pulkit Goyal authored
      We needed bytes version of os.sep and os.pathsep in py3 as they return
      unicodes.
      ad40d307a9f0
    • Pulkit Goyal's avatar
      py3: add a bytes version of os.name · 3874ddba1ab4
      Pulkit Goyal authored
      os.name returns unicodes on py3. Most of our checks are like
          os.name == 'nt'
      
      Because of the transformer, on the right hand side we have b'nt'. The
      condition will never satisfy even if os.name returns 'nt' as that will be an
      unicode.
      We either need to encode every occurence of os.name or have a
      new variable which is much cleaner. Now we have pycompat.osname.
      There are around 53 occurences of os.name in the codebase which needs to
      be replaced by pycompat.osname to support Python 3.
      3874ddba1ab4
  4. Nov 06, 2016
    • Pulkit Goyal's avatar
      py3: make util.datapath a bytes variable · 8321b083a83d
      Pulkit Goyal authored
      In this patch we make util.datapath a bytes variable, but we have to pass a
      unicode to gettext.translation otherwise it will cry. Used pycompat.fsdecode()
      to decode it back to unicode as it was converted to bytes using
      pycompat.fsencode().
      8321b083a83d
  5. Nov 05, 2016
  6. Nov 03, 2016
    • Durham Goode's avatar
      manifest: remove manifest.readshallowdelta · f65faa4422c8
      Durham Goode authored
      This removes manifest.readshallowdelta and converts its one consumer to use
      manifestlog instead.
      f65faa4422c8
    • Durham Goode's avatar
      manifest: get rid of manifest.readshallowfast · bce79dfcf5e4
      Durham Goode authored
      This removes manifest.readshallowfast and converts it's one user to use
      manifestlog instead.
      bce79dfcf5e4
    • Durham Goode's avatar
      manifest: add shallow option to treemanifestctx.readdelta and readfast · 78f3c7166f0d
      Durham Goode authored
      The old manifest had different functions for performing shallow reads, shallow
      readdeltas, and shallow readfasts. Since a lot of the code is duplicate (and
      since those functions don't make sense on a normal manifestctx), let's unify
      them into flags on the existing readdelta and readfast functions.
      
      A future diff will change consumers of these functions to use the manifestctx
      versions and will delete the old apis.
      78f3c7166f0d
    • Durham Goode's avatar
      manifest: change manifestlog mancache to be directory based · d4b340bf68c5
      Durham Goode authored
      In the last patch we added a get() function that allows fetching directory level
      treemanifestctxs. It didn't handle caching at directory level though, so we need to
      change our mancache to support multiple directories.
      d4b340bf68c5
    • Durham Goode's avatar
      manifest: add manifestlog.get to obtain subdirectory instances · dc21ea3323c4
      Durham Goode authored
      Previously manifestlog only allowed obtaining root level manifests. Future
      patches will need direct access to subdirectory manifests as part of changegroup
      creation, so let's add a get() function that knows how to deal with
      subdirectories.
      dc21ea3323c4
    • Durham Goode's avatar
      manifest: throw LookupError if node not in revlog · 1a0c1ad57833
      Durham Goode authored
      When accessing a manifest via manifestlog[node], let's verify that the node
      actually exists and throw a LookupError if it doesn't. This matches the old read
      behavior, so we don't accidentally return invalid manifestctxs.
      
      We do this in manifestlog instead of in the manifestctx/treemanifestctx
      constructors because the treemanifest code currently relies on the fact that
      certain code paths can produce treemanifests without touching the revlogs (and
      it has tests that verify things work if certain revlogs are missing entirely, so
      they break if we add validation that tries to read them).
      1a0c1ad57833
  7. Oct 23, 2016
    • Gregory Szorc's avatar
      revlog: optimize _chunkraw when startrev==endrev · 1f92056c4066
      Gregory Szorc authored
      In many cases, _chunkraw() is called with startrev==endrev. When
      this is true, we can avoid an extra index lookup and some other
      minor operations.
      
      On the mozilla-unified repo, `hg perfrevlogchunks -c` says this
      has the following impact:
      
      ! read w/ reused fd
      ! wall 0.371846 comb 0.370000 user 0.350000 sys 0.020000 (best of 27)
      ! wall 0.337930 comb 0.330000 user 0.300000 sys 0.030000 (best of 30)
      
      ! read batch w/ reused fd
      ! wall 0.014952 comb 0.020000 user 0.000000 sys 0.020000 (best of 197)
      ! wall 0.014866 comb 0.010000 user 0.000000 sys 0.010000 (best of 196)
      
      So, we've gone from ~25x slower than batch to ~22.5x slower.
      
      At this point, there's probably not much else we can do except
      implement an optimized function in the index itself, including in C.
      1f92056c4066
  8. Oct 22, 2016
    • Gregory Szorc's avatar
      revlog: inline start() and end() for perf reasons · ceddc3d94d74
      Gregory Szorc authored
      When I implemented `hg perfrevlogchunks`, one of the things that
      stood out was N * _chunk() calls was ~38x slower than 1
      _chunks() call. Specifically, on the mozilla-unified repo:
      
      N*_chunk:  0.528997s
      1*_chunks: 0.013735s
      
      This repo has 352,097 changesets. So the average time per changeset
      comes out to:
      
      N*_chunk:  1.502us
      1*_chunks: 0.039us
      
      If you extrapolate these numbers to a repository with 1M changesets,
      that comes out to 1.502s versus 0.039s, which is significant.
      
      At these latencies, Python attribute lookups and function calls
      matter. So, this patch inlines some code to cut down on that overhead.
      
      The impact of this patch on N*_chunk() calls is clear:
      
      ! wall 0.528997 comb 0.520000 user 0.500000 sys 0.020000 (best of 19)
      ! wall 0.367723 comb 0.370000 user 0.350000 sys 0.020000 (best of 27)
      
      So, we go from ~38x slower to ~27x. A nice improvement. But there's
      still a long way to go.
      
      It's worth noting that functionality like revsets perform changelog
      lookups one revision at a time. So this code path is worth optimizing.
      ceddc3d94d74
  9. Oct 23, 2016
    • Gregory Szorc's avatar
      revlog: reorder index accessors to match data structure order · 0986f225c149
      Gregory Szorc authored
      Index entries are ordered tuples. We have accessors in the revlog
      class to map tuple offsets to names. To help reinforce the order,
      reorder the methods so they match the order of elements in the
      tuple. While I'm here, also sneak in some minimal documentation.
      0986f225c149
  10. Nov 03, 2016
    • Pierre-Yves David's avatar
      color: add the ability to display configured style to 'debugcolor' · d44c407a5999
      Pierre-Yves David authored
      The 'hg debugcolor' command gains a '--style' flag to display all the configured
      labels and their styles. This have many benefits:
      
       * discovering documented label,
       * checking consistency between label's style,
       * showing the actual style of a label.
      d44c407a5999
    • Pierre-Yves David's avatar
      color: sort output of 'debugcolor' · bb2dfc0ea5b4
      Pierre-Yves David authored
      The previous ordering were provided by the set. The new output is more stable
      and rational. In addition we have some logic to keep the '_background' version
      together to help readability.
      bb2dfc0ea5b4
    • Pierre-Yves David's avatar
      color: extract color and effect display from 'debugcolor' · 7556507f7197
      Pierre-Yves David authored
      We are about to introduce a second mode for 'hg debugcolor' that would list the
      known label and their configuration, so we split the code related to color and
      effect out of the main function.
      7556507f7197
    • Pierre-Yves David's avatar
      color: restore _style global after debugcolor ran · e1f6898a80e1
      Pierre-Yves David authored
      Before this change, running 'debugcolor' would destroy all color style for the
      rest of the process life. We now properly backup and restore the variable
      content. Using a global variable is sketchy in general and could probably be
      removed. However, this is a quest for another adventure.
      e1f6898a80e1
    • Pierre-Yves David's avatar
      color: add basic documentation to 'debugcolor' · 7a53458fae4e
      Pierre-Yves David authored
      This does not hurt.
      7a53458fae4e
    • Pierre-Yves David's avatar
      tests: merge 'test-push-hook-lock.t' into 'test-push.t' · e58acb4fc510
      Pierre-Yves David authored
      That test file is very small and is merge with the new 'test-push.t'. No logic
      is changed.
      
      We don't register this as a copy because is actually a "ypoc" merging two file
      together without replacing the destination and Mercurial cannot express that.
      e58acb4fc510
    • Pierre-Yves David's avatar
      tests: merge 'test-push-validation.t' into 'test-push.t' · 0269ab4f4371
      Pierre-Yves David authored
      That test file is very small and is merge with the new 'test-push.t'. No logic
      is changed but repository name are update to avoid collision.
      
      We don't register this as a copy because is actually a "ypoc" merging two file
      together without replacing the destination and Mercurial cannot express that.
      0269ab4f4371
    • Pierre-Yves David's avatar
      test: rename 'test-push-r.t' to 'test-push.t' · a8d2071c3373
      Pierre-Yves David authored
      We do not have a simple test for 'hg push' but we have multiple tiny tests for
      various aspect of it. We'll unify them into a single file, and we start with
      'test-push-r.t'. The code is unchanged but we renamed the repository used to
      avoid collision with other tests we'll import in coming changesets.
      
      Test timing for the record:
      
      start   end     cuser   csys    real      Test
        1.850   2.640   0.650   0.090   0.790   test-push-validation.t
        2.640   3.520   0.760   0.090   0.880   test-push-hook-lock.t
        0.000   1.850   1.560   0.210   1.850   test-push-r.t
      a8d2071c3373
    • Pierre-Yves David's avatar
      tests: simplify command script in 'test-push-r.t' · 24ea47037186
      Pierre-Yves David authored
      I came across this code by chance. The script of this test is a bit messy with a
      lot of unnecessary intermediate commands. We simplify the script and unify
      repository access through '-R'.
      
      In the process the update after the unbundle is dropped as it does not add
      anything to the tests.
      24ea47037186
  11. Nov 02, 2016
    • Pulkit Goyal's avatar
      py3: use encoding.environ in ui.py · e9fca89c6d58
      Pulkit Goyal authored
      Using source transformer we add b'' everywhere. So there are no chances
      that those bytes string will work with os.environ on Py3 as that returns a
      dict of unicodes. We are relying on the errors, even though no error is raised
      even in future, these pieces of codes will tend to do wrong things.
      if statements can result in wrong boolean and certain errors can be raised
      while using this piece of code. Let's not wait for them to happen, fix what is
      wrong. If this patch goes in, I will try to do it for all the cases.
      Leaving it as it is buggy.
      e9fca89c6d58
    • Pulkit Goyal's avatar
      py3: make scmposix.userrcpath() return bytes · c90a05124fae
      Pulkit Goyal authored
      We are making sure that we deal with bytes as much we can. This is a part
      of fixing functions so that they return bytes if they have to.
      Used encoding.environ to return bytes.
      
      After this patch, scmposix.userrcpath() returns bytes and scmutil.osrcpath()
      will also return bytes if the platform is posix. Functions is scmposix returns
      bytes on Python 3 now.
      c90a05124fae
  12. Nov 01, 2016
    • Jun Wu's avatar
      adjustlinkrev: remove unnecessary parameters · e81d72b4b0ae
      Jun Wu authored
      Since adjustlinkrev has "self", and is a method of a filectx object, it does
      not need path, filelog, filenode. They can be fetched from the "self"
      easily.
      e81d72b4b0ae
  13. Oct 31, 2016
  14. Nov 02, 2016
  15. Mar 19, 2015
  16. Oct 18, 2016
Loading