hgweb: move entry-preparing code from webcommands to webutils.commonentry()
The new function is used to fill basic information about a ctx, such as
revision number and hash, author, commit message, etc. Before, every webcommand
used to get this basic information on its own using some boilerplate code, and
some things in some places just weren't available.
grammar: favor zero, one, two over ... or no
commit: make commit acquire store lock before processing for consistency
If acquisition of wlock waits for another "hg commit" process to
release it, dirstate will refer newly committed revision after
acquisition of wlock.
At that time, '00changelog.i' on the filesystem contains this new
revision, but in-memory 'repo.changelog' doesn't, if it is cached
without store lock (slock) before updating by another "hg commit".
This makes validating parents at re-loading 'repo.dirstate' from
'.hg/dirstate' replace such new revision with 'nullid'. Then,
'localrepository.commit()' creates "orphan" revision (see
issue4368
for detail).
a01d3d32b53a makes 'commands.commit()' acquire both wlock and slock
before processing to avoid this issue at "hg commit".
But similar issue can occur even after
a01d3d32b53a, if 3rd party
extension does:
- refer 'repo.changelog' outside wlock scope, and
- invoke 'repo.commit()' directly (instead of 'commands.commit()')
This patch makes 'commit()' acquire slock before processing, to refer
recent changelog at validating parents of 'repo.dirstate'.
censor: make censor acquire locks before processing
Before this patch, "hg censor" executes below:
- without acquisition of wlock, examine whether the working
directory refers the revision of the file to be censored or not
- without acquisition of store lock (slock), replace existing
filelog of file to be censored with censored one,
Replacement consists of steps below, and it is assumed that the
destination filelog at (1) isn't changed before renaming at (3).
1. read existing filelog in
2. write filelog entries (both censored and not) into temporary file
3. rename from temporary file to existing filelog to be censored
It may cause unintentional result, if another command runs parallelly
(see also
issue4368).
This patch makes "hg censor" acquire wlock and slock before
processing.
transplant: widen wlock scope of transplant for consitency while processing
Before this patch, "hg transplant" executes below before acquisition
of wlock.
- cmdutil.checkunfinished()
- repo.status() for dirty check
- repo.dirstate.parents()
It may cause unintentional result, if another command runs parallelly
(see also
issue4368).
This patch makes "hg transplant" acquire wlock before processing
instead of acquiring wlock in each of 'transplanter.apply()' and
'transplanter.recover()'.
shelve: remove redundant acquisition of wlock for sub commands of unshelve
Previous patch ensures that wlock is acquired before processing for
"hg unshelve". It makes acquisition of wlock in each functions below
redundant.
- unshelveabort() for "unshelve --abort"
- unshelvecontinue() for "unshelve --continue"
shelve: widen wlock scope of unshelve for consistency while processing
Before this patch, "hg unshelve" of shelve extension executes below
before acquisition of wlock:
- cmdutil.checkunfinished()
- examine existence of (specified) shelve file
It may cause unintentional result, if another command runs parallelly
(see also
issue4368).
This patch widens wlock scope of "hg unshelve" of shelve extension for
consistency while processing.
perf: add perflrucachedict command
It measures time to construct, perform gets, sets, or mixed mode
operations on a cache of configurable size with variable numbers of
operations.