Makefile
author Pulkit Goyal <7895pulkit@gmail.com>
Wed, 13 Jun 2018 17:15:10 +0530
changeset 3846 f9dad99a90d5
parent 2270 b53343c8d692
permissions -rw-r--r--
evolve: create a new commit instead of amending one of the divergents This patch changes the behavior of evolve command while resolving content-divergence to create a new commit instead of amending one of the divergent ones. In past, I have made this change, backed out this change and now today again I am doing this change, so let's dive in some history. Using cmdrewrite.amend() was never a good option as that requires hack to delete the evolvestate and also gives us less control over things. We can't make the commit on top of different parents as that of content-divergent ones. Due to all these, I first made this change to create a new commit instead of amending one. But, after few days, there was flakiness observed in the tests and turned out that we need to do some dirstate dance as repo.dirstate.setparents() does not always fix the dirstate. That flakiness was a blocker for progress at that time and we decided to switch to amend back so that we can have things working with some hacks and we can later fix the implementation part. Now, yesterday while tackling resolving content-divergence of a stack which is as follows: C1 C2 | | B1 B2 | | A1 A2 \/ base where, A1-A2, B1-B2, C1-C2 are content-divergent with each other. Now we can resolve A1-A2 very well because they have the same parent and let's say that resolution leads to A3. Now, we want to resolve B1-B2 and make the new resolution commit on top of A3 so that we can end up something like: C3 | B3 | A3 | base however, amending one of the divergent changesets, it's not possible to create a commit on a different parent like A3 here without some relocation. We should prevent relocation as that may leads to some conflicts and should change the parent before committing. So, looking ahead, we can't move with using amend as still using that we will need some relocation hacks making code ugly and prone to bad behaviors, bugs. Let's change back to creating a new commit so that we can move forward in a good way. About repo.dirstate.setparents() not setting the dirstate, I have researched yesterday night about how we can do that and found out that we can use cmdrewrite._uncommitdirstate() here. Expect upcoming patches to improve the documentation of that function. There are lot of test changes because of change in hash but there is no behavior change. The only behavior change is in test-evolve-abort-contentdiv.t which is nice because creating a new commit helps us in stripping that while aborting. We have a lot of testing of content-divergence and no behavior change gives enough confidence for making this change. I reviewed the patch carefully to make sure there is no behavior change and I suggest reviewer to do the same.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
542
ca5bb72d14ae pkg: abstract version in makefile
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 531
diff changeset
     1
VERSION=$(shell python setup.py --version)
ca5bb72d14ae pkg: abstract version in makefile
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 531
diff changeset
     2
2039
103da16f3be2 makefile: only check for HGROOT when running tests
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2020
diff changeset
     3
PYTHON=python
0
bbeef801409c minimalistic state concept.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     4
bbeef801409c minimalistic state concept.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     5
all: help
bbeef801409c minimalistic state concept.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     6
531
b18b00036355 pkg/debian: Debian packaging
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 0
diff changeset
     7
deb-prepare:
b18b00036355 pkg/debian: Debian packaging
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 0
diff changeset
     8
	python setup.py sdist --dist-dir ..
542
ca5bb72d14ae pkg: abstract version in makefile
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 531
diff changeset
     9
	mv -f ../hg-evolve-$(VERSION).tar.gz ../mercurial-evolve_$(VERSION).orig.tar.gz
ca5bb72d14ae pkg: abstract version in makefile
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 531
diff changeset
    10
	tar xf ../mercurial-evolve_$(VERSION).orig.tar.gz
ca5bb72d14ae pkg: abstract version in makefile
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 531
diff changeset
    11
	rm -rf ../mercurial-evolve_$(VERSION).orig
ca5bb72d14ae pkg: abstract version in makefile
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 531
diff changeset
    12
	mv hg-evolve-$(VERSION) ../mercurial-evolve_$(VERSION).orig
ca5bb72d14ae pkg: abstract version in makefile
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 531
diff changeset
    13
	cp -r debian/ ../mercurial-evolve_$(VERSION).orig/
ca5bb72d14ae pkg: abstract version in makefile
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 531
diff changeset
    14
	@cd ../mercurial-evolve_$(VERSION).orig && echo 'debian build directory ready at' `pwd`
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1769 1893
diff changeset
    15
2040
934d70e3be97 makefile: add an 'install-home' target
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2039
diff changeset
    16
