Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:19:27 -0400] rev 31533
util: reference __main__ in sys.modules as a sysstr
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:38:10 -0400] rev 31532
ui: convert to/from Unicode on Python 3 in ui.editor()
I considered making this I/O be done in terms of bytes, but that would
cause an observable regression for Windows users, as non-binary-mode
open does EOL conversion there. There are probably new encoding
dragons lurking here, so we may want to switch to using binary mode
and doing EOL conversion ourselves.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:12:03 -0400] rev 31531
manifest: refer to bytestrings as bytes, not str
Required on Python 3.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:11:37 -0400] rev 31530
manifest: use node.hex instead of .encode('hex')
The latter doesn't work on Python 3.
Martin von Zweigbergk <martinvonz@google.com> [Mon, 20 Mar 2017 21:40:28 -0700] rev 31529
pure: use int instead of long
Similar to the recent
73aa13bc8dac (revlog: use int instead of long,
2017-03-19).
Jun Wu <quark@fb.com> [Mon, 13 Mar 2017 22:30:07 -0700] rev 31528
histedit: inline cleanupnode
Move "cleanupnode" (unsafe strip) into "safecleanupnode" so it's impossible
to call the unsafe function directly.
This helps reduce future programming errors.
Jun Wu <quark@fb.com> [Mon, 13 Mar 2017 22:22:18 -0700] rev 31527
histedit: use safecleanupnode in _aborthistedit (
issue5500)
Now nobody in histedit calls the unsafe cleanupnode directly.
Jun Wu <quark@fb.com> [Mon, 13 Mar 2017 22:19:06 -0700] rev 31526
histedit: use safecleanupnode in _finishhistedit
This simplifies code a lot.
Jun Wu <quark@fb.com> [Mon, 13 Mar 2017 21:10:45 -0700] rev 31525
histedit: add a method to cleanup nodes safely
The new method will decide between:
- cleanupnode, which calls the unsafe repair.strip
- create obsmarkers
Ideally, nobody calls "cleanupnode" directly except for "safecleanupnode".
Rishabh Madan <rishabhmadan96@gmail.com> [Tue, 21 Mar 2017 07:22:13 +0530] rev 31524
py3: prove hg status works
Augie Fackler <augie@google.com> [Mon, 20 Mar 2017 22:06:57 -0400] rev 31523
localrepo: use node.hex instead of awkward .encode('latin1')
Spotted as an option by Yuya. Thanks!
Rishabh Madan <rishabhmadan96@gmail.com> [Tue, 21 Mar 2017 03:15:18 +0530] rev 31522
py3: prove hg config works
Yuya Nishihara <yuya@tcha.org> [Sat, 18 Mar 2017 21:02:20 +0900] rev 31521
templater: make pad() strip color codes before computing width (
issue5416)
Tested in ANSI mode. We might have to extend _ansieffectre to support
terminfo mode.
Yuya Nishihara <yuya@tcha.org> [Sat, 18 Mar 2017 20:50:15 +0900] rev 31520
templater: make pad() compute actual width
str.ljust() and .rjust() are based on byte length, which are valid only for
ASCII characters.
Yuya Nishihara <yuya@tcha.org> [Sat, 18 Mar 2017 20:38:44 +0900] rev 31519
templater: reject bad fillchar argument passed to pad()
Otherwise TypeError would be raised.
Yuya Nishihara <yuya@tcha.org> [Sat, 18 Mar 2017 20:11:15 +0900] rev 31518
color: insert color code after every "\e[0m" (
issue5413)
This assumes the last color wins, tested in ANSI mode. I guess terminfo mode
would work in the same way.
Yuya Nishihara <yuya@tcha.org> [Sat, 18 Mar 2017 19:59:47 +0900] rev 31517
debugtemplate: pass ui to templater so label() works
Follows up
3356bf61fa25.
Simon Farnsworth <simonfar@fb.com> [Mon, 20 Mar 2017 04:36:55 -0700] rev 31516
subrepo: move prompts out of the if (
issue5505)
Prompts weren't available in the else clause
Durham Goode <durham@fb.com> [Sun, 19 Mar 2017 11:42:17 -0700] rev 31515
merge: remove unnecessary matcher checks
As part of changing manifest.diff to accept a matcher, a previous patch added
matcher calls to each location in merge.manifestmerge that tested if 'x in mf'
to maintain the same behavior as before. After analyzing it further, this
matcher call isn't needed, and in fact hurts future patches ability to use the
matcher here.
Basically, all these 'if x in mf' checks were checking if a matched file's copy
source was in the matcher as well. This meant if you passed a matcher for just
file foo, it would not return file bar even if foo was a copy of bar. Since
manifestmerge cares about copy information, let's allow all lookups of copy
sources.
We also update one spot with a 'is not None' check, since it wasn't obvious that
the value could sometimes be None before, which broke when we called
matcher(None).
A future patch adds matcher optimizations to manifestmerge which causes this
code path to get covered by existing tests.
Durham Goode <durham@fb.com> [Sun, 19 Mar 2017 11:54:15 -0700] rev 31514
rebase: use one dirstateguard for entire rebase
Recently we switched rebases to run the entire rebase inside a single
transaction, which dramatically improved the speed of rebases in repos with
large working copies. Let's also move the dirstate into a single dirstateguard
to get the same benefits. This let's us avoid serializing the dirstate after
each commit.
In a large repo, rebasing 27 commits is sped up by about 20%.
I believe the test changes are because us touching the dirstate gave the
transaction something to actually rollback.
Durham Goode <durham@fb.com> [Fri, 10 Mar 2017 15:52:29 -0800] rev 31513
histedit: add histedit.singletransaction config option
This adds an option (which defaults to False) to run entire histedits in a
single transaction. This results in 20-25% faster histedits in large repos where
transaction startup cost is expensive.
I didn't want to enable this by default because it has some unfortunate side
effects. For instance, if a pretxncommit hook throws midway through the
histedit, it will rollback the entire histedit and lose any progress the user
had made. Same if the user aborts editting a commit message. It's still worth
turning this on for large repos, but probably not for normal sized repos.
Long term, once we have inmemory merging, we could do the entire histedit in
memory, without a transaction, then we could selectively rollback just parts of
it in the event of an exception.
Tested it by running the tests with
`--extra-config-opt=histedit.singletransaction=True`. The only failure was
related to the hook rollback issue I mention above.
Durham Goode <durham@fb.com> [Fri, 10 Mar 2017 15:43:31 -0800] rev 31512
histedit: pop action after the action is completed
We only want to pop the action after the action is completed, since if the
action aborts part way through we want it to remain at the front of the list so
continue/abort will start with it.
Previously we relied on the fact that we only serialized the state file at the
beginning of the action, so the pop wasn't serialized until the next iteration
of the loop. In a future patch we will be adding a large transaction around this
area, which means if we pop the list early it might get serialized if the action
throws a user InterventionRequired error, at which point the action is not in
the list anymore. So let's only pop it once the action is really truly done.
Durham Goode <durham@fb.com> [Fri, 10 Mar 2017 15:43:31 -0800] rev 31511
histedit: add transaction support to writing the state file
This will be used in a future diff to enable a single transaction around an
entire histedit.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:11:00 -0400] rev 31510
localrepo: forcibly copy list of filecache keys
On Python 3, keys() is more like iterkeys(), so we got in trouble for
mutating the dict while we're iterating here. Since the list of caches
should be relatively small, work around this difference by just
forcing a copy of the key list.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:10:02 -0400] rev 31509
localrepo: turn hook kwargs back into strs before calling hook
It might be better to ensure that the hook kwargs dict only has str
keys on Python 3. I'm torn.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:08:59 -0400] rev 31508
localrepo: ensure transaction id is fully bytes on py3
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:08:17 -0400] rev 31507
dirstate: use future-proof next(iter) instead of iter.next
The latter has been removed in Python 3.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:06:47 -0400] rev 31506
posix: tiptoe around tempfile module more delicately
Some of the values inside the tempfile calls here are str on Python 3,
so we've got to pass str in. Use fsdecode to work around the issue.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:05:48 -0400] rev 31505
posix: use open() instead of file()
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:05:28 -0400] rev 31504
revlog: use int instead of long
By my reading of PEP 237[0], this is completely safe and has been
since Python 2.2.
0: https://www.python.org/dev/peps/pep-0237/
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:02:42 -0400] rev 31503
error: use r-string to properly pop hints from **kw
Fixes the hint mixin on Python 3.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 14:17:07 -0400] rev 31502
dispatch: use pycompat.maplist to allow summing with args
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 14:12:38 -0400] rev 31501
pycompat: add maplist alias for old map behavior
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 14:23:30 -0400] rev 31500
dispatch: replace mayberepr with shellquote
The quoting logic here was actually insufficient, and would have had
bogus b-prefixes on Python 3. shellquote seems more appropriate
anyway. Surprisingly, only two tests have output changes, and both of
them look reasonable to me (both are in blackbox logs).
Spotted by Yuya during review.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 19 Mar 2017 12:44:45 -0400] rev 31499
color: sync text attributes and buffered text output on Windows (
issue5508)
I originally noticed that log output wasn't being colored after
3a4c0905f357,
but there were other complications too. With a bunch of untracked files, only
the first 1K of characters were colored pink, and the rest were normal white. A
single modified file at the top would also be colored pink.
Line buffering and full buffering are treated as the same thing in Windows [1],
meaning the stream is either buffered or not. I can't find any explicit
documentation to say stdout is unbuffered by default when attached to a console
(but some internet postings indicated that is the case[2]). Therefore, it seems
that explicit flushes are better than just not reopening stdout.
NB: pager is now on by default, and needs to be disabled to see any color on
Windows.
[1] https://msdn.microsoft.com/en-us/library/86cebhfs(v=vs.140).aspx
[2] https://sourceforge.net/p/mingw/mailman/message/
27121137/
Matt Harbison <matt_harbison@yahoo.com> [Sun, 19 Mar 2017 14:42:45 -0400] rev 31498
test-check-help: fix to work on Windows
The initial problem was `hg files` prints paths with '\', which gets removed
when piped (scanhelptopics.py failed to open 'hgext__init__.py'). Then, xargs
was invoking `hg help` with 'backout\r (esc)', which setting binary mode
prevents.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 01:01:25 -0400] rev 31497
branchmap: be more careful about using %d on ints
Not doing so breaks Python 3.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 00:16:39 -0400] rev 31496
util: use bytes re on bytes input in fspath
Fixes `hg add` on Python 3.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 00:16:08 -0400] rev 31495
util: use pycompat.bytestr in checkwinfilename
Fixes `hg add` on python3.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 00:22:04 -0400] rev 31494
dispatch: ensure repr is bytes in _mayberepr
Fixes command line arguments containing spaces on Python 3.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 00:21:26 -0400] rev 31493
dispatch: extract maybe-use-repr formatting to helper function
I think this makes the code much clearer. I had to think for a bit to
unpack the old-school `condition and if-true or if-false` dance, and
formatting argument lists here shouldn't be performance critical.
Augie Fackler <augie@google.com> [Sun, 19 Mar 2017 00:18:53 -0400] rev 31492
dispatch: consolidate formatting of arguments
This was getting done twice, and it's clever enough I'm about to split
it apart and then fix it for Python 3.
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 17 Mar 2017 05:10:58 +0530] rev 31491
py3: make the regular expression bytes to prevent TypeError
Yuya Nishihara <yuya@tcha.org> [Sat, 25 Feb 2017 17:29:30 +0900] rev 31490
pager: flush outputs before firing pager process
So that buffered outputs are always sent to the console.
Yuya Nishihara <yuya@tcha.org> [Sat, 25 Feb 2017 17:27:48 +0900] rev 31489
patchbomb: use modern pager to display -n/--test result (BC)
This should provide more consistent UX, but is a BC because the pager will
no longer be fired up for each message.
Yuya Nishihara <yuya@tcha.org> [Sat, 18 Mar 2017 16:02:14 +0900] rev 31488
httpconnection: make sure to clear progress of httpsendfile at EOF
read() should never raise EOFError. If it did, UnboundLocalError would occur
due to unassigned 'ret' variable.
This issue was originally reported to TortoiseHg:
https://bitbucket.org/tortoisehg/thg/issues/4707/
Yuya Nishihara <yuya@tcha.org> [Tue, 14 Mar 2017 18:23:59 +0900] rev 31487
py3: convert log opts to bytes-key dict
Now simple log command works.
Yuya Nishihara <yuya@tcha.org> [Tue, 14 Mar 2017 18:16:13 +0900] rev 31486
graphlog: pass function arguments without expansion
It's annoying on Python 3 because keys must be unicode type. Let's stop using
**opts expansion when not necessary.
Yuya Nishihara <yuya@tcha.org> [Fri, 17 Mar 2017 23:48:22 +0900] rev 31485
py3: call codecs.escape_decode() directly
The same rule as
3b7a6941a6ef applies.
Yuya Nishihara <yuya@tcha.org> [Fri, 17 Mar 2017 23:42:46 +0900] rev 31484
util: wrap s.decode('string_escape') calls for future py3 compatibility
Augie Fackler <augie@google.com> [Sat, 18 Mar 2017 12:27:52 -0400] rev 31483
merge with stable
Matt Harbison <matt_harbison@yahoo.com> [Sun, 05 Mar 2017 22:22:32 -0500] rev 31482
hgwebdir: add support for explicit index files
This is useful for when repositories are nested in --web-conf, and in the future
with hosted subrepositories. The previous behavior was only to render an index
at each virtual directory. There is now an explicit 'index' child for each
virtual directory. The name was suggested by Yuya, for consistency with the
other method names.
Additionally, there is now an explicit 'index' child for every repository
directory with a nested repository somewhere below it. This seems more
consistent with each virtual directory hosting an index, and more discoverable
than to only have an index for a directory that directly hosts a nested
repository. I couldn't figure out how to close the loop and provide one in each
directory without a deeper nested repository, without blocking a committed
'index' file. Keeping that seems better than rendering an empty index.
Jun Wu <quark@fb.com> [Fri, 17 Mar 2017 09:19:56 -0700] rev 31481
ui: move configlist parser to config.py
The list parser is complex and reusable without ui. Let's move it to
config.py.
This allows us to parse a list from a "pure" config object without going
through ui. Like, we can make "_trustusers" calculated from raw configs,
instead of making sure it's synchronized by calling "fixconfig"s.
Martin von Zweigbergk <martinvonz@google.com> [Fri, 17 Mar 2017 09:58:49 -0700] rev 31480
tests: allow ModuleNotFoundError in addition to ImportError
My environment (Python version? PYTHONPATH? something else?) raises
ModuleNotFoundError in test-check-py3-compat.t. This patch allows any
"*Error". The error string contains "error importing", so it seems
specific enough even after.
Augie Fackler <augie@google.com> [Wed, 15 Mar 2017 20:34:26 -0400] rev 31479
pager: skip running the pager if it's set to 'cat'
Avoid useless uses of cat.
Augie Fackler <augie@google.com> [Wed, 15 Mar 2017 20:33:47 -0400] rev 31478
pager: avoid shell=True on subprocess.Popen for better errors (
issue5491)
man(1) behaves as poorly as Mercurial without this change. This cribs
from git's run-command[0], which has a list of characters that imply a
string that needs to be run using 'sh -c'. If none of those characters
are present in the command string, we can use shell=False mode on
subprocess and get significantly better error messages (see the test)
when the pager process is invalid. With a complicated pager command
(that contains one of the unsafe characters), we behave as we do today
(which is no worse than git manages.)
I briefly tried tapdancing in a thread to catch early pager exits, but
it's just too perilous: you get races between fd duping operations and
a bad pager exiting, and it's too hard to differentiate between a
slow-bad-pager result and a fast-human-quit-pager-early result.
I've observed some weird variation in exit code handling in the "bad
experience" case in test-pager.t: on my Mac hg predictably exits
nonzero, but on Linux hg always exits zero in that case. For now,
we'll work around it with || true. :(
0: https://github.com/git/git/blob/
cddbda4bc87b9d2c985b6749b1cf026b15e2d3e7/run-command.c#L201
Rishabh Madan <rishabhmadan96@gmail.com> [Fri, 17 Mar 2017 19:12:22 +0530] rev 31477
py3: change explicit conversion of config value from str to pycompat.bytestr
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 13 Mar 2017 12:40:14 -0700] rev 31476
py3: add __bool__ to every class defining __nonzero__
__nonzero__ was renamed to __bool__ in Python 3. This patch simply
aliases __bool__ to __nonzero__ for every class implementing
__nonzero__.
Martin von Zweigbergk <martinvonz@google.com> [Mon, 13 Mar 2017 21:58:43 -0700] rev 31475
merge: also allow 'e' action with experimental.updatecheck=noconflict
With experimental.updatecheck=noconflict set, if one checks out
f3398f1f70a0 (tests: add execute bit and fix shbang line, 2015-12-22)
and then try to check out its parent, hg will complain about
conflicting changes, even though the working directory is clean. We
need to also allow the 'e' action in merge.py. The 'e' action is used
when moving to a commit where the only change to the file is to its
executable flag, so it's just an optimized 'g' action.
Doesn't seem to be worth writing a test for, since the existing setup
in test-update-branches.t does not set any flags.
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 16 Mar 2017 12:33:15 -0700] rev 31474
exchange: use v2 bundles for modern compression engines (
issue5506)
Previously, `hg bundle zstd` on a non-generaldelta repo would
attempt to use a v1 bundle. This would fail because zstd is not
supported on v1 bundles.
This patch changes the behavior to automatically use a v2 bundle
when the user explicitly requests a bundlespec that is a compression
engine not supported on v1. If the bundlespec is <engine>-v1, it is
still explicitly rejected because that request cannot be fulfilled.
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 16 Mar 2017 12:23:56 -0700] rev 31473
exchange: reject new compression engines for v1 bundles (
issue5506)
Version 1 bundles only support a fixed set of compression engines.
Before this change, we would accept any compression engine for v1
bundles, even those that may not work on v1. This could lead to
an error.
We define a fixed set of compression engines known to work with v1
bundles and we add checking to ensure a newer engine (like zstd)
won't work with v1 bundles.
I also took the liberty of adding test coverage for unknown compression
names because I noticed we didn't have coverage of it before.
Martijn Pieters <mjpieters@fb.com> [Sun, 12 Mar 2017 11:43:31 -0700] rev 31472
config: honour the trusted flag in ui.configbytes
Jun Wu <quark@fb.com> [Wed, 15 Mar 2017 20:43:12 -0700] rev 31471
osutil: fix potential wrong fd close
According to POSIX closedir [1]:
If a file descriptor is used to implement type DIR, that file descriptor
shall be closed.
According to POSIX fdopendir [2]:
Upon calling closedir() the file descriptor shall be closed.
So we should avoid "close(dfd)" after "closedir(dir)". With threads, there
could be a race where an innocent fd gets closed. But Python GIL seems to
help hiding the issue well.
[1]: http://pubs.opengroup.org/onlinepubs/
009695399/functions/closedir.html
[2]: http://pubs.opengroup.org/onlinepubs/
9699919799/functions/fdopendir.html
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 09 Mar 2017 12:09:31 -0800] rev 31470
parsers: use Python memory allocator for indexObject->offsets
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 09 Mar 2017 12:02:59 -0800] rev 31469
parsers: use Python memory allocator in commonancestorsheads()
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 09 Mar 2017 11:56:47 -0800] rev 31468
osutil: use Python memory allocator in _listdir
The Python memory allocator has performance advantages
for small allocations.
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 09 Mar 2017 11:54:25 -0800] rev 31467
bdiff: use Python memory allocator in fixws
Python has its own memory allocation APIs. For allocations
<= 512 bytes, it allocates memory from arenas. This means that
average small allocations don't call the system allocator, which
makes them faster. Also, arena allocations cut down on memory
fragmentation, which can matter for performance in long-running
processes.
Another advantage of using the Python memory allocator is that
allocations are tracked by Python. This is a bigger deal in
Python 3, as modern versions of Python have some decent built-in
tools for examining memory usage, leaks, etc.
This patch converts a trivial malloc() + free() in the bdiff code
to use the Python allocator APIs. Since the object being
operated on is a line, chances are it will use an arena. So,
this could have a net positive impact on performance (although
I didn't measure it).
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Thu, 16 Mar 2017 11:17:55 -0700] rev 31466
localrepo: fix deprecation warning version of wfile
The patch lingered a bit too long in my local clone and I messed up when I
updated the version number. Since nobody caught it, I'm fixing the version after
the fact.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Wed, 15 Mar 2017 15:07:14 -0700] rev 31465
util: explicitly tests for None
Changeset
8b6927eb7efd removed the mutable default value, but did not explicitly
tested for None. Such implicit checking can introduce semantic and performance
issue. We move to an explicit check for None as recommended by PEP8:
https://www.python.org/dev/peps/pep-0008/#programming-recommendations
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Wed, 15 Mar 2017 15:38:02 -0700] rev 31464
context: simplify call to icase matcher in 'match()'
The two function takes the very same arguments. We make this clearer and less
error prone by dispatching on the function only and having a single call point
in the code.
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 16 Mar 2017 09:13:13 +0530] rev 31463
py3: make sure using bytes status char rather than ascii values
'MAR!?IC' is converted to their ascii values when slicing through it. This
patch uses pycompat.iterbytestr() to get bytes value.
Jun Wu <quark@fb.com> [Thu, 16 Mar 2017 14:27:41 -0700] rev 31462
shelve: get rid of ui.backupconfig
Jun Wu <quark@fb.com> [Thu, 16 Mar 2017 14:40:34 -0700] rev 31461
rebase: get rid of ui.backupconfig
Jun Wu <quark@fb.com> [Thu, 16 Mar 2017 14:39:18 -0700] rev 31460
mq: get rid of ui.backupconfig
Jun Wu <quark@fb.com> [Thu, 16 Mar 2017 14:36:35 -0700] rev 31459
histedit: get rid of ui.backupconfig
Jun Wu <quark@fb.com> [Thu, 16 Mar 2017 14:34:35 -0700] rev 31458
record: get rid of ui.backupconfig
Jun Wu <quark@fb.com> [Thu, 16 Mar 2017 14:23:49 -0700] rev 31457
import: get rid of ui.backupconfig
Jun Wu <quark@fb.com> [Thu, 16 Mar 2017 14:18:50 -0700] rev 31456
clone: get rid of ui.backupconfig
Jun Wu <quark@fb.com> [Thu, 16 Mar 2017 14:15:20 -0700] rev 31455
commit: get rid of ui.backupconfig
Durham Goode <durham@fb.com> [Wed, 15 Mar 2017 15:48:57 -0700] rev 31454
branchmap: handle nullrev in setcachedata
906be86990 recently changed to switch from:
self._rbcrevs[rbcrevidx:rbcrevidx + _rbcrecsize] = rec
to
pack_into(_rbcrecfmt, self._rbcrevs, rbcrevidx, node, branchidx)
This causes an exception if rbcrevidx is -1 (i.e. the nullrev). The old code
handled this because python handles out of bound sets to arrays gracefully. The
new code throws because the self._rbcrevs buffer isn't long enough to write 8
bytes to. Normally it would've been resized by the immediately preceding line,
but because the 0 length buffer is greater than the idx (-1) times the size, no
resize happens.
Setting the branch for the nullrev doesn't make sense anyway, so let's skip it.
This was caught by external tests in the Facebook extensions repo, but I've
added a test here that catches the issue.
Yuya Nishihara <yuya@tcha.org> [Wed, 15 Mar 2017 23:28:39 +0900] rev 31453
py3: call codecs.escape_encode() directly
string_escape doesn't exist on Python 3, but fortunately the undocumented
codecs.escape_encode() function exists on CPython 2.6, 2.7, 3.5 and PyPy 5.6.
So let's use it for now.
http://stackoverflow.com/a/
23151714
Yuya Nishihara <yuya@tcha.org> [Wed, 15 Mar 2017 23:21:30 +0900] rev 31452
templatekw: make join() escape values of extras (BC) (
issue5504)
Since extras may contain blob, the default template escapes its values:
'extra': '{key}={value|stringescape}'
join() should follow the output style of the default template.
Yuya Nishihara <yuya@tcha.org> [Wed, 15 Mar 2017 23:06:50 +0900] rev 31451
util: wrap s.encode('string_escape') call for future py3 compatibility
Yuya Nishihara <yuya@tcha.org> [Mon, 13 Mar 2017 09:24:53 -0700] rev 31450
py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org> [Mon, 13 Mar 2017 09:19:07 -0700] rev 31449
py3: call strftime() with native str type
Since strftime() may contain non-ascii character if locale set, we use
strfrom/tolocal().
Now "hg tip" works.
Yuya Nishihara <yuya@tcha.org> [Mon, 13 Mar 2017 09:12:56 -0700] rev 31448
encoding: add converter between native str and byte string
This kind of encoding conversion is unavoidable on Python 3.
Yuya Nishihara <yuya@tcha.org> [Mon, 13 Mar 2017 09:11:08 -0700] rev 31447
encoding: factor out unicode variants of from/tolocal()
Unfortunately, these functions will be commonly used on Python 3.
Yuya Nishihara <yuya@tcha.org> [Mon, 13 Mar 2017 08:53:31 -0700] rev 31446
py3: use next() to obtain next item from inner generator of generatorset
.next attribute does not exist on Python 3. As this function seems to really
care about the overhead of the Python interpreter, I follow the way of micro
optimization.
Yuya Nishihara <yuya@tcha.org> [Mon, 13 Mar 2017 08:44:57 -0700] rev 31445
py3: rewrite itervalues() as values() by importer
I'm not a great fan of these importer magics, but this should be okay since
"itervalues" seems as unique name as "iteritems".
Yuya Nishihara <yuya@tcha.org> [Sun, 12 Mar 2017 17:20:42 -0700] rev 31444
py3: use portable way to stringify cache key of repoview
Kostia Balytskyi <ikostia@fb.com> [Mon, 13 Mar 2017 12:44:13 -0700] rev 31443
exewrapper: prefer HackableMercurial python if availbale
Currently hg.exe will only try to load python27.dll from hg-python
subdir if PYTHONHOME environment variable is not set. I think that
it is better to check whether 'hg-python' subdir exists and load
python from it in that case, regardless of environment. This allows
for reliable approach of distributing Mercurial with its own Python.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Tue, 14 Mar 2017 23:07:08 -0700] rev 31442
import-checkers: split tests of the tool from running it on the source
We did such splits for other tools already. The 'test-check-*.t' performs the
check of the source code while the regular tests verifies the tools works.
One of the benefit is that is provides a simple file to reuse in third party
extensions.
Yuya Nishihara <yuya@tcha.org> [Thu, 16 Mar 2017 21:36:21 +0900] rev 31441
py3: use bytestr wrapper in revsetlang.tokenize()
This backs out
77270ec0cdd9 and wraps program by bytestr() instead.
Yuya Nishihara <yuya@tcha.org> [Thu, 16 Mar 2017 21:33:25 +0900] rev 31440
py3: use bytestr wrapper in revsetlang.formatspec()
This backs out
1c48a8278b2f and wraps expr by bytestr() instead.
Yuya Nishihara <yuya@tcha.org> [Wed, 08 Mar 2017 22:48:26 +0900] rev 31439
pycompat: add bytestr wrapper which mostly acts as a Python 2 str
This allows us to handle bytes in mostly the same manner as Python 2 str,
so we can get rid of ugly s[i:i + 1] hacks:
s = bytestr(s)
while i < len(s):
c = s[i]
...
This is the simpler version of the previous RFC patch which tried to preserve
the bytestr type if possible. New version simply drops the bytestr wrapping
so we aren't likely to pass a bytestr to a function that expects Python 3
bytes.
Yuya Nishihara <yuya@tcha.org> [Wed, 08 Mar 2017 22:13:32 +0900] rev 31438
tests: allow running doctests selectively on Python 3
Currently most doctests fail on Python 3, but I want to add some.