Pulkit Goyal <7895pulkit@gmail.com> [Fri, 24 Jul 2020 16:18:39 +0530] rev 45282
merge: introduce mergeresult.addfile() and use it
We want to use mergeresult object at more and more places instead of this
actions dict to simplify code and further add new APIs to mergeresult object.
This patch introduces `addfile()` which adds a new file to the internal actions
dict for now.
Differential Revision: https://phab.mercurial-scm.org/D8820
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 24 Jul 2020 15:56:11 +0530] rev 45281
merge: make mergeresult constructor initialize empty object
In future patches, we will be going to update mergeresult object
instead of building an actions dict and then setting it in the object.
Differential Revision: https://phab.mercurial-scm.org/D8819
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 24 Jul 2020 15:15:20 +0530] rev 45280
merge: improve documentation of fbid dict used for merge bid
I improved the comments explaning what the dict contains meanwhile organizing
the comment structure which prevents some confusion.
Due to formatting issues, the empty dict was wrapped in `()` which might decieve
in thinking that it's a tuple of dict until you decide to find a comma.
Differential Revision: https://phab.mercurial-scm.org/D8818
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 24 Jul 2020 14:45:00 +0530] rev 45279
merge: move conversion of file-key dict to action-key dict in mergeresult
Initially the actions dict which we get has file has keys, but later we want a
dict which has actions as keys. This patch moves code computing that to
mergeresult class as that's where it should be anyway.
Differential Revision: https://phab.mercurial-scm.org/D8817
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 02 Aug 2020 10:12:21 -0700] rev 45278
merge: introduce hasconflicts() on mergeresult object
This and upcoming patches will improve the mergeresult object making it more
powerful and provide clean APIs for various things. Doing this will clean up the
core merge code which is present in `update()` a bit.
Differential Revision: https://phab.mercurial-scm.org/D8816
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 14 Jul 2020 16:40:28 +0530] rev 45277
merge: remove no longer required ACTION_GET_OTHER_AND_STORE
In
1b8fd4af33189c84feadb47c74d659ec31cde3b9 I (ab)used merge actions to pass
info from manifestmerge() to applyupdates() and store info in mergestate.
In previous patches, we introduced a separate return value from manifestmerge()
and calculateupdates() and an argument to applyupdates() which achieved the same
thing.
Let's remove this no longer required messy code.
Differential Revision: https://phab.mercurial-scm.org/D8744
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 14 Jul 2020 16:31:52 +0530] rev 45276
merge: pass commitinfo to applyupdates() and get it stored in mergestate
This patch passes the commitinfo calulcated in manifestmerge() to applyupdates()
so that it can be read there and stored in mergestate. On commit, we can read
mergestate for such information and act accordingly.
This patch also makes ACTION_GET_OTHER_AND_STORE not required anymore. Next
patch will remove the messy code surrounding it.
Differential Revision: https://phab.mercurial-scm.org/D8743
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 14 Jul 2020 16:21:08 +0530] rev 45275
merge: introduce 'commitinfo' in mergeresult
commitinfo will be used to pass information which is required on commit phase
from the merge phase.
One common example is, merge chooses filenode from second parent and we need to
tell commit to choose that. Right now this one and related cases are not very
neatly implement and there is no clear line on how to pass on such information.
Upcoming patches will try to work on in this area and make things easier.
Differential Revision: https://phab.mercurial-scm.org/D8742
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 23 Jul 2020 18:03:14 +0530] rev 45274
merge: return a mergeresult obj from manifestmerge(), calculateupdates() (API)
Earlier, manifestmerge() and calculateupdates() returns a tuple of three things.
I wanted to add one more thing to return value.
Introducing a special class which represents results of a merge will help
understand better and also ease adding new return values.
Differential Revision: https://phab.mercurial-scm.org/D8799
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 23:13:58 +0530] rev 45273
Added signature for changeset
7fc3c5fbc65f
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 03 Aug 2020 23:13:52 +0530] rev 45272
Added tag 5.5 for changeset
7fc3c5fbc65f
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 01 Aug 2020 18:39:28 +0530] rev 45271
mergestate: fix BC breakage introduced because of removal of a merge record
In
fcd0cff3400a I removed the usage of RECORD_RESOLVED_OTHER. However I also
removed the reading support, hence if there is any user who runs into merge
conflict with older version of hg, upgrades hg and then tries to read
mergestate, they will end up with an MergeRecordUnsupportedError.
Martin von Zweigbergk <martinvonz@google.com> [Thu, 30 Jul 2020 22:49:51 -0700] rev 45270
packaging: delete unnecessary updating of `dirs` list
The `dirs` list is not used and it seems it also wasn't used when this
code was added in
395b0e132836 (Don't copy hidden files/directories
during `setup.py install`, 2009-07-14).
Differential Revision: https://phab.mercurial-scm.org/D8857
Martin von Zweigbergk <martinvonz@google.com> [Sun, 02 Aug 2020 10:08:18 -0700] rev 45269
packaging: make "mercurial.defaultrc" a key in package_data
Before this patch, we had a `mercurial` key with a `defaultrc/*.rc`
value. It seems more correct to have a `mercurial.defaultrc` key with
a `*.rc` value since `mercurial.defaultrc` it became a pacakge in
1390bb81163e (help: get helptext/ data from `resources` module if
available, 2019-12-12).
Differential Revision: https://phab.mercurial-scm.org/D8856
Martin von Zweigbergk <martinvonz@google.com> [Thu, 30 Jul 2020 12:22:41 -0700] rev 45268
templatespec: use new factory functions in hooklib
Differential Revision: https://phab.mercurial-scm.org/D8853
Martin von Zweigbergk <martinvonz@google.com> [Mon, 20 Jul 2020 22:43:33 -0700] rev 45267
templatespec: use new factory functions in logcmdutil
Differential Revision: https://phab.mercurial-scm.org/D8848
Martin von Zweigbergk <martinvonz@google.com> [Mon, 20 Jul 2020 21:33:28 -0700] rev 45266
templatespec: move check for non-unicode to lower-level function
Now that we have the factory functions, it makes sense to have the
check there.
Differential Revision: https://phab.mercurial-scm.org/D8847
Martin von Zweigbergk <martinvonz@google.com> [Mon, 20 Jul 2020 21:32:10 -0700] rev 45265
templatespec: logcmdutil.templatespec() gets either template or mapfile
The callers of the function already never pass (non-`None`) values for
both, so let's check that and call the new factory functions.
Differential Revision: https://phab.mercurial-scm.org/D8846
Martin von Zweigbergk <martinvonz@google.com> [Thu, 16 Jul 2020 13:33:46 -0700] rev 45264
templatespec: create a factory function for each type there is
Most of the arguments to the `templatespec` constructor are mutually
exclusive, so each combination creates a different type of
templatespec. Let's clarify that by creating factory functions.
I've left the callers in `logcmdutil` unchanged for now because they
are more complex and `logcmdutil.templatespec()` is slightly higher
level in that it is specific to changesets.
My larger goal is to add support frozen binaries (specifically
PyOxidizer) by adding a specific type of `templatespec` for built-in
templates. That will get its own factory function.
Differential Revision: https://phab.mercurial-scm.org/D8845
Martin von Zweigbergk <martinvonz@google.com> [Wed, 29 Jul 2020 10:42:09 -0700] rev 45263
templater: stop accepting a single style to stylemap()
The code seems to have been for compatibility across
d3dbdca92458
(hgweb: don't choke when an inexistent style is requested (
issue1901),
2009-11-12).
Differential Revision: https://phab.mercurial-scm.org/D8844
Martin von Zweigbergk <martinvonz@google.com> [Thu, 23 Jul 2020 10:20:48 -0700] rev 45262
formatter: inline a variable assigned from `templater.templater.frommapfile`
The variable doesn't get reused and it doesn't help formatting, so I
don't see any reason for it.
Differential Revision: https://phab.mercurial-scm.org/D8807
Martin von Zweigbergk <martinvonz@google.com> [Wed, 22 Jul 2020 21:23:46 -0700] rev 45261
templater: don't normalize path separators to '/' when interacting with OS
`_readmapfile()` is about reading a map file from the file system, so
we shouldn't use our `util.normpath()`, which also normalizes `os.sep`
to '/'.
Differential Revision: https://phab.mercurial-scm.org/D8806
Martin von Zweigbergk <martinvonz@google.com> [Thu, 23 Jul 2020 22:50:20 -0700] rev 45260
formatter: remove now-unnecessary check for file-ness
`templater.templatepath()` now returns non-`None` only for files, so
the caller doesn't have to check.
Differential Revision: https://phab.mercurial-scm.org/D8805
Martin von Zweigbergk <martinvonz@google.com> [Thu, 23 Jul 2020 22:47:55 -0700] rev 45259
templater: make templatepath() not return directory paths
The previous patch added a test showing an unusal error message. This
make it more like other error messages.
Differential Revision: https://phab.mercurial-scm.org/D8804
Martin von Zweigbergk <martinvonz@google.com> [Thu, 23 Jul 2020 22:44:18 -0700] rev 45258
tests: show unusual error message for `hg log --style coal`
It turns out that we show the full path when the given style name
matches a subdirectory of `mercurial/templates/`.
Differential Revision: https://phab.mercurial-scm.org/D8803
Martin von Zweigbergk <martinvonz@google.com> [Wed, 22 Jul 2020 10:34:24 -0700] rev 45257
config: remove now-unused `abs` argument from `include` callback
Differential Revision: https://phab.mercurial-scm.org/D8796
Martin von Zweigbergk <martinvonz@google.com> [Wed, 22 Jul 2020 10:32:28 -0700] rev 45256
config: re-calculate absolute %include path in `include` callback
This removes the last user of the `abs` argument for the `include`
callback. The next patch will remove the argument.
Differential Revision: https://phab.mercurial-scm.org/D8795
Martin von Zweigbergk <martinvonz@google.com> [Wed, 22 Jul 2020 10:25:28 -0700] rev 45255
subrepoutil: use relative path for looking up config `%include`s
The code was already working with relative paths in practice, since it
passed in a (repo-)relative path into its local `read()` function. So
all that this patch actually does is to switch to rename variables so
we use the same path by a different name. This gets us closer to
removing the "absolute" path from the `include` callback.
Differential Revision: https://phab.mercurial-scm.org/D8794
Martin von Zweigbergk <martinvonz@google.com> [Wed, 22 Jul 2020 00:13:02 -0700] rev 45254
config: remove now-unused support for "includepaths"
This effectively undoes
081b08e4ea13 (templater: look for mapfiles in
template paths, 2015-05-15).
Differential Revision: https://phab.mercurial-scm.org/D8793
Yuya Nishihara <yuya@tcha.org> [Sat, 25 Jul 2020 22:51:26 +0900] rev 45253
dispatch: adjust ui.flush() timing to stabilize test-blackbox.t
Without this change, dispatch.dispatch() could return before flushing all
stdio data. This means chg stdio would print data after receiving the result
code.
--- tests/test-blackbox.t
+++ tests/test-blackbox.t.err
@@ -354,13 +354,13 @@
> EOF
$ hg log --debug
removing $TESTTMP/gone/.hg
- warning: cannot write to blackbox.log: $ENOENT$ (no-windows !)
warning: cannot write to blackbox.log: $TESTTMP/gone/.hg/blackbox.log: $ENOTDIR$ (windows !)
$ cd ..
blackbox should disable itself if track is empty
$ hg --config blackbox.track= init nothing_tracked
+ warning: cannot write to blackbox.log: $ENOENT$
$ cd nothing_tracked
$ cat >> .hg/hgrc << EOF
> [blackbox]
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 26 Jul 2020 12:46:04 -0700] rev 45252
clonebundles: document REQUIREDRAM key
This is a follow-up to
72feaeb510b3, which introduced the feature. The
key should be documented as part of the format specification inside the
extension docstring.
Differential Revision: https://phab.mercurial-scm.org/D8838
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 25 Jul 2020 15:37:05 +0200] rev 45251
commitctx: gather more code dealing with copy-in-extra
Now that we have a function that deal with the copy-in-extra special case, we
can gather more code meant to deal with this special case. Making the rest of
the code simpler.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 25 Jul 2020 15:33:45 +0200] rev 45250
commitctx: rename files to touched in a couple of place
This is a clearer word that we will use increasingly over this series. It also
make the old variable name available to another usage :-)
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 25 Jul 2020 15:13:25 +0200] rev 45249
commitctx: extract copy information encoding into extra into commit.py
The encoding of copy information into extra has multiple subcases and become
quite complicated (eg: empty list can be explicitly or implicitly stored for
example). In addition, it is niche experimental feature since as it affect the
hash, it is only suitable for user who don't mercurial for storage server side
(ie: Google).
Having this complexity part of the changelog will get in the way of further
cleanup. We could have to either move more of that logic into the changelog or
to move or extract more of the logic at the higher level. We take the second
approach and start gather logic in dedicated function in commit.py.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 25 Jul 2020 14:59:55 +0200] rev 45248
commitctx: create the new extra dict on its own line
A trivial move to make the next changeset easier to read.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 29 Jul 2020 15:40:13 +0200] rev 45247
commitctx: explicitly pass `manifest` to _commit_manifest
As pointed out by Yuya Nishihara.
Ian Moody <moz-ian@perix.co.uk> [Thu, 30 Jul 2020 16:58:38 +0100] rev 45246
phabricator: unconditionally pop `test_vcr` to fix debugcallconduit
11592ce6a711 / D8525 accidentally broke debugcallconduit in non-test scenarios
because it stopped popping `test_vcr` from `kwargs` unconditionally, so when
`--test-vcr` isn't set the empty string still gets passed down as the value of
`test_vcr` in `kwargs`. However unlike all the other commands debugcallconduit
doesn't have an `**opts` argument to receive it, so it aborts because of
invalid arguments.
Differential Revision: https://phab.mercurial-scm.org/D8852
Ian Moody <moz-ian@perix.co.uk> [Thu, 30 Jul 2020 16:52:12 +0100] rev 45245
phabricator: demonstrate debugcallconduit being broken without --test-vcr
This was accidentally broken by
11592ce6a711 / D8525
Differential Revision: https://phab.mercurial-scm.org/D8851
Martin von Zweigbergk <martinvonz@google.com> [Tue, 28 Jul 2020 11:11:14 -0700] rev 45244
cleanup: fix bad formatting of state.py from D8811
`test-check-format.t` was failing for me. Do I just have the wrong
version?
Differential Revision: https://phab.mercurial-scm.org/D8841
Joerg Sonnenberger <joerg@bec.de> [Thu, 30 Jul 2020 16:13:17 +0200] rev 45243
dirstate: restore original estimation and update comment
The former comment didn't reflect the content of the dirstate entries,
the two nodes are a fixed header in the file and not per-entry. Split
the documented entry into the path part and the fixed header. The
heuristic itself is still valid, e.g. for the NetBSD src tree a maximum
path size of 142 and an average of 49, resulting in 66 bytes per entry
on average.
Differential Revision: https://phab.mercurial-scm.org/D8850
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 31 Jul 2020 17:09:31 +0530] rev 45242
merge stable in default
Joerg Sonnenberger <joerg@bec.de> [Thu, 30 Jul 2020 01:10:10 +0200] rev 45241
dirstate: revert change to Rust binding
The Rust binding uses its own class and is not derived from the regular
implementation. As such, it didn't get _nodelen.
Differential Revision: https://phab.mercurial-scm.org/D8849
Martin von Zweigbergk <martinvonz@google.com> [Tue, 28 Jul 2020 10:19:49 -0700] rev 45240
relnotes: copy "next" to "5.5" and clear "next"
The same procedure as every year^Wcycle.
Differential Revision: https://phab.mercurial-scm.org/D8839
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 23:52:31 +0200] rev 45239
commitctx: extract all the file preparation logic in a new function
Before we actually start to create a new commit we have a large block of logic
that do the necessary file and manifest commit and that determine which files
are been affected by the commit (and how).
This is a complex process on its own. It return a "simple" output that can be
fed to the next step. The output itself is not that simple as we return a lot of
individual items (files, added, removed, ...). My next step (and actual goal for
this cleanup) will be to simplify the return by returning a richer object that
will be more suited for the variation of data we want to store.
After this changeset the `commitctx` is a collection of smaller function with
limited scope. The largest one is still `_filecommit` without about 100 lines of
code.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 23:58:23 +0200] rev 45238
commitctx: gather more preparation code within the lock context
This is a small change that exist mostly for clarification. I am about to move a
large amount of code in its own function. having all that code next to each
other will make the next changeset clearer.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 23:40:59 +0200] rev 45237
commitctx: move a special case about files earlier
Same logic as a changeset a bit earlier, the `writefilecopymeta` section is more
a post processing details so we move the conditional about `files` value closer
to the rest of the code computing `files` value.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 18:25:45 +0200] rev 45236
commitctx: extract all the manual logic to process the files
That branch of the if is significantly more complicated than the other two.
Moving it to its own function make it simple to keep the scope limited and to
read to the higher level function.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 23:08:00 +0200] rev 45235
commitctx: treat `filesadded` more like `filesremoved`
Accumulating the filename in a list will have a negligible cost and deal with
the list of added files like the other ones will make is code cleaning simpler.
The two variable with very close name is not great, but my plan is to split most
of the code in a separated function which will make the "problem" go away by
itself.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 22:58:29 +0200] rev 45234
commitctx: move `writechangesetcopy` business at the end a code section
This code is to handle a specific subcase so we move it a the end. This allow
to gather the rest of the "core" code closer to the related logic.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 21:09:42 +0200] rev 45233
commitctx: move copy meta config reading in a dedicated function
The logic is non trivial, make it contained in a function is clearer. It also
unlock easy re-use of that logic without having the pass the value around.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 21:03:30 +0200] rev 45232
commitctx: no longer use the `writecopiesto` variable in the function
The `writefilecopymeta` variable already carry the same information, so we can
use `writefilecopymeta` in the one conditional where `writecopiesto` was used.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 14:58:21 +0200] rev 45231
commitctx: extract the function that commit a new manifest
The logic is large enough and isolated enough to be extracted, this reduce the
size of the main function, making it simpler to follow.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 24 Jul 2020 12:52:32 +0200] rev 45230
commitctx: stop using weakref proxy for transaction
This weakref proxy was introduced in 2007 by
30d4d8985dd8.
If I understand it correctly, the logic at that time was relying on the
transaction destructor, triggered at garbage collection time to rollback failed
transaction. passing the object to sub function directly mean it would live in
the function scope and be trapped in the traceback on exception, leading to the
transaction rollback too late in some case.
Modern transaction usage use explicit opening and closing of transaction and no
longer rely on some internal reference counting details. So this weakref proxy
is no longer necessary. Absolutely no test are affected when we drop it.
Manuel Jacob <me@manueljacob.de> [Tue, 28 Jul 2020 20:47:50 +0200] rev 45229
rebase: fix regression in file change detection introduced by
0ecb3b11fcad
Before
0ecb3b11fcad, `wctx._compact()`, was called by `wctx.nofilechanges()` as
a side effect. Later, it turned out that this side effect is needed to correctly
detect which files changed. See https://phab.mercurial-scm.org/D8733#131949 for
the history.
The problem could also be triggered by running `tests/test-rebase-parameters.t`
with `--extra-config-opt rebase.experimental.inmemory=1`.
Differential Revision: https://phab.mercurial-scm.org/D8843
Manuel Jacob <me@manueljacob.de> [Tue, 28 Jul 2020 20:07:05 +0200] rev 45228
context: re-add `overlayworkingctx._compact()` removed in
6a5dcd754842
This partially backs out
6a5dcd754842. The method was and is unused, but a call
to it is introduced in the next patch.
Differential Revision: https://phab.mercurial-scm.org/D8842
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 16:30:30 +0200] rev 45227
push: test for checks preventing publishing obsolete changeset
The main difference from the previous test is how the changeset was obsoleted.
In this case it is an amend so publishing the orphan would also create phase
divergence. This must not go unnoticed.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 16:29:15 +0200] rev 45226
push: test for checks preventing publishing obsolete changeset
This introduce a simple example, more are coming. See inline documentation
for details.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 16:26:29 +0200] rev 45225
push: another test for checks preventing pushing orphaness to a server
In this one, orphan was create with and amend instead of a prune.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 16:23:43 +0200] rev 45224
push: test the checks preventing pushing orphaness to a server
This is introduce a simple example, more are coming. See inline documentation
for details.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Jul 2020 16:10:33 +0200] rev 45223
commitctx: document the None return for "touched" value
Martin von Zweigbergk <martinvonz@google.com> [Thu, 23 Jul 2020 22:06:36 -0700] rev 45222
tests: add tests trying to use dir as style, as %include, and as __base__
Differential Revision: https://phab.mercurial-scm.org/D8800
Martin von Zweigbergk <martinvonz@google.com> [Thu, 23 Jul 2020 22:06:31 -0700] rev 45221
tests: fix mistaken copy&paste from commit
4489e9a22763
Differential Revision: https://phab.mercurial-scm.org/D8802
Joerg Sonnenberger <joerg@bec.de> [Mon, 06 Jul 2020 15:10:53 +0200] rev 45220
manifest: kill one more instance of the old merge hash hack
Differential Revision: https://phab.mercurial-scm.org/D8766
Joerg Sonnenberger <joerg@bec.de> [Sat, 25 Jul 2020 04:29:17 +0200] rev 45219
dirstate: isolate node len dependency for the pure version
When switching to a 256bit hash function, this still needs adjustment,
but concentrates the change in one place.
Differential Revision: https://phab.mercurial-scm.org/D8815
Martin von Zweigbergk <martinvonz@google.com> [Fri, 24 Jul 2020 08:38:19 -0700] rev 45218
fix: update documentation to reflect preference for --source over --rev
I should have updated the documentation in
5205b46bd887 (fix: add a -s
option to format a revision and its descendants, 2020-03-13) and/or
a6ef1e8e2f6d (fix: mark -r as advanced, 2020-03-13)...
Differential Revision: https://phab.mercurial-scm.org/D8808
Kyle Lippincott <spectral@google.com> [Fri, 24 Jul 2020 16:32:45 -0700] rev 45217
tests: make check-py3-compat.py actually load the specified files correctly
For most uses, this change is essentially a no-op, as this script is generally
only run by test-check-py3-compat.t, which will already put `$TESTDIR/..` in
`$PYTHONPATH`.
When running outside of tests, however, `$PYTHONPATH` is likely not set, causing
check-py3-compat.py to parse the file from the repo, but then import the
installed version, and raise any errors about the installed version, not the one
currently in the repo.
Additionally, this helps users (like me) who have a strange set up where their
home directory (and thus their hg repos) happen to be in a subdirectory of
sys.prefix (which is /usr on my system). Since the '.' entry added to sys.path
takes precedence over the absolute path of `$TESTDIR/..` in `$PYTHONPATH`, the
path to the modules that it imports (and that show up in any stack trace) are
*relative*, meaning that we don't detect them as starting with `sys.prefix`.
Sample non-test invocation, and the difference this change makes (the path for
'error at <path>:<line>' is correct now)::
Before:
```
$ python3 contrib/check-py3-compat.py mercurial/win*.py
mercurial/win32.py: error importing: <ValueError> _type_ 'v' not supported (error at check-py3-compat.py:65)
mercurial/windows.py: error importing: <ModuleNotFoundError> No module named 'msvcrt' (error at check-py3-compat.py:65)
```
After:
```
$ python3 contrib/check-py3-compat.py mercurial/win*.py
mercurial/win32.py: error importing: <ValueError> _type_ 'v' not supported (error at win32.py:11)
mercurial/windows.py: error importing: <ModuleNotFoundError> No module named 'msvcrt' (error at windows.py:12)
```
Differential Revision: https://phab.mercurial-scm.org/D8814
Kyle Lippincott <spectral@google.com> [Fri, 24 Jul 2020 12:13:10 -0700] rev 45216
tests: virtualenv is only used on py2, rename and conditionalize
If I have I have the Debian `python3-virtualenv` package installed on my
machine, the import succeeds but then I receive an AttributeError because the
package is essentially completely different between py2 and py3, and
test-hghave fails.
Differential Revision: https://phab.mercurial-scm.org/D8812
Kyle Lippincott <spectral@google.com> [Thu, 23 Jul 2020 13:31:45 -0700] rev 45215
morestatus: mention --stop even if not using --verbose
Differential Revision: https://phab.mercurial-scm.org/D8811
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 16:57:56 +0200] rev 45214
exchange: backout changeset
c26335fa4225
Changeset
c26335fa4225 has good intends but introduce significant behavior
regressions for multiple important cases. In short there are many case where
push would have caught instability creation/propagation that are no longer
covered. These behavior have been covered for many years and even if some
related case are not currently caught, the covered one should not be regressed.
The next four changesets introduce tests for some of these cases. However we
could produce many more tests cases since the area is wide and they are many
possible combination. (And we should cover them when getting back to this issue)
Since 5.5 is one week away, the most reasonable approach seems to back this out
while we devise a new way to move forward that preserve the current behavior,
catch more issues and also improves the situation that
c26335fa4225 target.
In addition to the behavior change,
c26335fa4225 also introduced output
changes. These output changes does not requires a backout per-se, but are part of
the same changeset. However they come with a couple of issues that also requires
attention:
1) the bulk of the error message have been shoehorned into a multiple line abort
message. This seems quite different from what we usually do. The abort message
should be a compact and efficient message, with extra details being issued as
normal error output beforehand. (with --verbose/--quiet) support.
2) the current output is unbounded, so if there is many (tens, hundreds,
thousands, …) of unstable/obsolete changeset involved in the push, the output
can quickly become a scary and un-usuable wall of text. So we need some
limitation here (same as we have with the remote head list that says A, B , C
and # others).
Martin von Zweigbergk <martinvonz@google.com> [Fri, 24 Jul 2020 11:24:59 -0700] rev 45213
templater: handle None returned from templatedir()
My recent
91aa9bba3dc9 (templater: make templatepaths() return a
single path, or None, 2020-07-21) didn't account for the fact that
`templatedir()` returns `None` in frozen binaries. That is ironic,
since the reason I'm working on this is to add support for built-in
mapfiles in frozen binaries. This patch updates the callers to handle
the `None` case. It's somewhat ugly, but I will have to revisit this
soon anyway, since my goal is to make all callers handle that case by
trying to read the map file using the resources API instead.
Differential Revision: https://phab.mercurial-scm.org/D8810
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 24 Jul 2020 00:50:57 +0530] rev 45212
tests: glob 'mercurial.error' in test-phases.t
On python 2 with chg, `mercurial.error` is omitted while printing error. On
other cases it's there in error message.
I did tried to understand what might be the cause was unable to find one on
quick skim through the code.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 23 Jul 2020 17:32:09 +0200] rev 45211
infinitepush: remove unused import to tempfile
Spotted by test-check-pyflakes.t
Martin von Zweigbergk <martinvonz@google.com> [Wed, 22 Jul 2020 00:09:17 -0700] rev 45210
templater: do search for include of unqualified builtin outside of config code
Commit
081b08e4ea13 (templater: look for mapfiles in template paths,
2015-05-15) added support for using things like `%include
map-cmdline.default` to include built-in map files without using a
valid path to them. This patch rewrites that support by moving it into
`_readmapfile()` so it can later be adapted for reading from a
non-file resource.
Differential Revision: https://phab.mercurial-scm.org/D8792
Martin von Zweigbergk <martinvonz@google.com> [Tue, 21 Jul 2020 21:59:12 -0700] rev 45209
templater: switch to lower-level config.parse() in _readmapfile()
I hope to modify this code to also work with resources loaded from
memory (for PyOxidizer support). For that, we'll need to handle the
lookup of relative `%include` path (not joined with the base directory
of the containing file). This patch prepares for that by using
`config.parse()` instead of `config.read()`, since the latter expects
a file in the file system.
As it happens, this change also lets us clean up the `config` class to
not need the `_includepaths` field. That will happen next.
Differential Revision: https://phab.mercurial-scm.org/D8791
Martin von Zweigbergk <martinvonz@google.com> [Tue, 21 Jul 2020 23:50:42 -0700] rev 45208
config: pass both relative and absolute paths to `include` callback
The `include` callback is responsible for loading configs from
`%include` statements. The callback currently gets passed the absolute
path [1] to the config to read. That is created by joining the dirname
of the file that contains the `%include` statement. For PyOxidizer
support, I'm trying to reduce dependence on paths. This patch helps
with that by passing the relative path found in the `%include`
statement (but with username expansion, etc.) to the `include`
callback. It also turns out that the existing callers can easily adapt
to using the relative path. Coming patches will clean that up and then
we'll remove the absolute path from the callback.
[1] The "absolute path" bit is a bit of a lie -- it's going to be an
absolute path if the path that was passed into `config.parse()` was
absolute.
Differential Revision: https://phab.mercurial-scm.org/D8790
Martin von Zweigbergk <martinvonz@google.com> [Wed, 22 Jul 2020 22:38:42 -0700] rev 45207
tests: add test for bad template %include and __base__
It doesn't seem like we had any tests for `%include non-existent` and
`__base__ = non-existent`. The latter raises an error while the former
ignores the include. We should probably also make the former an error.
Differential Revision: https://phab.mercurial-scm.org/D8798
Martin von Zweigbergk <martinvonz@google.com> [Tue, 21 Jul 2020 22:52:22 -0700] rev 45206
tests: add test for unqualified include of a built-in template map
The feature was added in
081b08e4ea13 (templater: look for mapfiles in
template paths, 2015-05-15), but no test case was added.
Differential Revision: https://phab.mercurial-scm.org/D8797
Augie Fackler <augie@google.com> [Wed, 22 Jul 2020 22:09:38 -0400] rev 45205
merge with stable
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 07 Jul 2020 00:18:15 +0200] rev 45204
commitctx: extract _filecommit too
This function is exclusively used in `commitctx`. So we should extract it too
for consistency and to reduce the `localrepo` bloat.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy.
Differential Revision: https://phab.mercurial-scm.org/D8710
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Jul 2020 23:14:52 +0200] rev 45203
commitctx: extract the function in a dedicated module
the function have few callers (< 15) is quite long a mostly independent from the
repository itself. It seems like a good candidate to reduce the bloatness of the
localrepository class. Extracting it will help us cleaning the code up and
splitting it into more reasonable-size function.
We don't use a copy trick because the amount of code extract is quite small
(<5%) and the de-indent means every single line change anyway. So this is not
deemed valuable to do so.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy.
Differential Revision: https://phab.mercurial-scm.org/D8709
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Jul 2020 19:13:19 +0200] rev 45202
commitctx: document a fast path in _filecommit
This block cut off a lot of logic, documenting the why and how seems useful to
future reader.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy. We start with
easy and small cleanup.
Differential Revision: https://phab.mercurial-scm.org/D8700
Martin von Zweigbergk <martinvonz@google.com> [Tue, 21 Jul 2020 13:36:48 -0700] rev 45201
hgweb: simplify now that we always have a single path
Both `templatedir()` and `web.templatepath` are now always a single
path (or None).
Differential Revision: https://phab.mercurial-scm.org/D8788
Martin von Zweigbergk <martinvonz@google.com> [Tue, 21 Jul 2020 13:41:26 -0700] rev 45200
templater: simplify stylemap() now that templatedir() returns a single path
Differential Revision: https://phab.mercurial-scm.org/D8787
Martin von Zweigbergk <martinvonz@google.com> [Tue, 21 Jul 2020 13:11:49 -0700] rev 45199
templater: make templatepaths() return a single path, or None
The function returns either a singleton list or an empty list, so it
makes more sense to return a value or None. The plural in the name
also doesn't make sense, but `templatepath()` is already taken, so I
renamed it to `templatedir()` instead.
Differential Revision: https://phab.mercurial-scm.org/D8786
Martin von Zweigbergk <martinvonz@google.com> [Tue, 21 Jul 2020 13:05:37 -0700] rev 45198
templater: simplify templatepaths() to avoid iterating a singleton list
The function iterates over a hard-coded list of one element since
d844e220792a (templater: don't search randomly for templates - trust
util.datapath, 2014-09-28).
Differential Revision: https://phab.mercurial-scm.org/D8785
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Jul 2020 22:46:49 +0200] rev 45197
commitctx: move a tiny else clause above the very long one
This is simple to have all the simple case unfold before the 100+ line one. Otherwise it is hard to relate the `else` to the initial conditionnal.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy. We start with
easy and small cleanup.
Differential Revision: https://phab.mercurial-scm.org/D8708
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Jul 2020 22:37:53 +0200] rev 45196
commitctx: consider removed as touched
This achieve the same result with clearer code.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy. We start with
easy and small cleanup.
Differential Revision: https://phab.mercurial-scm.org/D8707
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Jul 2020 22:35:34 +0200] rev 45195
commitctx: rename "changed" to touched
The variable contains content that are both added and modified. "changed" could
be confused with "modified" only, so we pick a less ambiguous naming that will
help with more unification.
For example, it would make sense to shove the "removed" item in there since
this is how the variable is used.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy. We start with
easy and small cleanup.
Differential Revision: https://phab.mercurial-scm.org/D8706
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 07 Jul 2020 11:16:28 +0200] rev 45194
commitctx: more filesremoved assignment closer to removed computation
A small change that makes the code flow clearer.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy. We start with
easy and small cleanup.
Differential Revision: https://phab.mercurial-scm.org/D8704
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Jul 2020 20:03:30 +0200] rev 45193
commitctx: compute files added from _filecommit returns
When possible, lets avoid recomputing the same information again.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy. We start with
easy and small cleanup.
Differential Revision: https://phab.mercurial-scm.org/D8703
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 06 Jul 2020 19:35:53 +0200] rev 45192
commitctx: return "touched" status from _filecommit
Instead of mutating a list passed in argument, we simply return the information
from the `_filecommit` function. This make for a cleaner API and allow for
richer information to be returned. That richer information will be used in the
next commit to avoid duplicated computation.
This is part of a larger refactoring/cleanup of the commitctx code to clarify
and augment the logic gathering metadata useful for copy tracing. The current
code is a tad too long and entangled to make such update easy. We start with
easy and small cleanup.
Differential Revision: https://phab.mercurial-scm.org/D8702
Manuel Jacob <me@manueljacob.de> [Tue, 21 Jul 2020 01:04:19 +0200] rev 45191
relnotes: add release notes for relevant changes I did since the 5.4 release
After having written the notes, I realized that the added points contain changes
that were part of the 5.4.2 release. These were never included in any release
notes. I asked on IRC whether they should be added to this file or not, but
didn’t get an answer to this question. If they should not be added here, I can
remove them.
Differential Revision: https://phab.mercurial-scm.org/D8770
Manuel Jacob <me@manueljacob.de> [Mon, 20 Jul 2020 18:04:19 +0200] rev 45190
relnotes: fix indentation
The two points were written by me. For some reason, I missed the fact that the
other points were indented by one space.
Differential Revision: https://phab.mercurial-scm.org/D8769
Manuel Jacob <me@manueljacob.de> [Mon, 20 Jul 2020 17:57:31 +0200] rev 45189
relnotes: make spacing before new section consistent
Differential Revision: https://phab.mercurial-scm.org/D8768
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 22 Jul 2020 14:58:49 +0530] rev 45188
tests: make one of 'worker process exited' line option in test-chg.t
I investigated and it seems like under high load, the child process is already
there and no new fork was created. Hence the process was not closed.
Connor Sheehan <sheehan@mozilla.com> [Wed, 22 Apr 2020 18:08:12 -0400] rev 45187
infinitepush: fix `{get,put}_args` formatting on Python 3
Calling `.format()` on a byte-string does not work, thus
causing an exception on Python 3. This commit adds a function
to paper over the difference.
Differential Revision: https://phab.mercurial-scm.org/D8781