Saurabh Singh <singhsrb@fb.com> [Fri, 01 Sep 2017 12:34:34 -0700] rev 34059
amend: add tests for amending only some files from commit to be amended
We do not have robust enough tests for scenarios where only some files in a
changeset are amended. This presents an interesting scenario because the
working copy could have modified versions of the remaining files in the
pre-amend changeset. Therefore, I have added some tests to ensure that amend
behaves as expected in these scenarios.
Test Plan:
Ensured that the test "test-commit-amend.t" passes.
Differential Revision: https://phab.mercurial-scm.org/D596
Yuya Nishihara <yuya@tcha.org> [Sat, 02 Sep 2017 21:49:45 +0900] rev 34058
test-editor-filename: fix portability of fake editor command
- /bin/bash doesn't exist on FreeBSD
- edit is executed by cmd.exe on Windows
Saurabh Singh <singhsrb@fb.com> [Fri, 01 Sep 2017 12:34:36 -0700] rev 34057
amend: moving first assignment of newid closer to its use
newid was needlessly further away from where its intended to be used
leading to bad readability. This commit moves it to address the same. The end
goal is to remove the redundant commit in the amend code path and this commit
takes care of cleaning up some unrelated code before that change.
Test Plan:
ran the test suite
Differential Revision: https://phab.mercurial-scm.org/D597
Saurabh Singh <singhsrb@fb.com> [Thu, 31 Aug 2017 18:35:39 -0700] rev 34056
amend: rectify comment
Comment was ambiguous as there can be two parents of a changeset in mercurial.
This commit fixes the comment to clarify that the first parent is being
considered.
Test Plan:
ran the test suite
Differential Revision: https://phab.mercurial-scm.org/D595
Saurabh Singh <singhsrb@fb.com> [Fri, 01 Sep 2017 15:08:54 -0700] rev 34055
amend: removing redundant if condition
There is needless checking for the new commit hash not being equal to
the old commit hash. This condition will always be true at this point in the
code path and thus, can be removed safely. This commit removes the redundant
condition.
Test Plan:
ran the test suite.
Differential Revision: https://phab.mercurial-scm.org/D594
Michael Bolin <mbolin@fb.com> [Fri, 01 Sep 2017 20:28:26 +0000] rev 34054
editor: file created for diff action should have .diff suffix
This is a follow-up to https://phab.mercurial-scm.org/D464 (
6e6452bc441d) that
introduced the new file extension behavior. It erroneously changed `.diff` to
`.diff.hg.txt`.
Test Plan:
Verified `make tests` passes, particularly `test-editor-filename.t`.
Differential Revision: https://phab.mercurial-scm.org/D607
Jun Wu <quark@fb.com> [Fri, 01 Sep 2017 11:13:55 -0700] rev 34053
test-amend: match output using conditional test case name
D466 (
6cc8f848b4c3) allows output to be conditionally matched by test name.
This patch changes test-amend.t to use that feature, instead of duplicating
`hg amend` command or use `-q` to silence its output.
Differential Revision: https://phab.mercurial-scm.org/D601
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 31 Aug 2017 19:40:15 -0700] rev 34052
util: use set for reserved Windows filenames
Previously, we were performing membership testing against a
list. Change it to a set for a minor perf win. While we're at it,
explode the assignment in place so less work is needed at module
import time.
Differential Revision: https://phab.mercurial-scm.org/D600
Phil Cohen <phillco@fb.com> [Fri, 01 Sep 2017 11:52:20 -0700] rev 34051
context: add arbitraryfilectx, which can represent files outside the workdir
Move it from contrib/simplemerge so it can be re-used in the future.
Differential Revision: https://phab.mercurial-scm.org/D604
Phil Cohen <phillco@fb.com> [Fri, 01 Sep 2017 10:35:43 -0700] rev 34050
simplemerge: remove unused `filtereddata` parameter
Differential Revision: https://phab.mercurial-scm.org/D603
Phil Cohen <phillco@fb.com> [Fri, 01 Sep 2017 10:35:43 -0700] rev 34049
simplemerge: remove unused `repo` parameter
This is now no longer used or needed thanks to the `decodeddata()` context
function.
Differential Revision: https://phab.mercurial-scm.org/D602
Christophe de Vienne <christophe@cdevienne.info> [Tue, 29 Aug 2017 18:24:51 +0200] rev 34048
extensions: prohibit unicode defaults
If the default value of an option is a unicode string (something
than happen easily when using a 'from __future__ import unicode_literals'),
any value passed on the command line will be ignored because the fancyopts
module only checks for byte strings and not unicode strings.
Changing fancyopts behavior is easy but would make assumptions on how
the python3 port should be done, which is outside the scope of this patch.
The chosen approach is to stop an extension from being loaded when a unicode
default value is detected, with a hint for the developer.
Yuya Nishihara <yuya@tcha.org> [Sat, 19 Aug 2017 22:04:03 +0900] rev 34047
revsetlang: remove unused functions
Superseded by the _match() function.
Yuya Nishihara <yuya@tcha.org> [Wed, 17 Feb 2016 21:40:59 +0900] rev 34046
revsetlang: match tree by helper function on optimize
This should make optimize() more readable and less error-prone, but it doubles
the parsing cost.
(original)
$ python -m timeit -n10000 -s 'from mercurial import revsetlang as L' \
'L.optimize(L.analyze(L.parse("ancestors(x) and not ancestors(y)")))'
10000 loops, best of 3: 79.3 usec per loop
(this patch)
$ python -m timeit -n10000 -s 'from mercurial import revsetlang as L' \
'L._treecache.clear(); \
L.optimize(L.analyze(L.parse("ancestors(x) and not ancestors(y)")))'
10000 loops, best of 3: 201 usec per loop
Yuya Nishihara <yuya@tcha.org> [Wed, 17 Feb 2016 21:31:09 +0900] rev 34045
parser: add helper function to test if pattern matches parsed tree
This function will be used as follows:
match('ancestors(_) and not ancestors(_)', x)
See the next patch for details.
Yuya Nishihara <yuya@tcha.org> [Wed, 17 Feb 2016 21:38:25 +0900] rev 34044
revsetlang: build optimized tree by helper function
This should make optimize() more readable, but it doubles the parsing cost.
(original)
$ python -m timeit -n10000 -s 'from mercurial import revsetlang as L' \
'L.optimize(L.analyze(L.parse("::tip")))'
10000 loops, best of 3: 18.1 usec per loop
(this patch)
$ python -m timeit -n10000 -s 'from mercurial import revsetlang as L' \
'L._treecache.clear(); L.optimize(L.analyze(L.parse("::tip")))'
10000 loops, best of 3: 48.4 usec per loop
30usec isn't dominant compared to the revset evaluation, but that is a cost.
That's why a parsed tree is cached, which can benefit in hgweb or chg server.
Yuya Nishihara <yuya@tcha.org> [Wed, 17 Feb 2016 21:30:04 +0900] rev 34043
parser: add helper function that constructs parsed tree from template
This function will be used as follows:
build('only(_, _)', x, y)
See the next patch for details.
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 30 Aug 2017 18:19:14 +0530] rev 34042
patch: take messages out of the function so that extensions can add entries
Extensions will want to have interactive thing for more operations or
particulary want to show more verbs. So this patch takes out the message thing
from the function so that extensions can add verbs to this. The curses one is
also not in any function so extensions can add more actions and verbs there.
Differential Revision: https://phab.mercurial-scm.org/D567
Jun Wu <quark@fb.com> [Wed, 02 Aug 2017 21:24:29 -0700] rev 34041
run-tests: allow bisecting a different repo
Add `--bisect-repo` flag which accepts a different repo to bisect.
3rd party extensions may reuse `run-tests.py` from core to run tests. Test
failure could be caused by either a core hg change or the 3rd party
extension code itself. Having a way to specify which repo to bisect is
useful.
Differential Revision: https://phab.mercurial-scm.org/D578
Jun Wu <quark@fb.com> [Wed, 02 Aug 2017 21:01:38 -0700] rev 34040
run-tests: extract prefix of bisect commands to a variable
This does not change any logic.
Differential Revision: https://phab.mercurial-scm.org/D577
Jun Wu <quark@fb.com> [Wed, 02 Aug 2017 21:01:38 -0700] rev 34039
run-tests: pass --with-hg to run-tests.py command used by bisect
This makes `run-tests.py -l test-run-tests.t` 23 seconds faster on my
laptop. Inside the test, `$ rt --known-good-rev=0 test-bisect.t` took 24.9
seconds before, and 1.2 seconds after.
Differential Revision: https://phab.mercurial-scm.org/D576
Jun Wu <quark@fb.com> [Mon, 28 Aug 2017 13:43:25 -0700] rev 34038
import-checker: allow relative import a module being checked
This would make the checker more friendly for 3rd-party code. For example,
In remotefilelog/x.py, it may have:
from . import shallowutils
That could trigger "relative import of stdlib module" if
"remotefilelog" was installed in the system. If the module being checked
conflicts with the system module, it makes sense to not treat that module as
system module. This patch makes it so.
Differential Revision: https://phab.mercurial-scm.org/D552
Phil Cohen <phillco@fb.com> [Thu, 31 Aug 2017 11:28:59 -0700] rev 34037
merge: move some of the logic in batchget() to workingfilectx
We will use this logic in two places with in-memory merge.
Differential Revision: https://phab.mercurial-scm.org/D444
Phil Cohen <phillco@fb.com> [Thu, 31 Aug 2017 11:28:59 -0700] rev 34036
filemerge: add _restorebackup
Differential Revision: https://phab.mercurial-scm.org/D404
Phil Cohen <phillco@fb.com> [Thu, 31 Aug 2017 11:28:59 -0700] rev 34035
filemerge: reduce creation of tempfiles until needed
This restricts the creation of temporary files to just `_xmerge`, when we call
an external tool.
Differential Revision: https://phab.mercurial-scm.org/D403
Phil Cohen <phillco@fb.com> [Thu, 31 Aug 2017 11:28:59 -0700] rev 34034
filemerge: add `_workingpath`
This reduces any reliance on `a`.
Differential Revision: https://phab.mercurial-scm.org/D401
Phil Cohen <phillco@fb.com> [Thu, 31 Aug 2017 11:28:59 -0700] rev 34033
filemerge: move a util copy call to filectx.write
This way a future in-memory-merge context can intercept them.
Differential Revision: https://phab.mercurial-scm.org/D400
Phil Cohen <phillco@fb.com> [Thu, 31 Aug 2017 11:28:59 -0700] rev 34032
filemerge: eliminate most uses of tempfiles
Emphasize that they're unused so we can more easily remove them later.
Differential Revision: https://phab.mercurial-scm.org/D399
Phil Cohen <phillco@fb.com> [Thu, 31 Aug 2017 11:05:19 -0700] rev 34031
filemerge: extract _maketemp and _makebackup
These functions will be modified by in-memory merge, so let's extract them first and add some comments.
This also shortens `_filemerge` a bit.
Differential Revision: https://phab.mercurial-scm.org/D388
Yuya Nishihara <yuya@tcha.org> [Thu, 31 Aug 2017 21:56:40 +0900] rev 34030
encoding: check overflow while calculating size of JSON escape buffer
The minimum input size to exploit is ~682MB (= INT_MAX / len('\\u0000') * 2)
on 32bit system, which isn't easy to achieve using Python str in 2GB process
address space, but probably doable.