Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 23:50:58 -0500] rev 36132
convert: open all files in binary mode
Differential Revision: https://phab.mercurial-scm.org/D2220
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 22:29:36 -0500] rev 36131
py3: whitelist another 11 passing tests
Differential Revision: https://phab.mercurial-scm.org/D2213
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 20:44:06 -0500] rev 36130
util: convert traceback-related sysstrs to sysbytes in getstackframes
With this change, test-devel-warnings.t passes except for differences
in how ProgrammingError is formatted and one mysterious traceback
inside of transaction.__del__.
Differential Revision: https://phab.mercurial-scm.org/D2212
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 20:43:33 -0500] rev 36129
util: format line number of stack trace using %d
Required on Python 3, functional on Python 2.
Differential Revision: https://phab.mercurial-scm.org/D2211
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 20:43:05 -0500] rev 36128
util: call warnings.warn() with a sysstr in nouideprecwarn
This preserves nouideprecwarn wanting a bytes, which is consistent
with the rest of hg.
Differential Revision: https://phab.mercurial-scm.org/D2210
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 20:42:28 -0500] rev 36127
ui: convert stack traces to sysbytes before logging
They're coming back as unicodes, so sysbytes seems like the best we can do.
This is like D2171 and D2172, but those fail on Python 2.7.5
(seriously!), so this is my version of the same change. I actually
wrote this before reviewing those, then discarded it, then came back
to it after finding out 2.7.5 is a silly place.
Differential Revision: https://phab.mercurial-scm.org/D2209
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 20:41:47 -0500] rev 36126
ui: use pycompat.bytestr() to get a bytes-repr of config default
We don't know what type we'll get here, so we need something that'll
behave like a repr without returning a unicode.
Differential Revision: https://phab.mercurial-scm.org/D2208
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 20:39:48 -0500] rev 36125
tests: add tons of b prefixes in test-devel-warnings.t
# skip-blame because it's just b prefixes
Differential Revision: https://phab.mercurial-scm.org/D2207
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 19:43:43 -0800] rev 36124
py3: convert traceback representation to bytes when logging
Python's APIs should return a system string. We want to use bytes
for logging. So convert the traceback to bytes before sending
it to the logger.
Differential Revision: https://phab.mercurial-scm.org/D2176
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 19:26:53 -0800] rev 36123
py3: convert context to bytes instead of str
This yields identical behavior on Python 2 and 3.
Differential Revision: https://phab.mercurial-scm.org/D2174
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 19:24:27 -0800] rev 36122
py3: add missing b'' literal to sshprotoext.py
Everywhere else in this file uses b''. I must have missed a line
when I wrote this code a few days ago.
# skip-blame b prefix
Differential Revision: https://phab.mercurial-scm.org/D2173
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 19:11:17 -0800] rev 36121
py3: make dummyssh compatible with Python 3
Required encoding a str to bytes and writing bytes to a file
descriptor.
Differential Revision: https://phab.mercurial-scm.org/D2170
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 18:58:45 -0800] rev 36120
mail: import email.utils not email.Utils
email.Utils was renamed to email.utils in Python 2.5. But it appears
at some point before Python 2.7 (possibly 2.5) email.Utils was aliased
to the new home. So email.utils should be safe for all versions of
Python we support.
Differential Revision: https://phab.mercurial-scm.org/D2168
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 18:50:24 -0800] rev 36119
py3: cast character set to bytes
The returned value from this function is eventually fed into
email.charset.Charset.__init__. However, the standard library
appears to handle both string types in Python 2 and 3. So there
shouldn't be any problem returning a bytes here.
Differential Revision: https://phab.mercurial-scm.org/D2167
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 18:47:19 -0800] rev 36118
py3: cast decode() argument to system string
The actual types here may be mixed due to string literals
and variables from other modules. So a cast is necessary.
Differential Revision: https://phab.mercurial-scm.org/D2166
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 16:56:29 -0800] rev 36117
py3: avoid changing dictionary during iteration
dict.items() and friends are iterators/views in Python 3. You
aren't allowed to mutate the underlying dictionary when iterating
on these views. So iterate over a copy of things.
Differential Revision: https://phab.mercurial-scm.org/D2164
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 16:54:56 -0800] rev 36116
py3: use raw string for key in **kwargs
Otherwise Python 3 is unhappy. We only set a single key here.
So I don't think pycompat.strkwargs() is necessary.
Differential Revision: https://phab.mercurial-scm.org/D2163
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 16:50:45 -0800] rev 36115
py3: preserve chunks as an iterable of bytes
patch.diffstat() returns a bytes. util.chunkbuffer() expects an
iterable of bytes. Feeding it a single bytes instance on Python 3
will iterate the characters as integers. This blows up
util.chunkbuffer.
Differential Revision: https://phab.mercurial-scm.org/D2162
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 16:40:02 -0800] rev 36114
py3: use b'' for changegroup version literals
Test extensions aren't currently loaded with our custom module
importer.
# skip-blame b prefix
Differential Revision: https://phab.mercurial-scm.org/D2161
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 16:30:44 -0800] rev 36113
py3: use b'' in inline extension
# skip-blame b prefix
Differential Revision: https://phab.mercurial-scm.org/D2160
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 16:29:35 -0800] rev 36112
py3: use hex(hasher.digest())
.hexdigest() returns a system str. .digest() consistently returns
bytes.
Differential Revision: https://phab.mercurial-scm.org/D2159
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 16:21:30 -0800] rev 36111
py3: use string for "close" value in commit extras
The extras dict on commits has string keys and values. Before this
commit, we passed "close" as an integer, which Python 2 gladly
coerced to a string during a %s formatting in the bowels of
changelog.py.
Differential Revision: https://phab.mercurial-scm.org/D2157
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 16:16:43 -0800] rev 36110
py3: catch TypeError during template operations
Two places in this code Python 3 changed from raising ValueError
to TypeError. So catch the addition exceptions.
IMO this code might be better off performing type sniffing. But
I'm not sure the implications of changing that.
Differential Revision: https://phab.mercurial-scm.org/D2156
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 16:08:11 -0800] rev 36109
py3: use bytes literals for test extension
These extensions don't get run through our custom module importer.
It's easy enough to make them dual compatible with Python 2 and 3.
# skip-blame b prefixes
Differential Revision: https://phab.mercurial-scm.org/D2155
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 16:02:32 -0800] rev 36108
py3: use system strings when calling __import__
We must pass the native str type when importing.
Differential Revision: https://phab.mercurial-scm.org/D2154
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 15:58:31 -0800] rev 36107
py3: open patches.queue in binary mode
And switch to using the context manager form of open() while we're
here.
Differential Revision: https://phab.mercurial-scm.org/D2153
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 15:55:47 -0800] rev 36106
py3: compare against bytes instead of str
Differential Revision: https://phab.mercurial-scm.org/D2152
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 19:39:15 -0800] rev 36105
py3: use b'' in mockblackbox.py
This unmasks a ton of other TypeError in blackbox code.
# skip-blame since it's just a b prefix
Differential Revision: https://phab.mercurial-scm.org/D2175
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 15:08:15 -0500] rev 36104
narrow: add a TODO document
These are things that are bigger than we want to handle right now, but
are pretty important to get narrowing to be non-experimental.
Differential Revision: https://phab.mercurial-scm.org/D2196
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 15:00:18 -0500] rev 36103
tests: use `hello` not `capabilities` over ssh
Differential Revision: https://phab.mercurial-scm.org/D2195
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 14:58:32 -0500] rev 36102
narrowwirepeer: add TODO about how we add wireproto args to unbundle :(
Differential Revision: https://phab.mercurial-scm.org/D2194
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 14:49:38 -0500] rev 36101
narrowwirepeer: rename expandnarrow capability to exp-expandnarrow
The expandnarrow functionality lets a client have a shorthand (for
Google it's a reference to a checked-in file) for a set of includes
and excludes. For testing we should probably implement a simple
version of that functionality here. For now, rename the capability so
we don't burn the good name in the future if we need to change
behavior.
It's plausible that this functionality should be dropped from the
narrowhg we ship long-term, but I'm dubious as it seems pretty likely
other organizations will want similar shorthands for commonly-used
subsets of their trees.
Differential Revision: https://phab.mercurial-scm.org/D2193
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 14:42:47 -0500] rev 36100
narrow: make restrictpatterns a little more idiomatic
I'm not sure why invalid_includes was an out-param, but it doesn't
look like there's any reason for it to be now.
Differential Revision: https://phab.mercurial-scm.org/D2192
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 14:37:10 -0500] rev 36099
narrowspec: consistently use set() to copy sets
Differential Revision: https://phab.mercurial-scm.org/D2191
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 14:27:32 -0500] rev 36098
narrowspec: document constraints when validating patterns
Differential Revision: https://phab.mercurial-scm.org/D2190
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 14:15:52 -0500] rev 36097
narrowrevlog: add a TODO around remotefilelog moving to core
We should clean this up considerably when remotefilelog lands, which
we expect to try and accomplish in the near-ish future.
Differential Revision: https://phab.mercurial-scm.org/D2189
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 14:12:28 -0500] rev 36096
narrowrevlog: add what little I can remember about rename filtering
Differential Revision: https://phab.mercurial-scm.org/D2188
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 14:01:44 -0500] rev 36095
manifest: clean up dirlog() to take a d parameter to avoid shadowing dir()
Differential Revision: https://phab.mercurial-scm.org/D2187
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 14:00:02 -0500] rev 36094
narrowrevlog: replace AssertionError with ProgrammingError
Differential Revision: https://phab.mercurial-scm.org/D2186
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 13:54:41 -0500] rev 36093
narrowrevlog: document excludeddir class and friends
Differential Revision: https://phab.mercurial-scm.org/D2185
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 13:51:29 -0500] rev 36092
narrowrepo: add docstring for narrowpats
Differential Revision: https://phab.mercurial-scm.org/D2184
Augie Fackler <augie@google.com> [Fri, 02 Feb 2018 10:51:47 -0500] rev 36091
narrowtemplates: update to use registrar mechanism
It's worth considering at this point if we should just move the two
ellipsis functions to core tagged experimental or something, since
they're not really narrowing-specific...
Differential Revision: https://phab.mercurial-scm.org/D2009
Augie Fackler <augie@google.com> [Fri, 02 Feb 2018 10:37:29 -0500] rev 36090
narrow: move from ELLIPSIS_NODE_FLAG to revlog.REVIDX_ELLIPSIS
We should have been using this value all along. Sigh.
Differential Revision: https://phab.mercurial-scm.org/D2008
Augie Fackler <augie@google.com> [Fri, 02 Feb 2018 10:28:57 -0500] rev 36089
narrowrepo: make repo requirement include the string 'experimental'
We can just move to "narrow" or similar when we finalize the
format. I'm not sure what the migration process from one requirement
to another should look like, but we're about to cross that bridge at
Google once this change lands, so hopefully we'll know soon.
Differential Revision: https://phab.mercurial-scm.org/D2007
Augie Fackler <augie@google.com> [Fri, 02 Feb 2018 10:27:08 -0500] rev 36088
narrow: mark requirement as a constant
Differential Revision: https://phab.mercurial-scm.org/D2006
Augie Fackler <augie@google.com> [Fri, 02 Feb 2018 10:23:23 -0500] rev 36087
narrowbundle2: mark most constants as module-private
This became obvious when preparing the previous change, so there's no
reason to not just do it now while it's easy.
Differential Revision: https://phab.mercurial-scm.org/D2005
Augie Fackler <augie@google.com> [Fri, 02 Feb 2018 10:18:11 -0500] rev 36086
narrowbundle2: make constants ALLCAPS to be a bit more readable
Differential Revision: https://phab.mercurial-scm.org/D2004
Augie Fackler <augie@google.com> [Thu, 01 Feb 2018 18:02:32 -0500] rev 36085
narrow: remove old version-checking logic and declare internal
Differential Revision: https://phab.mercurial-scm.org/D1980
Augie Fackler <augie@google.com> [Thu, 01 Feb 2018 17:19:41 -0500] rev 36084
tests: fold narrow treemanifest tests into main test file using testcases
These tests predate the testcases functionality in run-tests.py, so it
was never done in narrowhg.
Differential Revision: https://phab.mercurial-scm.org/D1979
Augie Fackler <augie@google.com> [Mon, 29 Jan 2018 18:16:23 -0500] rev 36083
narrow: assume addflagprocessor will always exist on revlog module
Differential Revision: https://phab.mercurial-scm.org/D1978
Augie Fackler <augie@google.com> [Mon, 29 Jan 2018 18:13:56 -0500] rev 36082
narrow: this code should assume REVIDX_FLAGS_ORDER exists
Differential Revision: https://phab.mercurial-scm.org/D1977
Augie Fackler <augie@google.com> [Mon, 29 Jan 2018 18:12:17 -0500] rev 36081
narrow: drop legacy support for getsubsetraw
Differential Revision: https://phab.mercurial-scm.org/D1976
Augie Fackler <augie@google.com> [Mon, 29 Jan 2018 18:08:56 -0500] rev 36080
narrow: remove support for old match modules
Differential Revision: https://phab.mercurial-scm.org/D1975
Augie Fackler <augie@google.com> [Mon, 29 Jan 2018 16:19:33 -0500] rev 36079
narrow: import experimental extension from narrowhg revision
cb51d673e9c5
Adjustments:
* renamed src to hgext/narrow
* marked extension experimental
* added correct copyright header where it was missing
* updated hgrc extension enable line in library.sh
* renamed library.sh to narrow-library.sh
* dropped all files from repo root as they're not interesting
* dropped test-pyflakes.t, test-check-code.t and test-check-py3-compat.t
* renamed remaining tests to all be test-narrow-* when they didn't already
* fixed test-narrow-expanddirstate.t to refer to narrow and not narrowhg
* fixed tests that wanted `update -C .` instead of `merge --abort`
* corrected a two-space indent in narrowspec.py
* added a missing _() in narrowcommands.py
* fixed imports to pass the import checker
* narrow only adds its --include and --exclude to clone if sparse isn't
enabled to avoid breaking test-duplicateoptions.py. This is a kludge,
and we'll need to come up with a better solution in the future.
These were more or less the minimum to import something that would
pass tests and not create a bunch of files we'll never use.
Changes I intend to make as followups:
* rework the test-narrow-*-tree.t tests to use the new testcases
functionality in run-tests.py
* remove lots of monkeypatches of core things
Differential Revision: https://phab.mercurial-scm.org/D1974
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 16:51:30 -0500] rev 36078
python3: whitelist another four passing tests
Differential Revision: https://phab.mercurial-scm.org/D2197
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 06 Feb 2018 18:13:15 -0800] rev 36077
wireprotoserver: define and use parse_qs from urllib
The cgi module is deprecated since Python 2.6. Let's replace uses
of it in wireprotoserver with a similar function from urllib.
Differential Revision: https://phab.mercurial-scm.org/D2094
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 17:18:27 -0800] rev 36076
tests: add tests for sending recognized command before handshake
Rounding out our test coverage for the SSH server.
Differential Revision: https://phab.mercurial-scm.org/D2093
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:37:51 -0800] rev 36075
wireprotoserver: add version to SSH protocol names (API)
We recently introduced version 2 of the SSH protocol. Like we
did for the peer, we will need to differentiate version 1 and 2
of the server. So, we add version components to the advertised
name of the protocol handler.
Nothing in core looks for the old value. But an extension may.
.. api::
SSH protocol handler now advertises its name internally as
"ssh-v1" instead of "ssh."
Differential Revision: https://phab.mercurial-scm.org/D2092
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:27:36 -0800] rev 36074
wireproto: introduce type for raw byte responses (API)
Right now we simply return a str/bytes instance for simple
responses. I want all wire protocol response types to be strongly
typed. So let's invent and use a type for raw bytes responses.
.. api::
Wire protocol command handlers now return a
wireprototypes.bytesresponse instead of a raw bytes instance.
Protocol handlers will continue handling bytes instances. However,
any extensions wrapping wire protocol commands will need to handle
the new type.
Differential Revision: https://phab.mercurial-scm.org/D2089
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 16:29:05 -0800] rev 36073
wireprototypes: move wire protocol response types to new module
We'll be introducing more types as part of wire protocol version 2.
These types are shared between the command handling code (in
wireproto.py) and the protocol/transport code in wireprotoserver.py.
So they need to go in a new module to prevent a cycle.
The types are aliased into the wireproto module, so API compatibility
is preserved.
Differential Revision: https://phab.mercurial-scm.org/D2088