Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 23:12:07 -0400] rev 37755
largefiles: opts appears to already be bytes in this instance
test-largefiles.t now passes.
Differential Revision: https://phab.mercurial-scm.org/D3364
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 23:58:13 -0400] rev 37754
tests: port inline extensions in test-hook.t to py3
This test *almost* passes now, but some import errors print very
differently in ways that seem at least somewhat important.
Differential Revision: https://phab.mercurial-scm.org/D3363
Augie Fackler <augie@google.com> [Sat, 14 Apr 2018 00:10:17 -0400] rev 37753
tests: manually print list in test-hook.t
Changes the output a bit, but not in an important way.
Differential Revision: https://phab.mercurial-scm.org/D3362
Augie Fackler <augie@google.com> [Sat, 14 Apr 2018 00:08:59 -0400] rev 37752
hook: also use pprint on lists for stable output on py2/3
Differential Revision: https://phab.mercurial-scm.org/D3361
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 23:56:11 -0400] rev 37751
hook: use stringutil.pprint instead of reinventing it
Differential Revision: https://phab.mercurial-scm.org/D3360
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 23:57:57 -0400] rev 37750
stringutil: make b prefixes on string output optional
I need this to preserve some behavior in hook.py.
Differential Revision: https://phab.mercurial-scm.org/D3359
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 23:55:37 -0400] rev 37749
stringutil: teach pprint how to format None
Differential Revision: https://phab.mercurial-scm.org/D3358
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 23:50:17 -0400] rev 37748
tests: update inline extensions in test-bundle2-exchange.t to py3
The test doesn't pass for what superficially look like good
reasons. We'll need to come back to it later.
# skip-blame because it's b prefixes and a couple of b'N' instead of str(N)
Differential Revision: https://phab.mercurial-scm.org/D3357
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 23:11:46 -0400] rev 37747
wsgicgi: un-do some prior porting work that is now wrong
The Python 3 WSGI behavior is that the environ dict should be full of
unicodes. We previously tried Too Hard here, so we unwind that bit of porting.
Also add some bytesurl() encodes on status and headers.
test-clone-cgi.t now passes.
Differential Revision: https://phab.mercurial-scm.org/D3356
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 22:36:54 -0400] rev 37746
hgweb_mod: inform hgweb class about paths actually being bytes
Differential Revision: https://phab.mercurial-scm.org/D3355
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 22:33:38 -0400] rev 37745
hgweb: inform hgweb.hgweb() entrypoint that paths should be bytes
Differential Revision: https://phab.mercurial-scm.org/D3354
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 22:27:16 -0400] rev 37744
tests: port inline cgi script in test-largefiles.t to python 3
Differential Revision: https://phab.mercurial-scm.org/D3353
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 22:26:57 -0400] rev 37743
lfcommands: use %d on known-int in format string
Differential Revision: https://phab.mercurial-scm.org/D3352
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 22:12:30 -0400] rev 37742
py3: fix test-shelve.t on Python 3
We get a better error message out of the abort here, which is fine.
Differential Revision: https://phab.mercurial-scm.org/D3351
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 21:53:07 -0400] rev 37741
tests: fix up a couple of minor bytes inconsistencies in run-tests.py
Only in the automatic bisection code, so fortunately nothing major is
amiss. Fixes test-run-tests.t under Python 3.
Differential Revision: https://phab.mercurial-scm.org/D3350
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 21:51:10 -0400] rev 37740
tests: make sure test-run-tests.t actually runs run-tests.py under Python 3
I'm fairly certain it hasn't been until now. Mercifully, there doesn't
appear to be any ninja breakage.
Differential Revision: https://phab.mercurial-scm.org/D3349
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 21:30:55 -0400] rev 37739
py3: another three passing
Differential Revision: https://phab.mercurial-scm.org/D3348
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 21:11:28 -0400] rev 37738
httppeer: work around API differences on urllib Request objects
Since this is only a problem in httppeer, I'd rather keep this a
local-to-the-module kludge rather than pile more on pycompat. We'll
still find it easily to clean up later because it checks
pycompat.ispy3.
Differential Revision: https://phab.mercurial-scm.org/D3347
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 21:07:18 -0400] rev 37737
httppeer: no matter what Python 3 might think, http headers are bytes
Differential Revision: https://phab.mercurial-scm.org/D3346
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 21:06:50 -0400] rev 37736
httppeer: fix debug prints to work on Python 3
Differential Revision: https://phab.mercurial-scm.org/D3345
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 21:04:25 -0400] rev 37735
url: some bytes/str cleanup where we interface with stdlib funcs
Differential Revision: https://phab.mercurial-scm.org/D3344
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 21:01:17 -0400] rev 37734
hgweb: these strings should be sysstrs, not bytes
Differential Revision: https://phab.mercurial-scm.org/D3343
Augie Fackler <augie@google.com> [Fri, 13 Apr 2018 21:22:05 -0400] rev 37733
tests: port inline extensions in test-http.t to Python 3
Differential Revision: https://phab.mercurial-scm.org/D3342
Jun Wu <quark@fb.com> [Mon, 09 Apr 2018 15:58:30 -0700] rev 37732
patch: implement a new worddiff algorithm
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
Jun Wu <quark@fb.com> [Mon, 19 Mar 2018 04:28:30 -0700] rev 37731
patch: buffer lines for a same hunk
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
Jun Wu <quark@fb.com> [Mon, 19 Mar 2018 04:28:29 -0700] rev 37730
patch: move yielding "\n" to the end of loop
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
Martin von Zweigbergk <martinvonz@google.com> [Mon, 16 Apr 2018 09:39:40 -0700] rev 37729
context: clarify deprecation warning message
I had one developer report that they couldn't find the message. This
patch should make it clear where to find it.
Differential Revision: https://phab.mercurial-scm.org/D3389
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 15 Apr 2018 10:37:29 -0700] rev 37728
wireprotov2: add support for more response types
This adds types to represent error and generator responses from
server commands.
Differential Revision: https://phab.mercurial-scm.org/D3388
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 14 Apr 2018 15:38:11 -0700] rev 37727
wireprotov2: remove support for sending bytes response
We recently declared that all responses must be CBOR. So remove
support for sending a type that isn't CBOR data.
Differential Revision: https://phab.mercurial-scm.org/D3387
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 14 Apr 2018 15:36:12 -0700] rev 37726
wireprotov2: change behavior of error frame
Now that we have a leading CBOR map in command response frames
to indicate overall command result status, we don't need to use
the error response frame to represent command errors. Instead,
we can reserve it for protocol and server level errors. And for the
special case of a command error that occurred after command response
frames were emitted.
The code for error handling still needs a ton of work. But we're
slowly going in the right direction...
Differential Revision: https://phab.mercurial-scm.org/D3386