Skip to content
Snippets Groups Projects
  1. Mar 22, 2017
  2. Mar 23, 2017
    • Yuya Nishihara's avatar
      similar: use cheaper hash() function to test exact matches · 985a98c6
      Yuya Nishihara authored
      We just need a hash table {fctx.data(): fctx} which doesn't keep fctx.data()
      in memory. Let's simply use hash(fctx.data()) to put data out from memory,
      and manage collided fctx objects by list.
      
      This isn't significantly faster than using sha1, but is more correct as we
      know SHA-1 collision attack is getting practical.
      
      Benchmark with 50k added/removed files, on tmpfs:
      
        $ hg addremove --dry-run --time -q
      
        previous:   real 12.420 secs (user 11.120+0.000 sys 1.280+0.000)
        this patch: real 12.350 secs (user 11.210+0.000 sys 1.140+0.000)
      985a98c6
    • Yuya Nishihara's avatar
      similar: take the first match instead of the last · 2efd9771
      Yuya Nishihara authored
      It seems more natural. This makes the next patch slightly cleaner.
      2efd9771
    • Yuya Nishihara's avatar
      similar: do not look up and create filectx more than once · 2e254165
      Yuya Nishihara authored
      Benchmark with 50k added/removed files, on tmpfs:
      
        $ hg addremove --dry-run --time -q
      
        previous:   real 16.070 secs (user 14.470+0.000 sys 1.580+0.000)
        this patch: real 12.420 secs (user 11.120+0.000 sys 1.280+0.000)
      2e254165
    • Yuya Nishihara's avatar
      similar: use common names for changectx variables · b1528d19
      Yuya Nishihara authored
      We generally use 'wctx' and 'pctx' for working context and its parent
      respectively.
      b1528d19
    • Yuya Nishihara's avatar
      similar: get rid of quadratic addedfiles.remove() · d3e2af4e
      Yuya Nishihara authored
      Instead, build a set of files to be removed and recreate addedfiles
      only if necessary.
      
      Benchmark with 50k added/removed files, on tmpfs:
      
        $ hg addremove --dry-run --time -q
      
        original:   real 16.550 secs (user 15.000+0.000 sys 1.540+0.000)
        previous:   real 16.730 secs (user 15.280+0.000 sys 1.440+0.000)
        this patch: real 16.070 secs (user 14.470+0.000 sys 1.580+0.000)
      d3e2af4e
  3. Mar 15, 2015
    • Yuya Nishihara's avatar
      similar: sort files not by object id but by path for stable result · 3a383caa
      Yuya Nishihara authored
      Perhaps the original implementation would want to sort added/removed files
      alphabetically, but actually it did sort fctx objects by memory location.
      
      This patch removes the use of set()s in order to preserve the order of
      added/removed files. addedfiles.remove() becomes quadratic, but its cost
      appears not dominant. Anyway, the quadratic behavior will be eliminated by
      the next patch.
      
      Benchmark with 50k added/removed files, on tmpfs:
      
        $ mkdir src
        $ for n in `seq 0 49`; do
        >     mkdir `printf src/%02d $n`
        > done
      
        $ for n in `seq 0 49999`; do
        >     f=`printf src/%02d/%05d $(($n/1000)) $n`
        >     dd if=/dev/urandom of=$f bs=8k count=1 status=none
        > done
      
        $ hg ci -qAm 'add 50k files of random content'
        $ mv src dest
      
        $ hg addremove --dry-run --time -q
      
        original:   real 16.550 secs (user 15.000+0.000 sys 1.540+0.000)
        this patch: real 16.730 secs (user 15.280+0.000 sys 1.440+0.000)
      3a383caa
  4. Mar 12, 2017
  5. Mar 21, 2017
  6. Mar 22, 2017
    • Gregory Szorc's avatar
      py3: stop exporting urlparse from pycompat and util (API) · 55c6788c
      Gregory Szorc authored
      There are no consumers of this in tree.
      
      Functions formerly available on this object/module can now be accessed
      via {pycompat,util}.urlreq.
      55c6788c
    • Gregory Szorc's avatar
    • Gregory Szorc's avatar
      tests: use urlreq in tinyproxy.py · b2a41a82
      Gregory Szorc authored
      This is our last consumer of util.urlparse.
      b2a41a82
    • Gregory Szorc's avatar
      bugzilla: use util.urlreq.urlparse · 29fcfb98
      Gregory Szorc authored
      And stop saving a module variable because it shouldn't be
      necessary.
      29fcfb98
    • Gregory Szorc's avatar
      pycompat: define urlreq.urlparse and urlreq.unparse aliases · e68932df
      Gregory Szorc authored
      Currently, we export urlparse via util.urlparse then
      call util.urlparse.urlparse() and util.urlparse.urlunparse()
      in a few places. This is the only url* module exported from
      pycompat, making it a one-off. So let's transition to urlreq
      to match everything else.
      
      Yes, we double import "urlparse" now on Python 2. This will
      be cleaned up in a subsequent patch.
      
      Also, the Python 3 functions trade in str/unicode not bytes.
      So we'll likely need to write a custom implementation that
      speaks bytes. But moving everyone to an abstracted API
      is a good first step.
      e68932df
    • Gregory Szorc's avatar
      pycompat: remove urlunquote alias · 6c977286
      Gregory Szorc authored
      It is duplicated by urlreq.unquote and is unused. Kill it.
      
      We retain the imports because it is re-exported via util.urlparse,
      which is used elsewhere.
      
      Since we no longer access attributes of urlparse at module load time,
      this change /should/ result in that module reverting to a lazy module.
      6c977286
    • Gregory Szorc's avatar
      util: use urlreq.unquote · 4ebecf33
      Gregory Szorc authored
      pycompat.urlreq.unquote and pycompat.urlunquote effectively alias the
      same thing. pycompat.urlunquote is only used once in the code base.
      So let's switch to urlreq.unquote.
      
      "Effectively" in the above paragraph is because pycompat.urlreq.unquote
      aliases urllib.unquote and pycompat.urlunquote aliases urlparse.unquote
      on Python 2. You might think one of urllib.unquote and urlparse.unquote
      is an alias to the other, but you would be incorrect. In fact, these
      functions are copies of each other. There is even a comment in the
      CPython source code saying to keep them in sync. You can't make this
      up.
      4ebecf33
    • Gregory Szorc's avatar
      pycompat: alias urlreq.unquote to unquote_to_bytes · c6df6a23
      Gregory Szorc authored
      Previously, urlreq.unquote aliased to urllib.parse.unquote,
      which returned a str/unicode. We like bytes, so switch urlreq.unquote
      to dispatch to urllib.parse.unquote_to_bytes.
      
      This required a minor helper function to register an alias under a
      different name from which it points. If this turns into a common
      pattern, we could likely teach _registeralias to accept tuple
      values defining the mapping. Until then, I didn't feel like
      adding complexity to _registeralias.
      c6df6a23
  7. Mar 19, 2017
  8. Mar 20, 2017
    • Jun Wu's avatar
      osutil: export a "getfstype" method · 102f2918
      Jun Wu authored
      This patch exports the "getfstype" method. So we can use it to enable
      hardlinks for known safe filesystems.
      
      The patch was tested manually via debugshell on a Linux system.
      "mercurial.osutil.getfstype" works as expected. It's hard to mount
      filesystem on user-space easily. I will add a test for real hardlink support
      to indirectly test this patch, after turning on real hardlinks support for
      certain whitelisted filesystems.
      102f2918
    • Jun Wu's avatar
      osutil: add a C function getting filesystem type · cc3ec302
      Jun Wu authored
      Currently it only has Linux filesystems, according to my Linux manpage,
      built at 2016-03-15.
      
      The code uses "if" instead of "switch" because there could be some
      duplicated values.
      cc3ec302
    • Jun Wu's avatar
      setup: test some header files · 3db113ee
      Jun Wu authored
      The next patch will use "statfs", which requires different header files on
      different platforms.
      
      Linux:
      
          sys/vfs.h or sys/statfs.h
      
      FreeBSD or OSX:
      
          sys/param.h and sys/mount.h
      
      Therefore test them so we can include the correct ones.
      3db113ee
    • Jun Wu's avatar
      setup: detect statfs · 312e6264
      Jun Wu authored
      statfs is not defined by POSIX but is available in various systems to help
      decide filesystem type. Let's detect it and set the macro HAVE_STATFS.
      312e6264
    • Jun Wu's avatar
      setup: add a function to test header files · 5a046021
      Jun Wu authored
      5a046021
    • Jun Wu's avatar
      setup: split "hasfunction" to test arbitrary code · 9639ff4a
      Jun Wu authored
      The next patch wants to test include files.
      9639ff4a
  9. Mar 15, 2017
    • Ryan McElroy's avatar
      rebase: add flag to require destination · 13dc00c2
      Ryan McElroy authored
      In some mercurial workflows, the default destination for rebase does not
      always work well and can lead to confusing behavior. With this flag enabled,
      every rebase command will require passing an explicit destination, eliminating
      this confusion.
      13dc00c2
    • Ryan McElroy's avatar
      update: add flag to require update destination · 79d98e1b
      Ryan McElroy authored
      In some mercurial workflows, the default destination for update does not
      always work well and can lead to confusing behavior. With this flag enabled,
      every update command will require passing an explicit destination, eliminating
      this confusion.
      79d98e1b
  10. Mar 20, 2017
  11. Mar 11, 2017
    • Kostia Balytskyi's avatar
      shelve: rename stripnodes to nodestoprune · 7c7d3ad7
      Kostia Balytskyi authored
      Since we are introducing obs-based shelve, we are no longer
      stripping temporary nodes, we are obsoleting them. Therefore
      it looks like stipnodes would be a misleading name, while
      prune has a connotaion of "strip but with obsolescense", so
      nodestoprune seems like a good rename.
      7c7d3ad7
  12. Mar 10, 2017
    • Kostia Balytskyi's avatar
      shelve: add an ability to write key-val data to a new type of shelve files · 7485e458
      Kostia Balytskyi authored
      Obsolescense-based shelve only needs metadata stored in .hg/shelved
      and if feels that this metadata should be stored in a
      simplekeyvaluefile format for potential extensibility purposes.
      I want to avoid storing it in an unstructured text file where
      order of lines determines their semantical meanings (as now
      happens in .hg/shelvedstate. .hg/rebasestate and I suspect other
      state files as well).
      
      Not included in this series, I have ~30 commits, doubling test-shelve.t
      in size and testing almost every tested shelve usecase for obs-shelve.
      Here's the series for the curious now: http://pastebin.com/tGJKx0vM
      I would like to send it to the mailing list and get accepted as well,
      but:
      1. it's big, so should I send like 6 patches a time or so?
      2. instead of having a commit per test case, it more like
         a commit per some amount of copy-pasted code. I tried to keep
         it meaningful and named commits somewhat properly, but it is
         far from this list standards IMO. Any advice on how to get it
         in without turning it into a 100 commits and spending many
         days writing descriptions?
      3. it makes test-shelve.t run for twice as long (and it is already
         a slow test). Newest test-shelve.r runs for ~1 minute.
      7485e458
    • Kostia Balytskyi's avatar
      scmutil: add a simple key-value file helper · 56acc425
      Kostia Balytskyi authored
      The purpose of the added class is to serve purposes like save files of shelve
      or state files of shelve, rebase and histedit. Keys of these files can be
      alphanumeric and start with letters, while values must not contain newlines.
      
      In light of Mercurial's reluctancy to use Python's json module, this tries
      to provide a reasonable alternative for a non-nested named data.
      Comparing to current approach of storing state in plain text files, where
      semantic meaning of lines of text is only determined by their oreder,
      simple key-value file allows for reordering lines and thus helps handle
      optional values.
      
      Initial use-case I see for this is obs-shelve's shelve files. Later we
      can possibly migrate state files to this approach.
      
      The test is in a new file beause I did not figure out where to put it
      within existing test suite. If you give me a better idea, I will gladly
      follow it.
      56acc425
  13. Mar 20, 2017
  14. Mar 21, 2017
Loading