Augie Fackler <augie@google.com> [Tue, 13 Feb 2018 18:00:59 -0500] rev 36164
contrib: ban $RANDOM using check-code
Differential Revision: https://phab.mercurial-scm.org/D2237
Augie Fackler <augie@google.com> [Tue, 13 Feb 2018 17:58:40 -0500] rev 36163
tests: remove use of bashism $RANDOM to fix test-narrow.t on non-bash shells
This test passed on our workstations, including on Macs, so we never
noticed, but it fails on both the Linux and FreeBSD buildbots. Today I
learned about a bash feature, wherein $RANDOM gives a random int every
time you read it.
check-code rule to follow.
Differential Revision: https://phab.mercurial-scm.org/D2236
Sandu Turcan <idlsoft@gmail.com> [Tue, 13 Feb 2018 14:39:02 -0500] rev 36162
narrow: fix for getting the username when running http server
Differential Revision: https://phab.mercurial-scm.org/D2231
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 12 Feb 2018 16:22:31 -0800] rev 36161
tests: remove code to support Mercurial 4.3
Now that narrow lives in core, we don't need the legacy support.
Differential Revision: https://phab.mercurial-scm.org/D2202
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 12 Feb 2018 16:21:34 -0800] rev 36160
narrowspec: move module into core
Having support for parsing the narrow specification in core is
necessary for moving many other parts of narrow to core.
We do still want to harmonize the narrow spec with the sparse
spec. And the format needs to be documented. But this shouldn't
hold up the code moving to core.
Differential Revision: https://phab.mercurial-scm.org/D2201
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 12 Feb 2018 16:15:34 -0800] rev 36159
hg: move share._getsrcrepo into core
The fact we were calling this from extensions was a sign that it
should live in core.
We were also able to remove some extra attribute aliases from the
share extension.
Differential Revision: https://phab.mercurial-scm.org/D2200
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 12 Feb 2018 15:49:15 -0800] rev 36158
tests: glob over line number
Differential Revision: https://phab.mercurial-scm.org/D2199
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 12 Feb 2018 15:39:47 -0800] rev 36157
tests: remove references to bundle2-exp config option
This option was deleted a while ago. We don't even alias it in
core.
Differential Revision: https://phab.mercurial-scm.org/D2198
Augie Fackler <augie@google.com> [Tue, 13 Feb 2018 11:12:36 -0500] rev 36156
py3: whitelist another six passing tests
Differential Revision: https://phab.mercurial-scm.org/D2230
Augie Fackler <augie@google.com> [Tue, 13 Feb 2018 10:54:58 -0500] rev 36155
narrowrepo: filter() is a generator on py3, wrap in list()
Was at the top of Python 3 exceptions.
Differential Revision: https://phab.mercurial-scm.org/D2229
Augie Fackler <augie@google.com> [Tue, 13 Feb 2018 10:39:31 -0500] rev 36154
narrowcommands: use pycompat.{bytes,str}kwargs
Differential Revision: https://phab.mercurial-scm.org/D2228
Augie Fackler <augie@google.com> [Tue, 13 Feb 2018 10:38:02 -0500] rev 36153
debugcommands: mergestate version is an int, use %d on it
Differential Revision: https://phab.mercurial-scm.org/D2227
Augie Fackler <augie@google.com> [Tue, 13 Feb 2018 10:20:57 -0500] rev 36152
progress: use %d to format ints instead of %s
Due to behavioral changes between '% Ns' and '% Nd' this has some
unfortunate extra dancing. I'm not sure of a better way to solve this
problem.
Differential Revision: https://phab.mercurial-scm.org/D2226
Augie Fackler <augie@google.com> [Tue, 13 Feb 2018 08:43:14 -0500] rev 36151
progress: determine padding width portably
Differential Revision: https://phab.mercurial-scm.org/D2225
Augie Fackler <augie@google.com> [Tue, 13 Feb 2018 08:41:42 -0500] rev 36150
branchmap: wrap builtin exception in bytes for logging
Differential Revision: https://phab.mercurial-scm.org/D2224
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 23 Dec 2017 15:11:13 +0530] rev 36149
remotenames: add three new revsets related to remotenames
This patch adds three new revsets 'remotenames', 'remotebookmarks' and
'remotebranches' which will return changesets which have remotenames,
remotebookmarks and remotebranches on them respectively.
The remotenames revset exist in hgremotenames extension and is moved from there
whereas rest of the two revsets are introduced in this patch.
hgremotenames: https://bitbucket.org/seanfarley/hgremotenames
Differential Revision: https://phab.mercurial-scm.org/D2002
Yuya Nishihara <yuya@tcha.org> [Tue, 13 Feb 2018 21:52:51 +0900] rev 36148
convert: fix line ending of mapfile and commit.desc file
Follows up
42a393ea56d2. CRLF vs LF doesn't really matter as we do strip()
or rstrip() on read, but mixing them isn't nice. So let's restore the old
behavior.
I don't know whether CVS/Root, CVS/Repository, and ~/.cvspass are written
in native line ending, so I leave them read as binary files.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 18:34:22 -0800] rev 36147
py3: port string formatting
`skipped` is a set of integer revs here. So cast integers to
strings using %d.
None doesn't cast to an empty string on Python 3. So use '' explicitly.
Differential Revision: https://phab.mercurial-scm.org/D2146
Augie Fackler <augie@google.com> [Thu, 25 Jan 2018 21:16:28 -0500] rev 36146
bdiff: write a native version of splitnewlines
./hg perfunidiff mercurial/manifest.py 0 --count 500 --profile before:
! wall 0.309280 comb 0.350000 user 0.290000 sys 0.060000 (best of 32)
./hg perfunidiff mercurial/manifest.py 0 --count 500 --profile after:
! wall 0.241572 comb 0.260000 user 0.240000 sys 0.020000 (best of 39)
so it's about 20% faster. I hate Python. I wish we could usefully
write this in Rust, but it doesn't look like that's realistic without
using the cpython crate, which I'd still like to avoid.
Differential Revision: https://phab.mercurial-scm.org/D1973
Boris Feld <boris.feld@octobus.net> [Mon, 12 Feb 2018 16:09:31 +0100] rev 36145
label: enforce the lack of leading or trailing white space
In practice, all commands create label are currently striping external white
space. Let us enforce this logic at a lower level before starting to rely on
it elsewhere.
Antonio Muci <a.mux@inwind.it> [Tue, 13 Feb 2018 00:05:45 +0100] rev 36144
buildrpm: bump bundled docutils version to 0.14 when building for centos{5,6}
when building rpm packages for centos 5 and 6, we bundle a mercurial-specific
version of docutils in /opt/python-hg/lib/python2.7/site-packages/docutils
Let's bump the embedded docutils version from 0.12 (released in 2014) to
0.14 (latest as of today)
Antonio Muci <a.mux@inwind.it> [Mon, 12 Feb 2018 23:59:36 +0100] rev 36143
buildrpm: bump bundled python version to 2.7.14 when building for centos{5,6}
when building rpm packages for centos 5 and 6, we bundle a mercurial-specific
version of python 2.7 in /opt/python-hg
Let's bump the embedded python version from 2.7.10 (released in 2015) to
2.7.14 (latest as of today)
Matt Harbison <matt_harbison@yahoo.com> [Sun, 11 Feb 2018 13:25:56 -0500] rev 36142
merge: invoke scmutil.fileprefetchhooks() prior to applying updates
This moves the file list calculation into core, so other extensions don't need
to duplicate it.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 11 Feb 2018 00:40:27 -0500] rev 36141
revert: drop the remnant of the prefetchfiles hook
Matt Harbison <matt_harbison@yahoo.com> [Sun, 11 Feb 2018 00:51:22 -0500] rev 36140
cat: migrate to the fileprefetch callback mechanism
Matt Harbison <matt_harbison@yahoo.com> [Sun, 11 Feb 2018 00:49:43 -0500] rev 36139
archive: migrate to the fileprefetch callback mechanism
Matt Harbison <matt_harbison@yahoo.com> [Sun, 11 Feb 2018 00:30:15 -0500] rev 36138
lfs: migrate to the fileprefetch callback mechanism
Matt Harbison <matt_harbison@yahoo.com> [Sun, 11 Feb 2018 00:23:57 -0500] rev 36137
cmdutil: convert the prefetchfiles() hook to a callback mechanism (API)
Yuya suggested a list of callbacks instead of function wrapping. This means
that one extension can't block another from processing the list.
.. api::
File prefetching is now handled by registering a callback with
scmutil.fileprefetchhooks.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 13 Feb 2018 00:54:36 -0500] rev 36136
test-narrow: partially stabilize on Windows
test-narrow-strip.t is still broken. I don't see any feature condititionals, so
it might be an actual problem.
Augie Fackler <augie@google.com> [Tue, 13 Feb 2018 00:06:22 -0500] rev 36135
py3: whitelist test-convert-clonebranches.t
Differential Revision: https://phab.mercurial-scm.org/D2223
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 23:51:37 -0500] rev 36134
convert: make hg sha1 regex consistently be a bytes
Differential Revision: https://phab.mercurial-scm.org/D2222
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 23:51:18 -0500] rev 36133
convcmd: pass encoding name as a sysstr
Differential Revision: https://phab.mercurial-scm.org/D2221
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
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 01 Feb 2018 16:59:18 -0800] rev 36072
wireprotoserver: move responsetype() out of http handler
This is our last public attribute not part of the protocol
interface!
Differential Revision: https://phab.mercurial-scm.org/D2087
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:22:44 -0800] rev 36071
wireproto: remove unused proto argument from supportedcompengines (API)
In theory, the protocol should be passed to this function. But the
argument isn't being used and it is getting in the way of refactoring.
So let's remove it. We can always add it back later if we need it
again.
Differential Revision: https://phab.mercurial-scm.org/D2086
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 01 Feb 2018 17:12:07 -0800] rev 36070
wireprotoserver: rename getfile() to forwardpayload() (API)
"file" can mean a lot of things. Let's rename the interface
method to something more descriptive.
While I was here, I moved the docs about the payload format to
the implementation of the SSH protocol, because it was lying
about what the HTTP payload looked like.
Differential Revision: https://phab.mercurial-scm.org/D2085
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:24:22 -0800] rev 36069
wireprotoserver: rename _client to client (API)
This method is called in wireproto.py. It should be part of the public
API/interface.
.. api::
The ``_client()`` method of the wire protocol handler interface has
been renamed to ``client()``.
Differential Revision: https://phab.mercurial-scm.org/D2084
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:20:11 -0800] rev 36068
wireprotoserver: remove redirect() and restore() (API)
These methods on the protocol handler interface are no longer used in
core.
.. api::
redirect() and restore() have been removed from the wire protocol
handler interface. Use mayberedirectstdio() instead.
Differential Revision: https://phab.mercurial-scm.org/D2083
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:19:06 -0800] rev 36067
wireproto: use maybecapturestdio() for push responses (API)
The "pushres" and "pusherr" response types currently call
proto.restore() in the HTTP protocol. This completes the pairing
with proto.redirect() that occurs in the @wireprotocommand
functions. (But since the SSH protocol has a no-op redirect(),
it doesn't bother calling restore() because it would also be
a no-op.)
Having the disconnect between these paired calls is very confusing.
Knowing that you must use proto.redirect() if returning a "pushres"
or a "pusherr" is even wonkier.
We replace this confusing code with our new context manager for
[maybe] capturing output.
The "pushres" and "pusherr" types have gained an "output" argument
to their constructor and an attribute to hold captured data. The
HTTP protocol now retrieves output from these objects.
.. api::
``wireproto.pushres`` and ``wireproto.pusherr`` now explicitly
track stdio output.
Differential Revision: https://phab.mercurial-scm.org/D2082
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:17:47 -0800] rev 36066
wireprotoserver: add context manager mechanism for redirecting stdio
Today, proto.redirect() sets up redirecting stdio and proto.restore()
undoes that. The API is a bit wonky because restore() is only
implemented on the HTTP protocol. Furthermore, not all calls to
redirect() are obviously paired with calls to restore(). For
example, the call to restore() for "unbundle" requests is handled
by the response handler for the HTTP protocol.
This commit introduces a new method on the protocol handler interface
to maybe capture stdio. It emits a file object or None depending on
whether stdio capture is used by the transport.
To prove it works, the "pushkey" wire protocol command has been
updated to use the new API.
I'm not convinced this is the best mechanism to capture stdio. I may
need to come up with something better once the new wire protocol
emerges into existence. But it is strictly better than before because
it removes variance in the wire protocol handler interface. It
therefore gets us closer to a unified interface between the SSH and
HTTP transports.
Differential Revision: https://phab.mercurial-scm.org/D2081
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 20:17:05 -0800] rev 36065
wireprotoserver: split ssh protocol handler and server
We want to formalize the interface for protocol handlers. Today,
server functionality (which is domain specific) is interleaved
with protocol handling functionality (which conforms to a generic
interface) in the sshserver class.
This commit splits the ssh protocol handling code out of the
sshserver class.
Differential Revision: https://phab.mercurial-scm.org/D2080
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Feb 2018 21:04:54 -0800] rev 36064
wireprotoserver: extract SSH response handling functions
The lookup/dispatch table was cute. But it isn't needed. Future
refactors will benefit from the handlers for individual response
types living outside the class.
As part of this, I snuck in a change that changes a type compare
from str to bytes. This has no effect on Python 2. But it might
make Python 3 a bit happier.
Differential Revision: https://phab.mercurial-scm.org/D2091
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 23 Dec 2017 15:13:37 +0530] rev 36063
remotenames: introduce new template keywords for remotenames
This patch introduces three new template keywords 'remotenames',
'remotebookmarks', 'remotebranches' to show remotenames, remotebookmarks and
remotebranches associated to a changeset.
This is a part of moving hgremotenames extension to core. The remotenames
template keyword was present in the extension and the rest of the two are not
present in the hgremotenames extension and are introduced in this patch.
hgremotenames: https://bitbucket.org/seanfarley/hgremotenames
Differential Revision: https://phab.mercurial-scm.org/D1759
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 23 Dec 2017 14:24:41 +0530] rev 36062
remotenames: add new namespaces for remotebookmarks and remotebranches
This patch adds two new namespaces which will be enabled by remotenames
extension. The namespaces are remotebookmarks and remotebranches. Adding them
as namespaces will show them in various commands' output such as log, show work.
This will also unable to access changesets using that name.
Tests are also added for the same.
This is a part of moving hgremotenames extension to core.
hgremotenames: https://bitbucket.org/seanfarley/hgremotenames
Differential Revision: https://phab.mercurial-scm.org/D1758
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 23 Dec 2017 17:50:42 +0530] rev 36061
remotenames: introduce a class to lazily resolve remotnames
remotenames may take time to load and in next patch we are going to introduce
namespaces related to them. So let's introduce a class making them load lazily.
This is a part of moving hgremotenames extension to core.
hgremotenames: https://bitbucket.org/seanfarley/hgremotenames
Differential Revision: https://phab.mercurial-scm.org/D1757
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 23 Dec 2017 00:19:09 +0530] rev 36060
remotenames: introduce class to encapsulate remotenames info in an extension
This patch adds a new extension remotenames in which features from hgremotenames
extension (https://bb/seanfarley/hgremotenames) will be added incrementally.
This patch introduces a basic class to encapsulate the remotenames information.
Differential Revision: https://phab.mercurial-scm.org/D1756
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 23 Dec 2017 20:27:41 +0530] rev 36059
logexchange: introduce helper function to get remote path name
This patch moves chunk of activepath function from hgremotenames extension
(https://bitbucket.org/seanfarley/hgremotenames/) to core. Before moving
rest of the part, there needs to be some refactoring done to schemes which
will be done as a separate series.
Differential Revision: https://phab.mercurial-scm.org/D1755
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 10:36:59 -0500] rev 36058
charencode: adjust clang-format enable/disable comments
We're pretty close to being able to let clang-format manage most of
these files.
Differential Revision: https://phab.mercurial-scm.org/D2180
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 10:31:17 -0500] rev 36057
diffhelpers: allow clang-format oversight
One trailing comma!
Differential Revision: https://phab.mercurial-scm.org/D2179
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 10:29:02 -0500] rev 36056
pathencode: allow clang-format oversight
Only had to add two trailing commas to make the file format acceptably!
Differential Revision: https://phab.mercurial-scm.org/D2178
Augie Fackler <augie@google.com> [Mon, 12 Feb 2018 10:21:44 -0500] rev 36055
bdiff: add to clang-format oversight
This file didn't require any complex fixes, so we may as well enable
clang-format while I'm editing it.
Differential Revision: https://phab.mercurial-scm.org/D2177
Matt Harbison <matt_harbison@yahoo.com> [Sun, 11 Feb 2018 20:59:35 -0500] rev 36054
test-merge-tools: stabilize for Windows
This masks the Windows argument parsing insanity[1], so it needs a bit of
explanation. (The security reference in the footnote is probably useful to keep
in mind if we ever whitelist certain in-repo config settings.)
9037c29e9f53 introduced tests that were failing on Windows with an unbalanced
double quote[2]. What ends up happening here is util.shellquote() is double
quoting the file path, but the shell script is placing this ->": "<- right next
to it. So cmd.exe gets launched with 'lb:base": ""c:\...\f~base.xyz"', which
got interpreted as 'lb:base: "c:\...\f~base.xyz'. If the test is adjusted to
quote like "lb:$labelbase: $base", then MSYS runs interference and strips the
'\' characters. I was able to get the expected result by dropping the quotes
from '": "', and changing the space to underscore. But since we need to glob
away the C: part anyway, just glob away the quote and leave the test unchanged.
[1] https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
[2] https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests/builds/441/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:17:05 +0530] rev 36053
py3: replace file() with open() in test-convert-hg-source.t
file() is not present in Python 3.
It also makes sure we read and write in bytes mode on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2132
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:15:45 +0530] rev 36052
py3: replace file() with open() in test-encoding-align.t
file() is not present in Python 3.
This patch also makes sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2131
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:14:59 +0530] rev 36051
py3: replace file() with open() in test-encoding.t
file() is not present in Python 3.
This also makes sure we write things in bytes mode in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2130
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 16:17:17 +0530] rev 36050
py3: make sure we return str from __repr__
Differential Revision: https://phab.mercurial-scm.org/D2109
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 14:30:44 -0800] rev 36049
py3: check for bytes instead of str in hg.share()
Differential Revision: https://phab.mercurial-scm.org/D2151
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 14:29:30 -0800] rev 36048
py3: port metaedit extension to Python 3
Without these changes, this extension is responsible for a test of
test failures.
Differential Revision: https://phab.mercurial-scm.org/D2150
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 14:25:10 -0800] rev 36047
py3: pass system string to email.message.Message.set_type()
Python 3 insists the type is a str.
Differential Revision: https://phab.mercurial-scm.org/D2149
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 14:18:27 -0800] rev 36046
py3: open temporary file in binary mode
Otherwise things fail later when we write bytes to the handle.
Differential Revision: https://phab.mercurial-scm.org/D2148
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 14:17:23 -0800] rev 36045
py3: use email parser that operates on bytes
email.parser.Parser() operates on str in both Python 2 and 3.
Python 3.2 introduced the email.parser.BytesParser(), which works
like Parser except it accepts bytes.
We implement the pycompat helper as a function so we lazily
import the "email" module.
Differential Revision: https://phab.mercurial-scm.org/D2147
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 13:32:18 -0800] rev 36044
py3: port ext-phase-report.py extension
The custom module importer doesn't run on Python files in the
tests directory. So we need the source to be compatible with
both Python 2 and 3.
Differential Revision: https://phab.mercurial-scm.org/D2145
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 13:23:26 -0800] rev 36043
py3: more robustly cast UUID to bytes
The UUID type only has __str__ implemented. So we need to cast to
bytes on Python 3.
We need an actual bytes instance here (bytestr won't do) because
the re.escape() later iterates over characters and characters
need to behave like ints, not bytes instances of length 1.
Differential Revision: https://phab.mercurial-scm.org/D2144
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 13:09:16 -0800] rev 36042
py3: use bytes() to cast context instances
__str__ and __bytes__ are both implemented on context types. However,
__str__ behaves differently on Python 2 and 3.
Differential Revision: https://phab.mercurial-scm.org/D2143
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 13:06:01 -0800] rev 36041
py3: convert __doc__ to bytes
Differential Revision: https://phab.mercurial-scm.org/D2142
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 14:21:44 -0800] rev 36040
py3: cast repr() result to bytes
Differential Revision: https://phab.mercurial-scm.org/D2141
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 13:00:00 -0800] rev 36039
py3: fix file i/o in test-status.t
Use raw string literal for open() mode and pass the proper data
type to write().
Differential Revision: https://phab.mercurial-scm.org/D2140
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 12:55:50 -0800] rev 36038
py3: pass system string to socket.getservbyname
Differential Revision: https://phab.mercurial-scm.org/D2139
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 12:42:10 -0800] rev 36037
run-tests: report tests that exception occurred in
We now record the test that an exception occurred in. We put this
information to use by aggregating the count of failures in each
test. For each exception, the exception report now prints the total
number of tests having that exception and the test with the least
number of exceptions exhibiting that failure. The exception list
is now sorted by (total count, tests impacted, count of failures
in least failing test).
This allows us to:
* Assess how widespread a failure is. Some exceptions occur a lot
in a few tests. Others occur over many tests.
* Easily run a test exhibiting an exception without having to find
a failure in test output.
* Find and fix low hanging fruit (e.g. exceptions that are the
only failure in a test).
Here's an example of the new output:
199 (4 tests) /home/gps/src/hg/hgext/blackbox.py:191: %b requires a bytes-like object, or an object that implements __bytes__, not 'str' (test-devel-warnings.t - 1 total)
142 (19 tests) /home/gps/src/hg/hgext/mq.py:655: list indices must be integers or slices, not bytes (test-hardlinks.t - 1 total)
140 (20 tests) /home/gps/src/hg/mercurial/patch.py:296: string argument expected, got 'bytes' (test-audit-subrepo.t - 1 total)
101 (15 tests) /home/gps/src/hg/hgext/convert/convcmd.py:60: encode() argument 1 must be str, not bytes (test-convert-clonebranches.t - 1 total)
90 (2 tests) /home/gps/src/hg/hgext/mq.py:456: can't concat str to bytes (test-mq-qqueue.t - 1 total)
87 (2 tests) /home/gps/src/hg/mercurial/branchmap.py:380: %b requires a bytes-like object, or an object that implements __bytes__, not 'FileNotFoundError' (test-branches.t - 2 total)
85 (22 tests) /home/gps/src/hg/mercurial/sshpeer.py:223: cannot convert 'UUID' object to bytes (test-bundle2-pushback.t - 1 total)
1 (1 tests) /home/gps/src/hg/mercurial/formatter.py:254: %b requires a bytes-like object, or an object that implements __bytes__, not 'str' (test-debugextensions.t - 2 total)
1 (1 tests) /home/gps/src/hg/hgext/convert/convcmd.py:420: startswith first arg must be str or a tuple of str, not bytes (test-convert-authormap.t - 2 total)
1 (1 tests) /home/gps/src/hg/mercurial/revlog.py:797: '>=' not supported between instances of 'NoneType' and 'int' (test-unionrepo.t - 1 total)
1 (1 tests) /home/gps/src/hg/hgext/show.py:129: %b requires a bytes-like object, or an object that implements __bytes__, not 'str' (test-show.t - 1 total)
Differential Revision: https://phab.mercurial-scm.org/D2138
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 10:52:13 -0800] rev 36036
py3: use raw string for file open mode
Otherwise the module importer rewrites it to bytes on Python 3,
which angers Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2137
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 11 Feb 2018 10:49:00 -0800] rev 36035
py3: convert content-type to bytes
This fixes the exception:
TypeError: %b requires a bytes-like object, or an object that
implements __bytes__, not 'str'
On the line:
ui.debug('Content-Type: %s\n' % content_type)
And it prevents additional exceptions that use the content_type
variable later.
Differential Revision: https://phab.mercurial-scm.org/D2136
Josef 'Jeff' Sipek <jeffpc@josefsipek.net> [Sun, 11 Feb 2018 18:32:37 -0500] rev 36034
gpg: print unknown key IDs in their entirety
Shortening the key is nice in theory but it results in ambiguity which can
be exploited. Therefore, when encountering an unknown key ID we should
print the whole ID returned by gpg. This may or may not be the whole key,
however it will match the user preference set in gpg configuration.
Furthermore, the key ID shortening had a couple of issues:
(1) it truncated the key ID (dropping the last digit and outputting only 15
hex digits) making it very hard to find the correct key on a key server
(2) since only 15 digits were fed into shortkey(), it always emitted the
ui.debug() warning
Denis Laxalde <denis@laxalde.org> [Sun, 11 Feb 2018 14:35:35 +0100] rev 36033
tests: fix check for --graph option in test-log-linerange.t
Previous test about incompatibility of --line-range and --graph options
was problematic because, even without --graph option, the command would
have failed because specified path (dir/baz) did not exist as it got
dropped in previous test statements. New test statements should work
without --graph. This prepares for making --line-range compatible with
--graph option.
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:25:53 +0530] rev 36032
py3: use "%d" instead of "%s" for integers
Differential Revision: https://phab.mercurial-scm.org/D2135
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:19:07 +0530] rev 36031
py3: replace file() with open() in test-contrib.t
file() is not present in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2134
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:14:00 +0530] rev 36030
py3: replace file() with open() in test-eol.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2129
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:13:11 +0530] rev 36029
py3: replace file() with open() in test-extdiff.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2128
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:12:28 +0530] rev 36028
py3: replace file() with open() in test-fileset.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2127
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:11:45 +0530] rev 36027
py3: replace file() with open() in test-import-bypass.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2126
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:53:47 +0530] rev 36026
py3: replace file() with open() in test-import-eol.t
file() is not present in Python 3.
This patch also adds b'' prefixes to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2125
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:09:37 +0530] rev 36025
py3: replace file() with open() in test-import-git.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2124
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:08:40 +0530] rev 36024
py3: replace file() with open() in test-import.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2123
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:07:09 +0530] rev 36023
py3: replace file() with open() in test-mactext.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2122
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:06:04 +0530] rev 36022
py3: replace file() with open() in test-mq-missingfiles.t
file() is not present in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2121
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:04:21 +0530] rev 36021
py3: replace file() with open() in test-mq-qimport.t
file() is not present in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2120
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:03:50 +0530] rev 36020
py3: replace file() with open() in test-patch-offset.t
file() is not present in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2119
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:03:17 +0530] rev 36019
py3: replace file() with open() in test-relink.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2118
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:02:14 +0530] rev 36018
py3: replace file() with open() in test-subrepo-missing.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2117
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:01:25 +0530] rev 36017
py3: replace file() with open() in test-tag.t
file() is not present in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2116
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:00:21 +0530] rev 36016
py3: replace file() with open() in test-transplant.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2115
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 16:59:35 +0530] rev 36015
py3: replace file() with open() in test-walk.t
file() is not present in Python 3.
This patch also adds a b'' prefix to make sure we write bytes in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2114
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 16:58:22 +0530] rev 36014
py3: replace file() with open() in test-win32text.t
This patch also adds b'' prefix to make sure we write bytes on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2113
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 16:56:47 +0530] rev 36013
py3: replace file() with open() in test-convert-p4-filetypes.t
file() is not present in Python 3. While I was here, I added b'' prefix to make
sure we write things correctly in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2112
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:30:42 +0530] rev 36012
py3: replace file() with open() in test-convert-mtn.t
While I was here, I added b'' prefixes to make sure we write things correctly in
bytes mode on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2111
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 11 Feb 2018 17:30:21 +0530] rev 36011
py3: replace file() with open() in test-clone.t
While I was here, I made sure we write things correctly in bytes mode.
Differential Revision: https://phab.mercurial-scm.org/D2110
Yuya Nishihara <yuya@tcha.org> [Tue, 06 Feb 2018 22:55:02 +0900] rev 36010
merge: cut import cycle at merge -> extensions
This seems less bad because checking fsmonitor looks like a temporary hack,
and cmdutil -> mergemod should be a valid dependency.
Yuya Nishihara <yuya@tcha.org> [Tue, 06 Feb 2018 22:36:38 +0900] rev 36009
subrepo: split non-core functions to new module
Resolves import cycle caused by subrepo -> cmdutil. Still we have another
cycle, cmdutil -> context -> subrepo, but where I think importing context
is wrong. Perhaps we'll need repo.makememctx().
Yuya Nishihara <yuya@tcha.org> [Wed, 07 Feb 2018 23:22:53 +0900] rev 36008
diff: remove fp.write() wrapper which drops label argument
It's no longer needed since we've split labeled write() from file-like
write().
Yuya Nishihara <yuya@tcha.org> [Sun, 21 Jan 2018 15:54:18 +0900] rev 36007
log: pack filematcher and hunksfilter into changesetdiffer object
This is just a way of getting rid of clumsy makefilematcher/makehunksfilter
arguments. There might be a better abstraction, but I don't think this is bad.
This makes filematcher and hunksfilter available by default, but that should
be fine.
Yuya Nishihara <yuya@tcha.org> [Sun, 21 Jan 2018 15:50:24 +0900] rev 36006
log: drop dead code to concatenate --line-range patterns and pats
It's disabled since
2e45bbd3db7b, and the current implementation is unlikely
to be reused.
Yuya Nishihara <yuya@tcha.org> [Sun, 21 Jan 2018 15:34:37 +0900] rev 36005
logcmdutil: create hunksfilter and filematcher even if no diff option given
It's okay since
5fe6f946f111, "log: allow matchfn to be non-null even if both
--patch/--stat are off."
Yuya Nishihara <yuya@tcha.org> [Sun, 21 Jan 2018 14:37:04 +0900] rev 36004
logcmdutil: unindent diff generator of changesetprinter
Prepares for the next few patches which will make matchfn and hunksfilterfn
always available.
Yuya Nishihara <yuya@tcha.org> [Sun, 21 Jan 2018 14:07:52 +0900] rev 36003
logcmdutil: hold makefilematcher/makehunksfilter() by changesetpriner (API)
This merges self.matchfn and self.show(matchfn) into self._makefilematcher,
and does the same for hunksfilter. Because changesetprinter seems to have
too many optional arguments, makefilematcher() and makehunksfilter() will
be packed into one object by later patch.
Yuya Nishihara <yuya@tcha.org> [Sun, 21 Jan 2018 13:40:31 +0900] rev 36002
log: pass ctx to makefilematcher() and makehunksfilter() functions
This isn't important, but seems more consistent as changesetprinter.show()
takes a ctx, not a revision number.
Anton Shestakov <av6@dwimlabs.net> [Tue, 13 Feb 2018 18:12:26 +0800] rev 36001
tests: allow age to go up to triple digits in test-shelve.t
We started to glob the age of shelved changes in
51934fc796c0, which says that
sometimes tests run slow and `hg shelve --list` says "2s" instead of "1s".
However in some instances, like [1], tests run so slow that the age goes up to
double digits ("13s" in that case). When that happens, `hg shelve --list`
output has less white spaces after the age, so let's glob the spaces too. We
probably won't ever need to handle triple digits there, but I went ahead and
left only 2 required white spaces in total.
[1]: https://buildd.debian.org/status/fetch.php?pkg=mercurial&arch=sparc64&ver=4.5-1&stamp=
1518360804&raw=0
Matt Harbison <matt_harbison@yahoo.com> [Sat, 27 Jan 2018 19:02:33 -0500] rev 36000
lfs: teach the 'lfs()' fileset to handle removed files
The callstatus setting is required to notice the removal of 'lfs.test' in rev 6
in the tests, even though this isn't directly calling mctx.status(). However,
it's not needed to get the results in the tests for `hg status`, so I'm probably
missing something.
Matt Harbison <matt_harbison@yahoo.com> [Sat, 27 Jan 2018 19:22:15 -0500] rev 35999
lfs: teach '{lfs_files}' to handle removed files
Matt Harbison <matt_harbison@yahoo.com> [Sat, 27 Jan 2018 18:56:24 -0500] rev 35998
lfs: allow a pointer to be extracted from a context that removes the file
This is needed to let 'set:lfs()' and '{lfs_files}' work normally on removed
files.
Yuya suggested returning a null pointer for removed files, instead of the
pointer from the parent. The first attempt at this was to return None for a non
LFS file, and a (pointer, ctx) tuple to hold the pointer and context (or parent
pointer and context for a removed file). But this complicated the callers, even
the ones that didn't care about removed files.
Instead, let's use {} to represent a removed pointer. This has the added
convenience of being a useful representation in the template language, and only
affects the callers that care about removed files (and only slightly). Since
pointers are explicitly serialized with a call to a member function, there is no
danger of writing these to disk.
Denis Laxalde <denis@laxalde.org> [Sat, 10 Feb 2018 19:33:19 +0100] rev 35997
rebase: make "successors" a set in _computeobsoletenotrebased()
There's no apparent reason for this variable to be a list and this
avoids converting it to a set when needed.
Yuya Nishihara <yuya@tcha.org> [Sat, 10 Feb 2018 21:14:41 +0900] rev 35996
merge with stable
Denis Laxalde <denis@laxalde.org> [Fri, 09 Feb 2018 22:49:20 +0100] rev 35995
rebase: do not consider extincts for divergence detection (
issue5782)
Extinct obsolete changesets cannot cause divergence upon rebase. We
compute these obsoletes without a non-obsolete successor (extincts) in
_computeobsoletenotrebased() and then filter them out from the set of
obsolete revisions to rebase before getting into _checkobsrebase() to
check for divergence candidates.
Denis Laxalde <denis@laxalde.org> [Fri, 09 Feb 2018 21:45:16 +0100] rev 35994
rebase: eliminate node from successors early in _computeobsoletenotrebased()
Denis Laxalde <denis.laxalde@logilab.fr> [Wed, 07 Feb 2018 12:06:13 +0100] rev 35993
rebase: add a test case for
issue5782
Issue 5782 reports that rebase incorrectly aborts when trying to rebase
an extinct revision (an obsolete revision with only obsolete successor).
We add a test to demonstrate this: the first "hg rebase" command aborts
with the divergence warning while, when allowing divergence, the rebase
completes and does not actually produce any divergence.
Boris Feld <boris.feld@octobus.net> [Fri, 09 Feb 2018 13:18:17 +0100] rev 35992
test: glob the temporary directory out of temporary file path
The temporary directory used by python might be outside of '/tmp/' (eg:
/dev/shm/) so we glob that part out.
Boris Feld <boris.feld@octobus.net> [Fri, 09 Feb 2018 12:48:12 +0100] rev 35991
tests: raise a better error when patterns are wrongly formatted
It is fairly easy to make mistakes when merging conflict in the pattern file.
A common mistake is to forget adding an extra trailing comma changing the
length of the tuple.
We now detect such error and raise a better error message that helps to find
it.
Matt Harbison <matt_harbison@yahoo.com> [Sat, 27 Jan 2018 17:58:19 -0500] rev 35990
lfs: add a fileset for detecting lfs files
This currently has the same limitation as {lfs_files}, namely it doesn't report
removed files.
We may want a dedicated 'lfs()' revset for efficiency, but combining this with
the 'contains()' revset should be equivalent for now. Combining with
'set:added()' or 'set:modified()' inside 'files()' should be equivalent to a
hypothetical lfs_adds() and lfs_modifies(). I wonder if there's a way to tweak
the filesets to evaluate lazily, to close the efficiency gap.
It would also be interesting to come up with a template filter for '{files}'
that looked at the pattern to 'files()', and filtered appropriately. While
passing a fileset as the pattern to `hg log` does filter '{files}', the set is
evaluated against the working directory, so there's no way to list all non-lfs
files above a certain size in all revisions, for example.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 07 Feb 2018 23:42:48 -0500] rev 35989
tests: stabilize ssh tests on Windows
This seems like a somewhat common type of failure (double vs single quote), so
I'm interested in ideas about how to avoid this. I doubt that we should
automatically fall back from single quote to double quote, like with '/' vs '\'.
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 01 Feb 2018 08:54:48 -0800] rev 35988
wireprotoserver: rename abstractserverproto and improve docstring
The docstring isn't completely accurate for the current state
of the world. But it does describe the direction future patches
will be taking things.
Differential Revision: https://phab.mercurial-scm.org/D2065
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 01 Feb 2018 16:11:54 -0800] rev 35987
wireprotoserver: document and improve the httplib workaround
This workaround dates all the way back to
a42d27bc809d in 2008.
The code is esoteric enough to warrant an inline explanation.
So I've added one.
At the time the code was written, the only wire protocol command
that accepted an HTTP request body was "unbundle." In the years
since, we've grown the ability to accept command arguments via
HTTP POST requests. So, the code has been changed to apply the
httplib workaround to all HTTP POST requests.
While staring at this code, I realized that the HTTP response
body in case of error is always the same. And, it appears to
mimic the behavior of a failed call to the "unbundle" command.
Since we can hit this code path on theoretically any protocol
request (since self.check_perm accepts custom auth checking
functions which may raise), I'm having a hard time believing
that clients react well to an "unbundle" response payload on
any wire protocol command. I wouldn't be surprised if our test
coverage for this feature only covers HTTP POST calls to
"unbundle." In other words, the experimental support for sending
arguments via HTTP POST request bodies may result in badness on
the client. Something to investigate another time perhaps...
Differential Revision: https://phab.mercurial-scm.org/D2064
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 31 Jan 2018 17:34:45 -0800] rev 35986
wireprotoserver: move error response handling out of hgweb
The exception handler for ErrorResponse has more to do with the
wire protocol than the generic HTTP server. Move the code so it
lives alongside other wire protocol code.
Differential Revision: https://phab.mercurial-scm.org/D2021
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 31 Jan 2018 16:43:46 -0800] rev 35985
hgweb: move call to protocol handler outside of try..except
The protocol handler doesn't raise ErrorResponse. So it doesn't
need to be in this `try..except ErrorResponse` block.
Differential Revision: https://phab.mercurial-scm.org/D2020
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 31 Jan 2018 16:21:43 -0800] rev 35984
wireprotoserver: move protocol parsing and dispatch out of hgweb
Previously, hgweb_mod had code for detecting if the request
was for the wire protocol. It would then (eventually) call
wireprotoserver.callhttp() to dispatch the request handling.
Detection of wire protocol requests is not trivial. There's
currently a big gotcha in the handling of the "cmd" request
parameter, for example.
Furthermore, in the near future we will have a second HTTP
protocol handler. Its mechanism for calling commands will be
a bit different. And we don't want the low-level logic for
detecting protocol commands to live in hgweb.
We establish a new function in wireprotoserver for detecting
an HTTP protocol request and for giving the caller an easy-to-use
mechanism for dispatching requests to it.
Some wire protocol specific functionality still lives in hgweb.
This will be addressed in subsequent commits.
Differential Revision: https://phab.mercurial-scm.org/D2019
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 01 Feb 2018 18:48:52 -0800] rev 35983
largefiles: register wire protocol commands with modern APIs
The wireproto.wireprotocommand decorator is the preferred mechanism for
registering wire protocol commands. In addition, wireproto.commands
is no longer a 2-tuple and use of that 2-tuple API should be considered
deprecated.
This commit ports largefiles to use wireproto.wireprotocommand()
and ports to the "commandentry" API.
As part of this, the definition of the "lheads" wire protocol
command is moved to the proper stanza.
We stop short of actually using wireprotocommand as a decorator
in order to minimize churn. We should ideally move wire protocol
commands to the registrar mechanism. But that's for another
changeset.
Differential Revision: https://phab.mercurial-scm.org/D2018
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 30 Jan 2018 18:41:44 -0800] rev 35982
wireproto: function for testing if wire protocol command is available
Currently, we perform simple membership testing for whether a wire
command is available. In the future, not all wire protocol commands
will be available on all transports. For example, a legacy transport
may not support newer commands.
In preparation of this, teach the protocol handlers to call into a
function to determine if a wire protocol command is available. That
function currently does membership testing like before, so behavior
should be identical.
In the case of the HTTP server, behavior is a bit wonkier. "cmd" is
used by both the wire protocol and hgweb. We do want the protocol
handler to handle requests for all commands that look like wire
protocol commands, even if they aren't available. Otherwise, the
fallback to hgweb would only confuse automated clients and make it
easier for hgweb to accidentally implement a "cmd" that is identical
to wire protocol commands (since they aren't centrally registered).
Differential Revision: https://phab.mercurial-scm.org/D1999
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 31 Jan 2018 14:05:11 -0800] rev 35981
wireproto: define and use types for wire protocol commands
Wire protocol commands have historically been declared as
2-tuples in wireproto.commands. There are some additional features I'd
like to implement that require going beyond 2-tuples. But because
the 2-tuple API (both destructuring assignment and direct assignment
into the dict) is used throughout the code base and in 3rd party
extensions, we can't do a trivial type change.
This commit creates a new "commandentry" type to represent declared
wire protocol commands. It implements __getitem__ and __iter__ so
it can quack like a 2-tuple. The @wireprotocommand decorator now
creates "commandentry" instances.
We also create a "commanddict" type to represent the dictionary of
declared wire protocol commands. It inherits from "dict" but provides
a custom __setitem__ to coerce passed 2-tuples to "commandentry"
instances. wireproto.commands is now an instance of this type.
Various callers in core rely on the new functionality. And tests
pass. So I'm reasonably confident things will "just work" in 3rd
party extensions as well.
Differential Revision: https://phab.mercurial-scm.org/D1998
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 30 Jan 2018 15:21:59 -0800] rev 35980
wireproto: improve docstring for @wireprotocommand
I'm about to add more arguments and want them to be documented.
Plus, good documentation is nice to have.
Differential Revision: https://phab.mercurial-scm.org/D1997
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 31 Jan 2018 10:06:39 -0800] rev 35979
wireproto: remove unnecessary exception trapping
The `try..except error.Abort` was added in
8474be4412ca back in
2012. The intent was to ensure a failing pushkey hook didn't crash
the server.
Since that changeset, repo.pushkey() and the hooks mechanism is
now much more robust about trapping errors itself. As such, we no
longer need this try..except block. So it has been removed.
Differential Revision: https://phab.mercurial-scm.org/D1996
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 06 Feb 2018 11:31:25 -0800] rev 35978
sshpeer: implement peer for version 2 of wire protocol
Since the protocol is now negotiated before we construct a
peer instance, we can return the negotiated protocol from the
handshake function and instantiate an appropriate peer class
for the protocol.
Version 2 of the SSH protocol is currently identical to version
1 post handshake. So our sshv2peer class just inherits from
sshv1peer for the time being. This will obviously change
over time.
Differential Revision: https://phab.mercurial-scm.org/D2063
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 06 Feb 2018 10:57:56 -0800] rev 35977
sshpeer: rename sshpeer class to sshv1peer (API)
With the introduction of version 2 of the SSH wire protocol,
we will need a new peer class to speak that protocol because
it will be too difficult to shoehorn a single class to speak
two protocols. We rename sshpeer.sshpeer to sshpeer.sshv1peer
to reflect the fact that there will be multiple versions of
the peer depending on the negotiated protocol.
.. api::
sshpeer.sshpeer renamed to sshpeer.sshv1peer.
Differential Revision: https://phab.mercurial-scm.org/D2062
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 06 Feb 2018 11:08:36 -0800] rev 35976
sshpeer: initial definition and implementation of new SSH protocol
The existing SSH protocol has several design flaws. Future commits
will elaborate on these flaws as new features are introduced
to combat these flaws. For now, hopefully you can take me for my
word that a ground up rewrite of the SSH protocol is needed.
This commit lays the foundation for a new SSH protocol by defining
a mechanism to upgrade the SSH transport channel away from the
default (version 1) protocol to something modern (which we'll call
"version 2" for now).
This upgrade process is detailed in the internals documentation
for the wire protocol. The gist of it is the client sends a
request line preceding the "hello" command/line which basically
says "I'm requesting an upgrade: here's what I support." If the
server recognizes that line, it processes the upgrade request and
the transport channel is switched to use the new version of the
protocol. If not, it sends an empty response, which is how all
Mercurial SSH servers from the beginning of time reacted to unknown
commands. The upgrade request is effectively ignored and the client
continues to use the existing version of the protocol as if nothing
happened.
The new version of the SSH protocol is completely identical to
version 1 aside from the upgrade dance and the bytes that follow.
The immediate bytes that follow the protocol switch are defined to
be a length framed "capabilities: " line containing the remote's
advertised capabilities. In reality, this looks very similar to
what the "hello" response would look like. But it will evolve
quickly.
The methodology by which the protocol will evolve is important.
I'm not going to introduce the new protocol all at once. That would
likely lead to endless bike shedding and forward progress would
stall. Instead, I intend to tricle out new features and diversions
from the existing protocol in small, incremental changes.
To support the gradual evolution of the protocol, the on-the-wire
advertised protocol name contains an "exp" to denote "experimental"
and a 4 digit field to capture the sub-version of the protocol.
Whenever we make a BC change to the wire protocol, we can increment
this version and lock out all older clients because it will appear
as a completely different protocol version. This means we can incur
as many breaking changes as we want. We don't have to commit to
supporting any one feature or idea for a long period of time. We
can even evolve the handshake mechanism, because that is defined
as being an implementation detail of the negotiated protocol version!
Hopefully this lowers the barrier to accepting changes to the
protocol and for experimenting with "radical" ideas during its
development.
In core, sshpeer received most of the attention. We haven't even
implemented the server bits for the new protocol in core yet.
Instead, we add very primitive support to our test server, mainly
just to exercise the added code paths in sshpeer.
Differential Revision: https://phab.mercurial-scm.org/D2061
# no-check-commit because of required foo_bar naming
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 06 Feb 2018 10:51:15 -0800] rev 35975
internals: refactor wire protocol documentation
Upcoming work will introduce a new version of the HTTP and SSH
transports. The differences will be significant enough to consider
them new transports. So, we now attach a version number to each
transport.
In addition, having the handshake documented after the transport
and in a single shared section made it harder to follow the flow
of the connection. The handshake documentation is now moved to the
protocol section it describes. We now have a generic section about
the purpose of the handshake, which was rewritten significantly.
Differential Revision: https://phab.mercurial-scm.org/D2060
Boris Feld <boris.feld@octobus.net> [Mon, 05 Feb 2018 18:04:40 +0100] rev 35974
revlog: rename 'self.checkinlinesize' into '_enforceinlinesize'
The name change has two motivations:
1) The function has no external caller, so we move it to protected space.
2) the function does more than checking it also split the data if we have more
data than 'inline' supports.
Boris Feld <boris.feld@octobus.net> [Mon, 05 Feb 2018 17:57:29 +0100] rev 35973
revlog: add a _datareadfp context manager for data access needs
The helper handles:
1) is there a file handle already open that we shall just reuse,
2) is the revlog inlined or not.
Using a context manager for all read access will help setting up file pointer
caching in later changesets.
Boris Feld <boris.feld@octobus.net> [Mon, 05 Feb 2018 17:35:14 +0100] rev 35972
revlog: use context manager for data file lifetime in checksize
This is clearer, safer and more modern.
Boris Feld <boris.feld@octobus.net> [Mon, 05 Feb 2018 17:34:57 +0100] rev 35971
revlog: use context manager for index file lifetime in checkinlinesize
This is clearer, safer and more modern.
Boris Feld <boris.feld@octobus.net> [Mon, 05 Feb 2018 17:34:47 +0100] rev 35970
revlog: use context manager for data file lifetime in checkinlinesize
This is clearer, safer and more modern.
Boris Feld <boris.feld@octobus.net> [Mon, 05 Feb 2018 17:34:19 +0100] rev 35969
revlog: use context manager for index file life time in __init__
This is clearer, safer and more modern.
Boris Feld <boris.feld@octobus.net> [Mon, 05 Feb 2018 17:22:13 +0100] rev 35968
revlog: move index file opening in a method
Having file operation centralized into a single spot help to factor common
logic out (eg: special flag handling according to the mode).
It is also the first step to simplify file handling during batch operation
(eg: revlog cloning). However, that part does not seems to be a hotspot yet.
Boris Feld <boris.feld@octobus.net> [Mon, 05 Feb 2018 17:03:56 +0100] rev 35967
revlog: move datafile opening in a method
Having file operation centralized into a single spot help to factor common
logic out.
It is also the first step to simplify file handling during batch operation
(eg: revlog cloning). However, that part does not seems to be a hotspot yet.
Boris Feld <boris.feld@octobus.net> [Tue, 06 Feb 2018 12:25:11 +0100] rev 35966
parseindex: implement context manager method on the wrapper
This is needed for incoming cleanups.
Boris Feld <boris.feld@octobus.net> [Tue, 06 Feb 2018 11:52:37 +0100] rev 35965
parseindex: also forward keyword argument in a debug wrapper
Otherwise, it gets in the way of a coming refactoring.
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