Martin von Zweigbergk <martinvonz@google.com> [Mon, 03 Aug 2020 23:38:50 -0700] rev 45399
hgweb: ignore web.templates config when guessing mime type for static content
Frozen binaries won't have a file-system path for static content, so
I'd like to remove dependence on that. From the documentation, it
seems like `mimetypes.guess_type()` only cares about the suffix, so I
think it should be enough to pass in just path under the
`web.templates` directory.
Differential Revision: https://phab.mercurial-scm.org/D8935
Martin von Zweigbergk <martinvonz@google.com> [Sat, 22 Aug 2020 16:03:44 -0700] rev 45398
hgweb: let staticfile() look up path from default location unless provided
This reduces duplication between the two callers.
Differential Revision: https://phab.mercurial-scm.org/D8934
Martin von Zweigbergk <martinvonz@google.com> [Mon, 03 Aug 2020 22:40:05 -0700] rev 45397
hgweb: handle None from templatedir() equally bad in webcommands.py
The following paragraph is based just on my reading of the code; I
have not tried to test it.
Before my recent work on templates in frozen binaries, it seems both
`hgwebdir_mod.py` and `webcommands.py` would pass in an empty list
into `staticfile()` when running in a frozen binary. That would then
result in a variable in that function (`path`) not getting bound
before its first use. I then changed that without thinking in D8786 so
we passed a `None` value into the function, which made it break in
another way (trying to iterate over `None`). Then I tried to fix it up
in D8810, but I only changed `hgwebdir_mod.py` for some reason, and it
still doesn't actually work in frozen binaries (which seems fair,
since was broken before my changes too).
This patch just replicates the half-assed "fix" from D8810 in
`webcommands.py`, so they look more similar so I can start refactoring
them in the same way.
Differential Revision: https://phab.mercurial-scm.org/D8933
Martin von Zweigbergk <martinvonz@google.com> [Thu, 13 Aug 2020 10:37:25 -0700] rev 45396
posixworker: avoid creating workers that end up getting no work
If `workers` (the detected or configured number of CPUs) is greater
than the number of work items, then some of the workers end up getting
0 work items. Let's not create such workers.
Differential Revision: https://phab.mercurial-scm.org/D8927
Martin von Zweigbergk <martinvonz@google.com> [Mon, 10 Aug 2020 21:46:47 -0700] rev 45395
revert: remove dangerous `parents` argument from `cmdutil.revert()`
As we found out the hard way (thanks to spectral@ for figuring it
out!), `cmdutil.revert()`'s `parents` argument must be
`repo.dirstate.parents()` or things may go wrong. We had an extension
that passed in the target commit as the first parent. The `hg split`
command from the evolve extension seems to have made the same mistake,
but I haven't looked carefully.
The problem is that `cmdutil._performrevert()` calls
`dirstate.normal()` on reverted files if the commit to revert to
equals the first parent. So if you pass in `ctx=foo` and
`parents=(foo.node(), nullid)`, then `dirstate.normal()` will be
called for the revert files, even though they might not be clean in
the working copy.
There doesn't seem to be any reason, other than a tiny performance
benefit, to passing the `parents` around instead of looking them up
again in `cmdutil._performrevert()`, so that's what this patch does.
Differential Revision: https://phab.mercurial-scm.org/D8925
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 10 Aug 2020 18:08:15 -0700] rev 45394
requirements: introduce a set of working directory specific requirements
Some requirements like the SPARSE_REQUIREMENT is working directory specific and
cannot be shared. We add a set which will contain all these requirements.
This is not the best we can do, I think having a rich requirement class will be
much better but that will be out of scope for this series.
Differential Revision: https://phab.mercurial-scm.org/D8924
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 08 Aug 2020 16:37:59 +0530] rev 45393
localrepo: move requirements constant to requirements module
We now have a dedicated module for requirements constant, let's move the ones in
localrepo there.
Differential Revision: https://phab.mercurial-scm.org/D8918
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 08 Aug 2020 16:24:12 +0530] rev 45392
requirements: introduce new requirements related module
It was not clear where all requirements should and related APIs should be, this
patch introduces a requirements module which will have all exitsing requirements
and related APIs.
Differential Revision: https://phab.mercurial-scm.org/D8917