install-home:
934d70e3be97 makefile: add an 'install-home' target
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2039
diff changeset
    17
	$(PYTHON) setup.py install --home="$(HOME)" --prefix="" --force
934d70e3be97 makefile: add an 'install-home' target
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2039
diff changeset
    18
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1769 1893
diff changeset
    19
# test targets
1879
bd5c2922a8ad Makefile: rework running of tests
Augie Fackler <raf@durin42.com>
parents: 1839
diff changeset
    20
TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
bd5c2922a8ad Makefile: rework running of tests
Augie Fackler <raf@durin42.com>
parents: 1839
diff changeset
    21
bd5c2922a8ad Makefile: rework running of tests
Augie Fackler <raf@durin42.com>
parents: 1839
diff changeset
    22
HGTESTS=$(HGROOT)/tests
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    23
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    24
help:
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    25
	@echo 'Commonly used make targets:'
2270
b53343c8d692 make: merge recipes for help
Yuya Nishihara <yuya@tcha.org>
parents: 2269
diff changeset
    26
	@echo '  deb-prepare        - prepare the build of a debian package'
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    27
	@echo '  tests              - run all tests in the automatic test suite'
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    28
	@echo '  all-version-tests - run all tests against many hg versions'
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    29
	@echo '  tests-%s           - run all tests in the specified hg version'
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    30
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    31
all: help
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    32
2039
103da16f3be2 makefile: only check for HGROOT when running tests
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2020
diff changeset
    33
_check_hgroot:
2269
b838c069bf4e make: fix indent of ifeq-endif
Yuya Nishihara <yuya@tcha.org>
parents: 2040
diff changeset
    34
ifeq ($(HGROOT),)
b838c069bf4e make: fix indent of ifeq-endif
Yuya Nishihara <yuya@tcha.org>
parents: 2040
diff changeset
    35
	$(error HGROOT is not set to the root of the hg source tree)
b838c069bf4e make: fix indent of ifeq-endif
Yuya Nishihara <yuya@tcha.org>
parents: 2040
diff changeset
    36
endif
2039
103da16f3be2 makefile: only check for HGROOT when running tests
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2020
diff changeset
    37
103da16f3be2 makefile: only check for HGROOT when running tests
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2020
diff changeset
    38
tests: _check_hgroot
1879
bd5c2922a8ad Makefile: rework running of tests
Augie Fackler <raf@durin42.com>
parents: 1839
diff changeset
    39
	cd tests && $(PYTHON) $(HGTESTS)/run-tests.py $(TESTFLAGS)
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    40
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1769 1893
diff changeset
    41
# /!\ run outside of the compatibility branch output test will likely fails
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1769 1893
diff changeset
    42
2039
103da16f3be2 makefile: only check for HGROOT when running tests
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2020
diff changeset
    43
test-%: _check_hgroot
1879
bd5c2922a8ad Makefile: rework running of tests
Augie Fackler <raf@durin42.com>
parents: 1839
diff changeset
    44
	cd tests && $(PYTHON) $(HGTESTS)/run-tests.py $(TESTFLAGS) $@
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    45
2039
103da16f3be2 makefile: only check for HGROOT when running tests
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2020
diff changeset
    46
tests-%: _check_hgroot
1879
bd5c2922a8ad Makefile: rework running of tests
Augie Fackler <raf@durin42.com>
parents: 1839
diff changeset
    47
	hg -R $(HGROOT) checkout $$(echo $@ | sed s/tests-//) && \
bd5c2922a8ad Makefile: rework running of tests
Augie Fackler <raf@durin42.com>
parents: 1839
diff changeset
    48
	(cd $(HGROOT) ; $(MAKE) clean ) && \
bd5c2922a8ad Makefile: rework running of tests
Augie Fackler <raf@durin42.com>
parents: 1839
diff changeset
    49
	cd tests && $(PYTHON) $(HGTESTS)/run-tests.py $(TESTFLAGS)
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    50
2020
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1769 1893
diff changeset
    51
# build a script to extract declared version
143c8e4dc22d topic: merge the topic extension in the evolve repository
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1769 1893
diff changeset
    52
all-version-tests: tests-@
1839
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    53
1bc5e62fc0c7 Initial dumb version of topics.
Augie Fackler <augie@google.com>
parents:
diff changeset
    54
.PHONY: tests all-version-tests