Pulkit Goyal <7895pulkit@gmail.com> [Mon, 10 Aug 2020 15:29:02 +0530] rev 45382
mergestate: use _stateextras instead of merge records for commit related info
There is a set of information related to a merge which is needed on commit. We
want to store such information in the mergestate so that we can read it while
committing.
For this purpose, we are using merge records and introduced a merge
entry state for that. However this won't scale and is not clean way to implement
this.
This patch reworks the existing logic related to this to use _stateextras and
read from it.
Right now the information stored is not very descriptive but it will be in next
patch.
Using _stateextras also makes MERGE_RECORD_MERGED_OTHER useless and only to be
kept for BC.
Differential Revision: https://phab.mercurial-scm.org/D8920
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 10 Aug 2020 15:09:44 +0530] rev 45381
mergestate: use collections.defaultdict(dict) for _stateextras
I want to use this _stateextras more in upcoming patches to store some commit
time related information. Using defaultdict will help in cleaner code around
checking whether a file exists or not.
Differential Revision: https://phab.mercurial-scm.org/D8919
Martin von Zweigbergk <martinvonz@google.com> [Mon, 03 Aug 2020 23:41:50 -0700] rev 45380
hgweb: minimize scope of a try-block in staticfile()
I think the exceptions are only relevant for the `os.stat()` and
`open()` calls, and maybe to the `fh.read()` call.
Differential Revision: https://phab.mercurial-scm.org/D8936
Martin von Zweigbergk <martinvonz@google.com> [Mon, 03 Aug 2020 23:38:50 -0700] rev 45379
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 45378
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 45377
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