Matt Harbison <matt_harbison@yahoo.com> [Wed, 22 Nov 2017 20:49:01 -0500] rev 35176
convert: save an indicator of the repo type for sources and sinks
This seems like basic info to have, and will be used shortly when deciding
whether or not to wrap the class for lfs conversions.
The other option is to just add a function to each class. But this seems better
in that the strings aren't duplicated, and the constructor for most of these
will run even if the VCS isn't installed, so it's easier to catch errors.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 15 Nov 2017 23:43:15 -0500] rev 35175
lfs: add a repo requirement for this extension once an lfs file is committed
Largefiles does the same thing (also delayed until the first largefile commit),
to prevent access to the repo without the extension. In the case of this
extension, not having the extension loaded while accessing an lfs file results
in cryptic errors about "missing processor for flag '0x2000'". If enabled
locally but not remotely, the cryptic error message is about no common
changegroup version. (It wants '03', which is currently experimental.)
The largefiles extension looks for any tracked file that starts with '.hglf/'.
Unfortunately, that doesn't work here. I didn't see any way to get the files
that were just committed, without doing a full status. But since there's no
secondary check on adding an lfs file once the extension is loaded and a
threshold set, the best practice is to only enable this locally on a repo that
needs it. That should minimize the unnecessary overhead for repos without an
lfs file.
Kevin Bullock <kbullock@ringworld.org> [Fri, 01 Dec 2017 13:49:47 -0600] rev 35174
Added signature for changeset
a92b9f8e11ba
Kevin Bullock <kbullock@ringworld.org> [Fri, 01 Dec 2017 13:49:46 -0600] rev 35173
Added tag 4.4.2 for changeset
a92b9f8e11ba
Mark Thomas <mbthomas@fb.com> [Fri, 24 Nov 2017 12:53:58 -0800] rev 35172
merge: check created file dirs for path conflicts only once (
issue5716)
In large repositories, updates involving the creation of many files check the
same directories repeatedly in the wctx manifest. Move these checks out to a
separate loop to avoid repeated checks hitting the manifest.
Differential Revision: https://phab.mercurial-scm.org/D1226
Mark Thomas <mbthomas@fb.com> [Fri, 24 Nov 2017 12:53:58 -0800] rev 35171
merge: cache unknown dir checks (
issue5716)
As mentioned in D1222, the recent pathconflicts change regresses update
performance in large repositories when many files are being updated.
To mitigate this, we introduce two caches of directories that have
already found to be either:
- unknown directories, but which are not aliased by files and
so don't need to be checked if they are files again; and
- missing directores, which cannot cause path conflicts, and
cannot contain a file that causes a path conflict.
When checking the paths of a file, testing against this caches means we can
skip tests that involve touching the filesystem.
Differential Revision: https://phab.mercurial-scm.org/D1224
Yuya Nishihara <yuya@tcha.org> [Thu, 23 Nov 2017 22:17:03 +0900] rev 35170
dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
If this feature is enabled, early options are parsed using the global options
table. As the parser stops processing options when non/unknown option is
encountered, it won't mistakenly take an option value as a new early option.
Still "--" can be injected to terminate the parsing (e.g. "hg -R -- log"), I
think it's unlikely to lead to an RCE.
To minimize a risk of this change, new fancyopts.earlygetopt() path is enabled
only when +strictflags is set. Also the strict parser doesn't support '--repo',
a short for '--repository' yet. This limitation will be removed later.
As this feature is backward incompatible, I decided to add a new opt-in
mechanism to HGPLAIN. I'm not pretty sure if this is the right choice, but
I'm thinking of adding +feature/-feature syntax to HGPLAIN. Alternatively,
we could add a new environment variable. Any bikeshedding is welcome.
Note that HGPLAIN=+strictflags doesn't work correctly in chg session since
command arguments are pre-processed in C. This wouldn't be easily fixed.
Yuya Nishihara <yuya@tcha.org> [Thu, 23 Nov 2017 22:04:53 +0900] rev 35169
fancyopts: add early-options parser compatible with getopt()
The next patch will add a flag for strict parsing of early options, where
we'll have to parse all early options at once instead of processing them
one-by-one by dispatch._earlygetopt(). That's why I decided to hook
fancyopts().
All dispatch._early*opt() functions is planned to be replaced with this
function. But in this stable series, only the strict mode will be handled
by fancyopts.earlygetopt().
Matt Harbison <matt_harbison@yahoo.com> [Sun, 12 Nov 2017 23:45:14 -0500] rev 35168
largefiles: pay attention to dropped standin files when updating largefiles
Previously, the largefile for a dropped standin would be deleted here, and then
restored from the cache. This had the effect of clobbering uncommitted changes
if a revert caused the file to be forgotten, which is not what happens with a
normal file. Now the removal and update is skipped for dropped largefiles, and
the corresponding standin is deleted from disk.
This was noticed when working on
issue5738 because the forgotten standin files
were left behind, and that changes the behavior of the next rename to that
directory. My first attempt was to cleanup the standins before calling this.
That failed, because this function deletes the largefile if the corresponding
standin is missing.
This function is called by the revert command, merge (and therefore update), and
patch, via the scmutil.marktouched() override. So it should be pretty narrow in
scope.
I didn't mark
issue5738 as fixed because the move related issues can still
happen if the main tree and the .hglf subtree get out of sync somehow. I don't
see an easy fix for that, but that should be an edge case. If whoever queues
this thinks it is good enough to close out the bug and can cram it into the
summary, go for it.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 12 Nov 2017 00:24:38 -0500] rev 35167
test-largefiles: demonstrate problems with renaming and reverting a directory
These things were uncovered looking at
issue5738.
First, if the destination directory exists under .hglf, the source is moved
under the destination instead of renaming the last component for `hg mv srcdir
dstdir`. This is extra confusing, because it occurs even if the user visible
destination (i.e. the path _not_ under .hglf) does not exist.
Additionally, when a largefile is forgotten via revert, any modifications end up
getting clobbered. For normal files, the forgotten file is left unchanged, as
shown by test-import.t. The forget command on a largefile will correctly leave
the file unmodified.
Matt Harbison <matt_harbison@yahoo.com> [Sat, 11 Nov 2017 12:37:05 -0500] rev 35166
tests: add globs for Windows
Yuya Nishihara <yuya@tcha.org> [Sat, 25 Nov 2017 15:29:34 +0900] rev 35165
cat: record the current behavior of wildcard matches in subrepos
Mercurial subrepos support any match patterns.
Yuya Nishihara <yuya@tcha.org> [Thu, 30 Nov 2017 22:32:13 +0900] rev 35164
match: remove doc about undefined behavior of visitdir()
This was added by
8545bd381504, but core matchers support visitdir() of
arbitrary locations since
2773540c3650, and verifier._verifymanifest()
doesn't seem to strictly obey the restriction.
I have no idea how important this API contract is for third-party extensions.
That's why this patch is RFC.
Augie Fackler <augie@google.com> [Thu, 30 Nov 2017 15:48:42 -0500] rev 35163
merge with stable
Anton Shestakov <av6@dwimlabs.net> [Wed, 22 Nov 2017 22:18:06 +0800] rev 35162
hgweb: add .jshintrc with some basic rules
This file is picked up automatically by jshint, so no extra changes required in
test-check-jshint.t.
Anton Shestakov <av6@dwimlabs.net> [Wed, 22 Nov 2017 22:11:37 +0800] rev 35161
hgweb: look up "URLSearchParams" in "window" to work around jshint issues
Unfortunately, current version of jshint (2.9.5) doesn't know such a global
variable and complains that it's undefined. Since this line tries to look up
URLSearchParams in a global scope (i.e. window), let's simply preface it with
"window." to work around jshint.
Anton Shestakov <av6@dwimlabs.net> [Wed, 22 Nov 2017 21:49:36 +0800] rev 35160
hgweb: define locally used variables as actually local in mercurial.js
Variables that are used or assigned without any declaration using var (or let,
or const) are considered global. In many cases this is inadvertent and actually
causes a variable leaking to a broader scope, such as a temporary variable used
inside a loop suddenly being accessible in global scope. (This corresponds to
"undef" option of jshint).
So this patch limits the scope of variables that don't need to be global. There
are a lot of helper variables in Graph.render() used in a loop, I've declared
them all on one line to reduce patch size. "radius" is special because it
wasn't passed to graph.vertex, but was used there (it worked because this
variable leaked to global scope). "window.graph" is created by an inline script
in graph.tmpl so that it can be used in ajaxScrollInit() function, this patch
makes this fact explicit by assigning window.graph to a local variable.
Anton Shestakov <av6@dwimlabs.net> [Wed, 22 Nov 2017 21:32:18 +0800] rev 35159
hgweb: rename an instance of XMLHttpRequest to xhr in mercurial.js
"xhr" is a really widespread name for this kind of things, no idea where did
"xfr" come from (the original
2228bd109706 doesn't explain that). Let's just
change one letter so the name makes more sense.
Anton Shestakov <av6@dwimlabs.net> [Wed, 22 Nov 2017 21:15:44 +0800] rev 35158
hgweb: properly iterate over arrays and objects in mercurial.js
In JavaScript, using for-in loops to access every property of an object can
have unexpected results when inheritance is involved. For example, if some
piece of code adds a property (it may be a method too) to Object.prototype,
then all for-in loops that iterate over keys of any object (also anything that
inherits Object) will get that property on one of the iterations. To filter out
such unexpected properties for-in loops have to use Object.hasOwnProperty()
method. (This corresponds to "forin" option of jshint).
In the two first cases "data" and "edges" are arrays, to it's simpler to just
switch to using a regular for-with-a-counter loop.
Anton Shestakov <av6@dwimlabs.net> [Wed, 22 Nov 2017 20:52:59 +0800] rev 35157
hgweb: use strict equals in mercurial.js
This patch changes "==" (equals operator) to "===" (strict equals operator).
The difference between them is that the latter doesn't do any type coercions.
It's handy to compare string '1' to number 1 sometimes, but most of the time
using "==" is inadvertent and can be replaced by an explicit type conversion.
(This corresponds to "eqeqeq" option of jshint).
Some of the changes in this patch are straightforward, e.g. when comparing
results of typeof (they could only be strings). The same goes for 'none' and
similar strings that can't be sensibly coerced to some other type. Two changes
that compare values to "1" and "0" can be clarified: getAttribute() returns
either a string or null, but comparing null to a string is always false, so no
logic is lost.
Anton Shestakov <av6@dwimlabs.net> [Wed, 22 Nov 2017 20:32:07 +0800] rev 35156
hgweb: use strict equals, remove non-breaking space in followlines.js
The first hunk had a non-breaking space character just before "{", it's not an
error or anything, but let's fix it while we're at it. (This corresponds to
"nonbsp" option of jshint).
Hunks 2 and 3 change "==" (equals operator) to "===" (strict equals operator).
The difference between them is that the latter doesn't do any type coercions.
It's handy to compare string '1' to number 1 sometimes, but most of the time
using "==" is inadvertent and can be replaced by an explicit type conversion.
(This corresponds to "eqeqeq" option of jshint).
Most of this file already uses strict equals operator, and in the code affected
type coercion is not needed, because tagName and selectableTag are both strings
and endId and startId are both numbers.
Martin von Zweigbergk <martinvonz@google.com> [Wed, 29 Nov 2017 10:34:49 -0800] rev 35155
run-tests: make "| foo (re)" not match everything
We make "foo (re)" match the entire line by adding a \Z to the regular
expression before matching. However, that doesn't help when the
regular expression is something like "| foo", because that gets
translated to "| foo\Z", where the "|" has lower precedence and it
thus matches the empty string, which is of course a prefix of every
string. Fix by wrapping expression in a group before adding the \Z to
the end.
Differential Revision: https://phab.mercurial-scm.org/D1546
Martin von Zweigbergk <martinvonz@google.com> [Wed, 29 Nov 2017 10:58:32 -0800] rev 35154
tests: fix regex in test-subrepo-git.t to match entire string
Due to a bug in the test runner (fixed by the next commit), the regex
used for matching lines like " foobar | 2 +-" stoppped at the "|" and
the test passed even though the rest of the line did not match. The
test seems to have been supposed to match "|" and "+" literally on
those lines, so this changes the regex to escape those characters. It
also changes a "\s*" to "\s+" since I think we'll always include a
space after the "|" in the diffstat output.
Differential Revision: https://phab.mercurial-scm.org/D1545
Augie Fackler <augie@google.com> [Wed, 29 Nov 2017 17:06:45 -0500] rev 35153
contrib: improve check-code ban on $LOCALIP in output without (glob)
Differential Revision: https://phab.mercurial-scm.org/D1553
Augie Fackler <augie@google.com> [Wed, 29 Nov 2017 17:05:51 -0500] rev 35152
tests: re-add (glob) for $LOCALIP matches
This should fix most of the failing tests on the FreeBSD builder,
since it has no 127/8 series IP as a side effect of being trapped in a
jail.
Differential Revision: https://phab.mercurial-scm.org/D1552
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 29 Nov 2017 08:44:06 +0530] rev 35151
py3: make sure the first argument of time.strftime() is str
time.strftime() does not accepts bytes as its first argument on py3.
Differential Revision: https://phab.mercurial-scm.org/D1559
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 29 Nov 2017 08:46:37 +0530] rev 35150
py3: alias xrange to range in tests/seq.py
Differential Revision: https://phab.mercurial-scm.org/D1560
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 29 Nov 2017 08:40:58 +0530] rev 35149
py3: use pycompat.maplist() instead of map()
Differential Revision: https://phab.mercurial-scm.org/D1558
Anton Shestakov <av6@dwimlabs.net> [Thu, 30 Nov 2017 16:30:43 +0800] rev 35148
tests: move JSON escape test to test-hgweb-json.t
The original tests (kanji and null) in test-hgweb-commands.t come from
aff419e260f9 and
823a7d79ef82, but they check json escape filter by using
JavaScript variable on /graph page, which is awkward, and I'm planning to
remove commit description from this variable soon. Let's move the parts that
check json template filter to a more appropriate file and use normal json-*
templates.
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 29 Nov 2017 07:57:17 +0530] rev 35147
py3: fix handling of keyword arguments in revert
Differential Revision: https://phab.mercurial-scm.org/D1554