Boris Feld <boris.feld@octobus.net> [Tue, 06 Feb 2018 11:51:39 +0100] rev 35964
dumprevlog: handle being passed a mode parameter
This makes it closer to an actual file opener. Otherwise, it gets in the way
of a coming refactoring.
Boris Feld <boris.feld@octobus.net> [Tue, 06 Feb 2018 11:08:41 +0100] rev 35963
changelog: add the missing 'closed' property on 'appender' object
This mimic file object further.
Boris Feld <boris.feld@octobus.net> [Mon, 05 Feb 2018 20:36:51 +0100] rev 35962
changelog: implement context manager method for 'appender' object
This object mimics a file and was missing the context manager API.
Joerg Sonnenberger <joerg@bec.de> [Sun, 04 Feb 2018 00:29:22 +0100] rev 35961
diff: improve ui.write performance when not coloring on Windows
Differential Revision: https://phab.mercurial-scm.org/D2022
Augie Fackler <augie@google.com> [Tue, 06 Feb 2018 05:25:36 -0500] rev 35960
hgsh: enable clang-format
Nothing looks awful, so we can just turn it on.
Differential Revision: https://phab.mercurial-scm.org/D2059
Augie Fackler <augie@google.com> [Tue, 06 Feb 2018 05:24:28 -0500] rev 35959
chg: enable clang-format on all .c and .h files
Nothing in here looks awful, so I think we may as well just do it.
# skip-blame because it's just reformatting with no functionality change
Differential Revision: https://phab.mercurial-scm.org/D2058
Augie Fackler <augie@google.com> [Wed, 07 Feb 2018 06:28:43 -0500] rev 35958
python3: whitelist an additional 11 tests
I think these are mostly the result of Pulkit's recent work. Thanks!
Differential Revision: https://phab.mercurial-scm.org/D2078
Yuya Nishihara <yuya@tcha.org> [Mon, 05 Feb 2018 20:48:51 +0900] rev 35957
ui: add explicit path to write prompt text bypassing buffers
The prompt= flag was added at
e35d7f131483, when colorui had its own write()
function. Since we've merged colorui to ui, we can simply call the unbuffered
write() function.
Yuya Nishihara <yuya@tcha.org> [Mon, 05 Feb 2018 20:40:49 +0900] rev 35956
ui: write prompt text in ui.prompt(), not in ui._readline()
self.label() is replaced by label= option, which should make it clearer why
we can't pass the text to raw_input(prompt).
Yuya Nishihara <yuya@tcha.org> [Sun, 21 Jan 2018 14:00:56 +0900] rev 35955
logcmdutil: mark changesetprinter.showpatch() as private
Yuya Nishihara <yuya@tcha.org> [Sun, 21 Jan 2018 14:28:03 +0900] rev 35954
logcmdutil: drop default arguments from changesetdisplayer/templater() calls
Yuya Nishihara <yuya@tcha.org> [Sun, 21 Jan 2018 13:47:06 +0900] rev 35953
logcmdutil: make default parameters of changesetprinters consistent
Yuya Nishihara <yuya@tcha.org> [Sun, 04 Feb 2018 10:33:14 +0900] rev 35952
mdiff: use str.startswith/endswith() instead of slicing
Yuya Nishihara <yuya@tcha.org> [Sun, 04 Feb 2018 10:28:03 +0900] rev 35951
patch: unify check_binary and binary flags
Follows up
079b27b5a869. If opts.text=True, check_binary is ignored, so we
can just pass the binary flag to unidiff().
perfunidiff now takes any inputs as text files, which I think is a desired
behavior.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 06 Feb 2018 23:53:37 -0500] rev 35950
fileset: don't abort when running copied() on a revision with a removed file
It looks like AND with any status-y fileset would trigger this, as added() and
removed() also failed. The 4.5-rc revision is a convenient test case, but the
merge isn't necessary.
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 07 Feb 2018 13:49:02 +0530] rev 35949
py3: make sure we open the file in bytes mode
# skip-blame because we are just adding b
Differential Revision: https://phab.mercurial-scm.org/D2077
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 07 Feb 2018 13:47:03 +0530] rev 35948
py3: use bytes instead of str
Differential Revision: https://phab.mercurial-scm.org/D2076
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 07 Feb 2018 13:34:51 +0530] rev 35947
py3: add b'' prefixes to string literals in test files
# skip-blame because we are just adding b''
Differential Revision: https://phab.mercurial-scm.org/D2075
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 07 Feb 2018 13:21:06 +0530] rev 35946
py3: use range instead of xrange
xrange is not available on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2074
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 07 Feb 2018 13:19:19 +0530] rev 35945
py3: use open() instead of file()
file() is not present in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2073
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 07 Feb 2018 13:17:19 +0530] rev 35944
py3: use pycompat.bytestr to convert _b85chars to bytes
The tranformer does append b'' to the value and make that a bytes but bytes in
Python 3 returns the ascii value on getting characters using indexing.
Characters of this string are queried using indexing multiple times in the file
and to support that we use pycompat.bytestr which returns the bytechrs using
indexing.
Differential Revision: https://phab.mercurial-scm.org/D2072
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 07 Feb 2018 13:11:38 +0530] rev 35943
py3: use pycompat.bytechr instead of chr
Differential Revision: https://phab.mercurial-scm.org/D2071
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 07 Feb 2018 13:10:24 +0530] rev 35942
py3: use pycompat.ziplist instead of zip
zip returns a zip object instead of a list on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2070
Boris Feld <boris.feld@octobus.net> [Tue, 06 Feb 2018 14:24:16 +0100] rev 35941
patches: move assignment outside the conditional
Having this movement in its own patch will make the next patch clearer.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 14:58:32 -0800] rev 35940
sshpeer: remove support for connecting to <0.9.1 servers (BC)
197d10e157ce made this change for the HTTP peer. Let's do the same
for the SSH peer.
Test output changes as expected. A redundant test has been dropped.
.. bc::
Support for connecting to Mercurial servers older than 0.9.1 has
been removed.
Differential Revision: https://phab.mercurial-scm.org/D2036
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 14:44:04 -0800] rev 35939
sshpeer: document the handshake mechanism
The mechanism by which SSH peers establish connections with remotes
is wonky and requires a bit of code archeology to understand. While
it is already documented in `hg help internals.wireproto`, it helps
to have documentation in the code as well.
Differential Revision: https://phab.mercurial-scm.org/D2035
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 05 Feb 2018 09:14:32 -0800] rev 35938
sshpeer: move handshake outside of sshpeer
With the handshake now performed before a peer class is instantiated,
we can now instantiate a different peer class depending on the results
of the handshake.
Our test extension had to change to cope with the new API. Because
we now issue the command via raw I/O calls and don't call
_callstream(), we no longer have to register the fake command.
(_callstream() uses the command registration to see what args to
send).
Differential Revision: https://phab.mercurial-scm.org/D2034
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 14:10:56 -0800] rev 35937
sshpeer: inline I/O into _validaterepo()
We want to move the handshake code out of the peer class so the
peer factory function can perform the handshake and instantiate
a proper class depending on the results. To make that refactor
easier to read, we first inline I/O functionality into
_validaterepo().
Test output for low-level protocol tests didn't change, thus
hopefully demonstrating that this refactor didn't change any
material behavior.
Because we no longer call _callstream(), our test extension for
monkeypatching the peer had to change its hook point.
Differential Revision: https://phab.mercurial-scm.org/D2033
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 05 Feb 2018 14:17:24 -0800] rev 35936
sshpeer: clean up API for sshpeer.__init__ (API)
Our refactoring left the state of sshpeer.__init__ in a poor
state. "create" was no longer used. Process/pipe arguments were
passed poorly. "name" was really a URL.
This commit cleans all that up.
.. api::
sshpeer.sshpeer.__init__ now receives arguments describing an
existing connection instead of creating a connection itself.
Differential Revision: https://phab.mercurial-scm.org/D2032
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 05 Feb 2018 14:05:59 -0800] rev 35935
sshpeer: establish SSH connection before class instantiation
We want to move the handshake to before peers are created so
we can instantiate a different peer class depending on the
results of the handshake. This necessitates moving the SSH
process invocation to outside the peer class.
As part of the code move, some variables were renamed for
clarity. util.popen4() returns stdin, stdout, and stderr in
their typical file descriptor order. However, stdin and stdout
were being mapped to "pipeo" and "pipei" respectively. "o"
for "stdin" and "i" for "stdout" is a bit confusing. Although
it does make sense for "output" and "input" from the perspective
of the client. But in the context of the new function, it makes
sense to refer to these as their file descriptor names.
In addition, the last use of self._path disappeared, so we stop
setting that attribute and we can delete the redundant URL
parsing necessary to set it.
Differential Revision: https://phab.mercurial-scm.org/D2031
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 11:40:13 -0800] rev 35934
sshpeer: remove frivolous call to _cleanup()
_validaterepo() is called once during __init__. _cleanup()
no-ops if the self._pipe* attributes aren't set. These attributes
are set during _validaterepo(). So the call to _cleanup() isn't
necessary.
But just to be on the safe side, we add an assertion.
Differential Revision: https://phab.mercurial-scm.org/D2030
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 11:37:19 -0800] rev 35933
sshpeer: extract pipe cleanup logic to own function
So it can be used outside of instantiated classes. This is
needed to support pipe creation before __init__ is called.
Differential Revision: https://phab.mercurial-scm.org/D2029
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 19:23:40 -0800] rev 35932
sshpeer: move ssh command and repo creation logic out of __init__
It was easier to move both of these at once because repository
creation requires various variables and I didn't want to add
tons of arguments and code to __init__ that will soon be deleted
anyway. We do add an extra argument so we can proxy values to the
_validaterepo() call. But this is minimally invasive.
Some callers of self._abort() were converted to just raise. Like
before, the _abort() call wasn't necessary because self._pipe*
aren't populated this early in the object's lifetime.
As part of this, various private attributes derived from the parsed
URL are no longer used. So we no longer set them.
Differential Revision: https://phab.mercurial-scm.org/D2028
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 12:55:18 -0800] rev 35931
sshpeer: move URL validation out of sshpeer.__init__
We will soon have another SSH peer class to support the new version
of the SSH protocol. However, we won't know which peer class to
instantiate until we perform a handshake on an active connection.
This means that we need to move connection establishment and handshake
code out of sshpeer.__init__.
This commit starts the process of migrating peer creation code
out of sshpeer.__init__ into instance(), which is the API for
creating peers.
The moved code no longer calls _abort(). _abort() runs _cleanup() and
raises. _cleanup() only performs actions on self._pipe*. These objects
aren't instantiated until we actually connect to the peer. So _abort()
was not necessary in the old code.
To keep the API the same, __init__() now makes a redundant call to
util.url(). This will be fixed in subsequent commits.
Differential Revision: https://phab.mercurial-scm.org/D2027
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 14:02:41 -0800] rev 35930
tests: add low-level SSH protocol tests
We don't really have good low-level tests for the behavior of the SSH
wire protocol. This commit attempts to establish some.
The added tests consist of a mixture of starting a server
with `hg serve --stdio` and sending bytes to it and using
`hg debugpeer` to go through the official client code. Having
insight into what raw bytes are exchanged as well as what the peer
does is useful.
We also introduce a test extension for modifying the behavior of
the SSH server and peer. For example, we change the server to
not recognize the "hello" command, simulating behavior of <0.9.1
servers.
These tests are generally useful to have. But the impetus for creating
them now is they will be needed for verifying behavior of old clients
and servers when a new SSH protocol is introduced.
Differential Revision: https://phab.mercurial-scm.org/D2026
# no-check-commit because of serve_forever()
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 03 Feb 2018 12:01:01 -0800] rev 35929
debugcommands: introduce debugpeer command
`hg debugpeer <path>` will establish a connection to a peer repository
and print information about it.
If you add --debug, it will log low-level protocol request info. This
will be useful for upcoming tests around protocol handshaking.
Differential Revision: https://phab.mercurial-scm.org/D2025
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Feb 2018 12:47:37 -0800] rev 35928
sshpeer: make "instance" a function
The API is that peer modules must provide an "instance" symbol
that is callable to return a peer.
Making "instance" a function instead of an alias to "sshpeer"
makes it easier to monkeypatch the "sshpeer" type. It will also
make it possible to turn instance() into a factory function of
sorts that returns different types based on connection properties.
Differential Revision: https://phab.mercurial-scm.org/D2024
Matt Harbison <matt_harbison@yahoo.com> [Sun, 04 Feb 2018 16:17:43 -0500] rev 35927
lfs: deduplicate oids in the transfer
Apparently, we can't rely on the server to deduplicate for us.
Sadly, the pointer object isn't hashable, so it can't be reduced by converting
it to a set. In order to be hashable, it needs to be immutable. I had a bunch
of code to change it to composition and forward the readonly dict methods to a
member dict. But the pointer is updated via __setitem__() when creating the
pointer file. So it didn't see worth adding all of that code to the class.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 04 Feb 2018 15:26:49 -0500] rev 35926
cat: call the storage prefetch hook
It's not important to call in the case of a single file, but maybe it's better
to do so for consistency.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 04 Feb 2018 14:31:32 -0500] rev 35925
archive: call the storage prefetch hook
Matt Harbison <matt_harbison@yahoo.com> [Sun, 04 Feb 2018 00:33:28 -0500] rev 35924
lfs: prefetch lfs blobs during revert
The revert command oddly prints out what it will do before requesting the files
to be prefetched. But the 'need to transfer' line indicates the blobs are being
grouped.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 04 Feb 2018 14:14:28 -0500] rev 35923
cmdutil: convert _revertprefetch() to a generic stored file hook (API)
This will be used by LFS to fetch required files in a group for multiple
commands, prior to being accessed. That avoids the one-at-a-time fetch when the
filelog wrapper goes to access it, and it is missing locally (which costs two
round trips to the server.) The core command list that needs this is probably
at least:
- annotate
- archive (which is also used by extdiff)
- cat
- diff
- export
- grep
- verify (sadly)
- anything that has the '{data}' template
There are no core users of the revert prefetch hook, and never have been since
it was introduced in
45e02cfad4bd for remotefilelog. Thanks to Yuya for
figuring out a way to reliably trigger the deprecated warning. Unfortunately,
it wanted to blame the caller of revert. Passing along an adjusted stack level
seemed the least bad choice (although it still blames a core function).
One thing to note is that the store lock isn't being held when this is called.
I'm not at all familiar with remotefilelog or its locking requirements, so this
may not be a big deal. Currently, LFS doesn't hold a lock when downloading
files. Even though largefiles doesn't either, I'm starting to think it should,
and maybe the .hg/store/lock isn't good enough to cover the globally shared
cache.
.. api::
The cmdutil._revertprefetch() hook point for prefetching stored files has
been replaced by the command agnostic cmdutil._prefetchfiles(). The new
function takes a list of files, instead of a list of lists of files.
Matt Harbison <matt_harbison@yahoo.com> [Sat, 03 Feb 2018 21:26:12 -0500] rev 35922
lfs: prefetch lfs blobs when applying merge updates
In addition to merge, this method ultimately gets called by many commands:
- backout
- bisect
- clone
- fetch
- graft
- import (without --bypass)
- pull -u
- rebase
- strip
- share
- transplant
- unbundle
- update
Additionally, it's also called by histedit, shelve, unshelve, and split, but it
seems that the related blobs should always be available locally for these.
For `hg update`, it happens after the normal argument checking and pre-update
hook processing, and remote corruption is detected prior to manipulating the
working directory. Other commands could use this treatment (archive, cat,
revert, etc), but this covers so many of the frequently used bulk commands, it
seems like a good starting point.
Losing the verbose message that prints the file name before a corrupt blob
aborts the command is a little sad, because there's no easy way to go from oid
to file name. I'd like to change that message to list the file name so it looks
cleaner and less cryptic, but the pointer object is nowhere near where it needs
to be to do this. So punt on that for now.
Matt Harbison <matt_harbison@yahoo.com> [Sat, 27 Jan 2018 14:53:16 -0500] rev 35921
lfs: factor out a method for extracting the pointer of a single file
This will be useful for filesets, among other things, instead of traversing the
whole context.
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 05 Feb 2018 13:24:02 +0530] rev 35920
py3: add b'' to literals in check-config.py
# skip-blame because we are just adding b''
Differential Revision: https://phab.mercurial-scm.org/D2046
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:40:49 +0530] rev 35919
check-config: specify the mode 'rb' to open the file
Differential Revision: https://phab.mercurial-scm.org/D2045
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 05 Feb 2018 13:12:36 +0530] rev 35918
py3: use open() instead of file()
file() is not present in Python 3
Differential Revision: https://phab.mercurial-scm.org/D2044
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 05 Feb 2018 13:12:01 +0530] rev 35917
py3: use pycompat.strkwargs() to convert kwargs' key to str
Differential Revision: https://phab.mercurial-scm.org/D2043
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 05 Feb 2018 13:10:33 +0530] rev 35916
py3: add __bytes__() for mq.patchheader and make sure __str__ returns str
Before this patch, __str__() function for mq.patchheader class return bytes
which is not str on Python 3. So let's move that logic to __bytes__() and for
__str__() convert the return value of __bytes__() to str.
Differential Revision: https://phab.mercurial-scm.org/D2042
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 05 Feb 2018 13:01:35 +0530] rev 35915
py3: use "%d" to convert integer to bytes
Differential Revision: https://phab.mercurial-scm.org/D2041
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 05 Feb 2018 12:59:57 +0530] rev 35914
py3: use .startswith() instead of bytes[0]
Differential Revision: https://phab.mercurial-scm.org/D2040
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 05 Feb 2018 12:58:51 +0530] rev 35913
py3: slice on bytes to prevent getting the ascii values
Differential Revision: https://phab.mercurial-scm.org/D2039
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 04 Feb 2018 20:46:26 +0530] rev 35912
py3: add r'' to convert keys to keyword arguments to str
# skip-blame as we are just adding r''
Differential Revision: https://phab.mercurial-scm.org/D2038
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 04 Feb 2018 15:41:37 +0530] rev 35911
py3: add b'' to tweakdefaults config string
The tweakdefaults config string is enclosed inside triple quotes and the
transformer does not adds b'' there.
# skip-blame because we are just adding b''
Differential Revision: https://phab.mercurial-scm.org/D2037
Boris Feld <boris.feld@octobus.net> [Sun, 04 Feb 2018 12:00:17 +0100] rev 35910
cmdutil: introduce deprecated aliases
c8e2d6ed1f9e moved some objects used by Evolve and hence broke the latest
Evolve revision. Next Evolve version will use the new objects when available
but introduce deprecated aliases so users using older version of Evolve won't
have a broken Evolve extension.
Differential Revision: https://phab.mercurial-scm.org/D2023
Anton Shestakov <av6@dwimlabs.net> [Mon, 05 Feb 2018 18:39:41 +0800] rev 35909
makefile: remove Ubuntu Yakkety and Zesty docker targets
Yakkety (16.10) was supported until 2017-07-20 and Zesty (17.04) was supported
until 2018-01-13.
Kyle Lippincott <spectral@google.com> [Sat, 20 Jan 2018 15:33:48 -0800] rev 35908
merge: use operation-provided labels (ex: dest/source) in several merge-tools
Tools that did not use labels already, used only one, or used some label other
than the exact strings of "local" or "other" were unmodified. Cases that used
the label "base" were modified as well, if they were otherwise changed in this
CL; "merged" was *not* changed.
There are other possible changes we might want to make, but I didn't:
- bcompare (linux and osx) uses the labels "parent1" and "parent2" instead of
"local" and "other", so it was left alone, even though beyondcompare3
(windows) *was* changed.
- araxis used the labels "Other", "Base", and "Local :$local", so it was also
left alone.
- UltraCompare didn't provide a label for 'local', just for 'base' and 'other',
so it was left alone.
Differential Revision: https://phab.mercurial-scm.org/D2012
Kyle Lippincott <spectral@google.com> [Wed, 17 Jan 2018 17:35:05 -0800] rev 35907
filemerge: support passing labels to external merge tools
This adds $labellocal, $labelother, and $labelbase to the replacement set for
merge-tools.<tool>.args config variables, and to the environment as HG_MY_LABEL,
HG_OTHER_LABEL, and HG_BASE_LABEL, respectively.
We also add merge-tools.<tool>.mergemarkers and
merge-tools.<tool>.mergemarkertemplate config variables as counterparts of
the variables available in [ui]. We are intentionally *not* respecting
ui.mergemarkers when calling out to external merge programs; too often the
default template will be too wide to display comfortably in most GUIs.
Differential Revision: https://phab.mercurial-scm.org/D2011
Matt Harbison <matt_harbison@yahoo.com> [Fri, 02 Feb 2018 23:20:55 -0500] rev 35906
bookmarks: drop deprecated methods (API)
The ProgrammingError prevents accidental usage of the dict base class methods.
.. api::
The following deprecated methods have been removed from bookmarks:
__setitem__(), __delitem__(), update(), and recordchange(). Use
bookmarks.applychanges() instead.
Yuya Nishihara <yuya@tcha.org> [Sat, 03 Feb 2018 15:26:13 +0900] rev 35905
archive: rewrite default metadata template as a multi-line bytes literal
This fixes test-directaccess.t on Python 3.