This instance will be upgraded to Heptapod 0.21.0rc2 on 2021-04-16 at 14:00 UTC+2 (a few minutes of down time)

  1. 22 Oct, 2020 1 commit
  2. 17 Jul, 2020 1 commit
  3. 30 Apr, 2020 1 commit
    • Elmar Bartel's avatar
      diff: re-establish linear runtime performance · e58422afbc74
      Elmar Bartel authored
      The previous method with sum() and list() creates a new list object
      for every hunk. Then sum() is used to flatten out this sequence of
      lists.  The sum() function is not "lazy", but creates a new list object
      for every "+" operation and so this code had quadratic runtime behaviour.
      
      --HG--
      branch : stable
      e58422afbc74
  4. 02 Jan, 2020 1 commit
  5. 13 Jan, 2020 1 commit
  6. 18 Dec, 2019 1 commit
  7. 17 Dec, 2019 1 commit
  8. 21 Nov, 2019 1 commit
  9. 01 Dec, 2019 1 commit
  10. 14 Nov, 2019 1 commit
  11. 06 Jul, 2020 1 commit
  12. 10 Jul, 2020 1 commit
  13. 08 Nov, 2019 1 commit
    • Augie Fackler's avatar
      cleanup: remove pointless r-prefixes on single-quoted strings · 9f70512ae2cf
      Augie Fackler authored
      This is the promised second step on single-quoted strings. These had
      existed because our source transformer didn't turn r'' into b'', so we
      had tagged some strings as r-strings to get "native" strings on both
      Pythons. Now that the transformer is gone, we can dispense with this
      nonsense.
      
      Methodology:
      
      I ran
      
          hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$'  | xargs egrep --color=never -n  -- \[\^b\]\[\^a-z\]r\'\[\^\'\\\\\]\*\'\[\^\'\
      
      in an emacs grep-mode buffer, and then used a keyboard macro to
      iterate over the results and remove the r prefix as needed.
      
      # skip-blame removing unneeded r prefixes left over from Python 3 migration.
      
      Differential Revision: https://phab.mercurial-scm.org/D7306
      9f70512ae2cf
  14. 07 Nov, 2019 1 commit
    • Augie Fackler's avatar
      cleanup: remove pointless r-prefixes on double-quoted strings · 313e3a279828
      Augie Fackler authored
      This is only double-quoted strings. I'll do single-quoted strings as a
      second step. These had existed because our source transformer didn't
      turn r"" into b"", so we had tagged some strings as r-strings to get
      "native" strings on both Pythons. Now that the transformer is gone, we
      can dispense with this nonsense.
      
      Methodology:
      
      I ran
      
          hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$'  | xargs egrep --color=never -n  -- \[\^a-z\]r\"\[\^\"\\\\\]\*\"\[\^\"\]
      
      in an emacs grep-mode buffer, and then used a keyboard macro to
      iterate over the results and remove the r prefix as needed.
      
      # skip-blame removing unneeded r prefixes left over from Python 3 migration.
      
      Differential Revision: https://phab.mercurial-scm.org/D7305
      313e3a279828
  15. 10 Oct, 2019 3 commits
  16. 09 Oct, 2019 1 commit
  17. 08 Oct, 2019 1 commit
  18. 20 Jun, 2019 1 commit
  19. 20 Apr, 2018 1 commit
  20. 15 Apr, 2018 1 commit
    • Matt Harbison's avatar
      diff: invoke the file prefetch hook · 5e67c20915a7
      Matt Harbison authored
      By invoking it this deep within the command, we pick up both subrepo and hgweb
      support, as well as --patch support for commands that implement logopts.
      5e67c20915a7
  21. 09 Apr, 2018 1 commit
    • Jun Wu's avatar
      patch: implement a new worddiff algorithm · 35632d392279
      Jun Wu authored
      The previous worddiff algorithm has many problems. The major problem is it
      does a "similarity check" that selects a subset of matched lines to do
      inline diffs. It is a bad idea because:
      
        - The "similarity check" is non-obvious to users. For example, a simple
          change from "long long x" to "int64_t x" will fail the similarity check
          and won't be diff-ed as expected.
        - Selecting "lines" to diff won't work as people expect if there are line
          wrapping changes.
        - It has a sad time complexity if lines do not match, could be O(N^2)-ish.
      
      There are other problems in implementation details.
      
        - Lines can match across distant hunks (if the next hunk does not have
          "-" lines).
        - "difflib" is slow.
      
      The solution would be removing the "similarity check", and just diff all
      words in a same hunk. So no content will be missed and everything will be
      diff-ed as expected. This is similar to what code review tool like
      Phabricator does.
      
      This diff implements the word diff algorithm as described above. It also
      avoids difflib to be faster.
      
      Note about colors: To be consistent, "changed inserted" parts and "purely
      insertion blocks" should have a same color, since they do not exist in the
      previous version. Instead of highlighting differences, this patch chooses to
      dim common parts. This is also more consistent with Phabricator or GitHub
      webpage. That said, the labels are defined in a way that people can still
      highlight changed parts and leave purely inserted/deleted hunks use the
      "non-highlighted" color.
      
      As one example, running:
      
        hg log -pr df50b87d8f736aff8dc281f816bddcd6f306930c mercurial/commands.py \
          --config experimental.worddiff=1 --color=debug --config diff.unified=0
      
      The previous algorithm outputs:
      
        [diff.file_a|--- a/mercurial/commands.py	Fri Mar 09 15:53:41 2018 +0100]
        [diff.file_b|+++ b/mercurial/commands.py	Sat Mar 10 12:33:19 2018 +0530]
        [diff.hunk|@@ -2039,1 +2039,4 @@]
        [diff.deleted|-][diff.deleted.highlight|@command('^forget',][diff.deleted| ][diff.deleted.highlight|walkopts,][diff.deleted| _('[OPTION]... FILE...'), inferrepo=True)]
        [diff.inserted|+@command(]
        [diff.inserted|+    '^forget',]
        [diff.inserted|+    walkopts + dryrunopts,]
        [diff.inserted|+ ][diff.inserted.highlight|  ][diff.inserted| _('[OPTION]... FILE...'), inferrepo=True)]
        [diff.hunk|@@ -2074,1 +2077,3 @@]
        [diff.deleted|-    rejected = cmdutil.forget(ui, repo, m, prefix="",][diff.deleted.highlight| explicitonly=False)[0]]
        [diff.inserted|+    dryrun = opts.get(r'dry_run')]
        [diff.inserted|+    rejected = cmdutil.forget(ui, repo, m, prefix="",]
        [diff.inserted|+                              explicitonly=False, dryrun=dryrun)[0]]
      
      The new algorithm outputs:
      
        [diff.file_a|--- a/mercurial/commands.py	Fri Mar 09 15:53:41 2018 +0100]
        [diff.file_b|+++ b/mercurial/commands.py	Sat Mar 10 12:33:19 2018 +0530]
        [diff.hunk|@@ -2039,1 +2039,4 @@]
        [diff.deleted|-][diff.deleted.unchanged|@command(][diff.deleted.unchanged|'^forget',][diff.deleted.unchanged| ][diff.deleted.changed|walkopts][diff.deleted.unchanged|,][diff.deleted.changed| ][diff.deleted.unchanged|_('[OPTION]... FILE...'), inferrepo=True)]
        [diff.inserted|+][diff.inserted.unchanged|@command(]
        [diff.inserted|+][diff.inserted.changed|    ][diff.inserted.unchanged|'^forget',]
        [diff.inserted|+][diff.inserted.changed|    walkopts][diff.inserted.unchanged| ][diff.inserted.changed|+ dryrunopts][diff.inserted.unchanged|,]
        [diff.inserted|+][diff.inserted.changed|    ][diff.inserted.unchanged|_('[OPTION]... FILE...'), inferrepo=True)]
        [diff.hunk|@@ -2074,1 +2077,3 @@]
        [diff.deleted|-][diff.deleted.unchanged|    rejected = cmdutil.forget(ui, repo, m, prefix="",][diff.deleted.changed| ][diff.deleted.unchanged|explicitonly=False][diff.deleted.unchanged|)[0]]
        [diff.inserted|+][diff.inserted.changed|    dryrun = opts.get(r'dry_run')]
        [diff.inserted|+][diff.inserted.unchanged|    rejected = cmdutil.forget(ui, repo, m, prefix="",]
        [diff.inserted|+][diff.inserted.changed|                              ][diff.inserted.unchanged|explicitonly=False][diff.inserted.changed|, dryrun=dryrun][diff.inserted.unchanged|)[0]]
      
      Practically, when diffing a 8k line change, the time spent on worddiff
      reduces from 4 seconds to 0.14 seconds.
      
      Differential Revision: https://phab.mercurial-scm.org/D3212
      35632d392279
  22. 19 Mar, 2018 2 commits
    • Jun Wu's avatar
      patch: buffer lines for a same hunk · 5471348921c1
      Jun Wu authored
      Instead of yielding tokens directly, buffer them if they belong to a same
      hunk. This makes it easier for the upcoming new worddiff algorithm to only
      focus on the diff hunk, instead of having to worry about other contents.
      
      This breaks how the existing experimental worddiff algorithm works, so the
      algorithm was removed, and related tests are disabled for now. The next patch
      will add a new worddiff algorithm.
      
      Differential Revision: https://phab.mercurial-scm.org/D3211
      5471348921c1
    • Jun Wu's avatar
      patch: move yielding "\n" to the end of loop · 8d730f96e792
      Jun Wu authored
      The original logic makes it harder to reason about - it yields the "\n"
      character belonging to the last line in the next loop iteration.
      
      The new code is in theory a little bit slower. But is more readable. It
      makes the following changes easier to read.
      
      Differential Revision: https://phab.mercurial-scm.org/D3210
      8d730f96e792
  23. 13 Apr, 2018 1 commit
    • Gregory Szorc's avatar
      patch: make extract() a context manager (API) · 5537d8f5e989
      Gregory Szorc authored
      Previously, this function was creating a temporary file and relying
      on callers to unlink it. Yuck.
      
      We convert the function to a context manager and tie the lifetime of
      the temporary file to that of the context manager. This changed
      indentation not only from the context manager, but also from the
      elination of try blocks. It was just easier to split the heart of
      extract() into its own function.
      
      The single consumer of this function has been refactored to use it as
      a context manager. Code for cleaning up the file in tryimportone()
      has also been removed.
      
      .. api::
      
         ``patch.extract()`` is now a context manager. Callers no longer have
         to worry about deleting the temporary file it creates, as the file is
         tied to the lifetime of the context manager.
      
      Differential Revision: https://phab.mercurial-scm.org/D3306
      5537d8f5e989
  24. 09 Apr, 2018 5 commits
  25. 07 Oct, 2019 1 commit
    • Gregory Szorc's avatar
      py3: finish porting iteritems() to pycompat and remove source transformer · d783f945a701
      Gregory Szorc authored
      This commit finishes porting .iteritems() to pycompat.iteritems()
      for the mercurial package.
      
      The translation of .iteritems() to .items() was the last conversion
      performed by the source transformer. With the porting to pycompat
      complete, we no longer have a need for the source transformer. So
      the source transformer has been removed. Good riddance! The code
      base is now compatible with Python 2 and Python 3.
      
      For the record, as the person who introduced the source transformer,
      it brings me joy to delete it. It accomplished its goal to facilitate
      a port to Python 3 without overly burdening people on some painful
      low-level differences between Python 2 and 3. It is unfortunate we
      still have to wallpaper over many differences with the pycompat
      shim. But it is what it is.
      
      Differential Revision: https://phab.mercurial-scm.org/D7015
      d783f945a701
  26. 06 Oct, 2019 6 commits
    • Gregory Szorc's avatar
      py3: define and use pycompat.itervalues() · 74802979dd9d
      Gregory Szorc authored
      .itervalues() only exists on Python 2. Python 3's equivalent is
      .values(). But we don't want to blindly use .values() everywhere
      because on Python 2, it will create a list, which will have performance
      implications.
      
      This commit introduces pycompat.itervalues() which will call the appropriate
      method on the passed object. We update all callers of obj.itervalues()
      to pycompat.itervalues(obj) instead.
      
      With this commit, the only source tranforming remaining is for
      iteritems(). Victory is near...
      
      Differential Revision: https://phab.mercurial-scm.org/D7013
      74802979dd9d
    • Denis Laxalde's avatar
      import: read X-Mercurial-Node email header to determine nodeid · 27c4f93d07a9
      Denis Laxalde authored
      This would be useful to import and obsolete patches sent using 'hg email
      --plain', using evolve's --obsolete option of 'hg import'.
      
      If email body contains Mercurial patch header ('# HG changeset patch'
      block), nodeid parsed from X-Mercurial-Node header will still be
      overridden by respective value found in body.
      27c4f93d07a9
    • Gregory Szorc's avatar
      py3: manually import pycompat.open into files that need it · eef9a2d67051
      Gregory Szorc authored
      We want to eliminate the source transformer. Currently it inserts
      a `from mercurial.pycompat import ...` at the top of files to alias
      some builtins.
      
      This commit replaces the implicit import of `open` with an explicit
      import on files that need it and changes the source transformer to
      no longer import `open`.
      
      As part of this, we needed to store an explicit local for `open` in
      the Python 2 code path in `pycompat` so the import works. (Builtins
      that are automatically in scope cannot be imported.)
      
      Differential Revision: https://phab.mercurial-scm.org/D7005
      eef9a2d67051
    • Augie Fackler's avatar
      formatting: byteify all mercurial/ and hgext/ string literals · 687b865b95ad
      Augie Fackler authored
      Done with
      
          python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py')
          black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**')
      
      # skip-blame mass-reformatting only
      
      Differential Revision: https://phab.mercurial-scm.org/D6972
      687b865b95ad
    • Augie Fackler's avatar
      formatting: blacken the codebase · 2372284d9457
      Augie Fackler authored
      This is using my patch to black
      (https://github.com/psf/black/pull/826) so we don't un-wrap collection
      literals.
      
      Done with:
      
        hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
      
      # skip-blame mass-reformatting only
      
      # no-check-commit reformats foo_bar functions
      
      Differential Revision: https://phab.mercurial-scm.org/D6971
      2372284d9457
    • Denis Laxalde's avatar
      db33e4f25729
  27. 27 Aug, 2019 2 commits
    • Kyle Lippincott's avatar
      split: handle partial commit of renames when doing split or record (issue5723) · 3cf091843b4f
      Kyle Lippincott authored
      When using split or record, using either interface (text or curses), selecting
      portions of the file to be committed/recorded did not work; the entire file was
      treated as having been selected. This was because the logic for handling partial
      application of the patches relies on knowing what files are "new with
      modifications" and it doesn't treat "rename destination" as "new".
      
      There was a complicating issue, however. We're relying on the patch header
      specifying the copy from/to information, which works as long as the 'copy from'
      file is there. In the case of renames, however, the 'rename from' file is *not*
      there, so we need to add it back.
      
      Differential Revision: https://phab.mercurial-scm.org/D6768
      3cf091843b4f
    • Kyle Lippincott's avatar
      split: handle partial commit of copies when doing split or record · 1fd530b1e1cf
      Kyle Lippincott authored
      When using split or record, using either interface (text or curses), selecting
      portions of the file to be committed/recorded did not work; the entire file was
      treated as having been selected. This appears to be because the logic for
      handling partial application of the patches relies on knowing what files are
      "new with modifications", and it doesn't treat "copy destination" as "new".
      
      Handling renames correctly is more difficult and will be done in a later patch.
      
      Differential Revision: https://phab.mercurial-scm.org/D6767
      1fd530b1e1cf