amend: query the wdir parent after taking lock (issue5266)
If we query wdir parent without taking a lock, that can lead to bugs because the
wdir parent can change is another process has changed the wdir parent.
One such example of this was issue 5266. When a user is running amend and that
amend is waiting for commit message, the user runs another amend which waits for
lock. The second amend is waiting for lock, but has already read the description
from the parent of working directory to use. Once the first amend completes the
wdir parent changes but we still have the description from an old wdir parent.
This patch fixes the bug by querying the description after taking lock.
Attempts were made to add test for this but the results were unstable because
they depend on time in which lock is released.
VERSION=$(shell python setup.py --version)
PYTHON=python
all: help
deb-prepare:
python setup.py sdist --dist-dir ..
mv -f ../hg-evolve-$(VERSION).tar.gz ../mercurial-evolve_$(VERSION).orig.tar.gz
tar xf ../mercurial-evolve_$(VERSION).orig.tar.gz
rm -rf ../mercurial-evolve_$(VERSION).orig
mv hg-evolve-$(VERSION) ../mercurial-evolve_$(VERSION).orig
cp -r debian/ ../mercurial-evolve_$(VERSION).orig/
@cd ../mercurial-evolve_$(VERSION).orig && echo 'debian build directory ready at' `pwd`
install-home:
$(PYTHON) setup.py install --home="$(HOME)" --prefix="" --force
# test targets
TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
HGTESTS=$(HGROOT)/tests
help:
@echo 'Commonly used make targets:'
@echo ' deb-prepare - prepare the build of a debian package'
@echo ' tests - run all tests in the automatic test suite'
@echo ' all-version-tests - run all tests against many hg versions'
@echo ' tests-%s - run all tests in the specified hg version'
all: help
_check_hgroot:
ifeq ($(HGROOT),)
$(error HGROOT is not set to the root of the hg source tree)
endif
tests: _check_hgroot
cd tests && $(PYTHON) $(HGTESTS)/run-tests.py $(TESTFLAGS)
# /!\ run outside of the compatibility branch output test will likely fails
test-%: _check_hgroot
cd tests && $(PYTHON) $(HGTESTS)/run-tests.py $(TESTFLAGS) $@
tests-%: _check_hgroot
hg -R $(HGROOT) checkout $$(echo $@ | sed s/tests-//) && \
(cd $(HGROOT) ; $(MAKE) clean ) && \
cd tests && $(PYTHON) $(HGTESTS)/run-tests.py $(TESTFLAGS)
# build a script to extract declared version
all-version-tests: tests-@
.PHONY: tests all-version-tests