Mercurial > hg
annotate Makefile @ 14451:c78d41db6f88
patch: refactor file creation/removal detection
The patcher has to know if a file is being created or removed to check if the
target already exists, or to actually unlink the file when a hunk emptying it
is applied. This was done by embedding the creation/removal information in the
first (and only) hunk attached to the file.
There are two problems with this approach:
- creation/removal is really a property of the file being patched and not its
hunk.
- for regular patches, file creation cannot be deduced at parsing time: there
are case where the *stripped* file paths must be compared. Modifying hunks
after their creation is clumsy and prevent further refactorings related to
copies handling.
Instead, we delegate this job to selectfile() which has all the relevant
information, and remove the hunk createfile() and rmfile() methods.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 27 May 2011 21:50:09 +0200 |
parents | f6b3b346d80c |
children | 2ce7dfe17bc5 |
rev | line source |
---|---|
10134
821793e3049c
Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents:
10073
diff
changeset
|
1 # If you want to change PREFIX, do not just edit it below. The changed |
821793e3049c
Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents:
10073
diff
changeset
|
2 # value wont get passed on to recursive make calls. You should instead |
821793e3049c
Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents:
10073
diff
changeset
|
3 # override the variable on the command like: |
821793e3049c
Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents:
10073
diff
changeset
|
4 # |
821793e3049c
Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents:
10073
diff
changeset
|
5 # % make PREFIX=/opt/ install |
821793e3049c
Makefile: added instructions on how to override PREFIX
Martin Geisler <mg@lazybytes.net>
parents:
10073
diff
changeset
|
6 |
2233 | 7 PREFIX=/usr/local |
8 export PREFIX | |
1008
85272e96b96a
Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
9 PYTHON=python |
7706
0ae7f0b312ea
use PURE option in Makefile
Martin Geisler <mg@daimi.au.dk>
parents:
7687
diff
changeset
|
10 PURE= |
12816
61c73c9dce1d
Makefile: remove underscore in var name
Martin Geisler <mg@lazybytes.net>
parents:
12806
diff
changeset
|
11 PYFILES:=$(shell find mercurial hgext doc -name '*.py') |
12817
372370923b30
Makefile: var for documentation files
Martin Geisler <mg@lazybytes.net>
parents:
12816
diff
changeset
|
12 DOCFILES=mercurial/help/*.txt |
1008
85272e96b96a
Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
13 |
2244
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
14 help: |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
15 @echo 'Commonly used make targets:' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
16 @echo ' all - build program and documentation' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
17 @echo ' install - install program and man pages to PREFIX ($(PREFIX))' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
18 @echo ' install-home - install with setup.py install --home=HOME ($(HOME))' |
4706
f0aa759b8f93
Makefile: change "make local" to build a fully working local version.
Markus F.X.J. Oberhumer <markus@oberhumer.com>
parents:
3969
diff
changeset
|
19 @echo ' local - build for inplace usage' |
2244
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
20 @echo ' tests - run all tests in the automatic test suite' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
21 @echo ' test-foo - run only specified tests (e.g. test-merge1)' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
22 @echo ' dist - run all tests and create a source tarball in dist/' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
23 @echo ' clean - remove files created by other targets' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
24 @echo ' (except installed files or dist source tarball)' |
7648
02e358a3a8a7
i18n: let Makefile generate i18n/hg.pot
Martin Geisler <mg@daimi.au.dk>
parents:
4707
diff
changeset
|
25 @echo ' update-pot - update i18n/hg.pot' |
2244
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
26 @echo |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
27 @echo 'Example for a system-wide installation under /usr/local:' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
28 @echo ' make all && su -c "make install" && hg version' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
29 @echo |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
30 @echo 'Example for a local installation (usable in this directory):' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
31 @echo ' make local && ./hg version' |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
32 |
76be4e66ddc8
Just using 'make' now shows help. 'make all' doesn't perform inplace build.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2235
diff
changeset
|
33 all: build doc |
2235
457e4247315d
New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2234
diff
changeset
|
34 |
457e4247315d
New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2234
diff
changeset
|
35 local: |
7706
0ae7f0b312ea
use PURE option in Makefile
Martin Geisler <mg@daimi.au.dk>
parents:
7687
diff
changeset
|
36 $(PYTHON) setup.py $(PURE) build_py -c -d . build_ext -i build_mo |
4706
f0aa759b8f93
Makefile: change "make local" to build a fully working local version.
Markus F.X.J. Oberhumer <markus@oberhumer.com>
parents:
3969
diff
changeset
|
37 $(PYTHON) hg version |
1020 | 38 |
2235
457e4247315d
New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2234
diff
changeset
|
39 build: |
7706
0ae7f0b312ea
use PURE option in Makefile
Martin Geisler <mg@daimi.au.dk>
parents:
7687
diff
changeset
|
40 $(PYTHON) setup.py $(PURE) build |
2235
457e4247315d
New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2234
diff
changeset
|
41 |
457e4247315d
New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2234
diff
changeset
|
42 doc: |
457e4247315d
New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2234
diff
changeset
|
43 $(MAKE) -C doc |
1008
85272e96b96a
Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
44 |
85272e96b96a
Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
45 clean: |
8365
94e91205d9b6
Makefile: fix grammar in comment
Greg Ward <greg-hg@gerg.ca>
parents:
8273
diff
changeset
|
46 -$(PYTHON) setup.py clean --all # ignore errors from this command |
12499
596ad02eabe4
Makefile: remove all .so files during clean
Brodie Rao <brodie@bitheap.org>
parents:
11390
diff
changeset
|
47 find . \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';' |
14315
f6b3b346d80c
Makefile: remove pure modules on clean
Martin Geisler <mg@aragost.com>
parents:
14172
diff
changeset
|
48 rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/*.py))) |
13101
37d0fe7a14da
build: don't delete precious version information on 'make clean'
Matt Mackall <mpm@selenic.com>
parents:
12854
diff
changeset
|
49 rm -f MANIFEST tests/*.err |
12500
deeef07c6e7d
Makefile: remove the build folder manually
Brodie Rao <brodie@bitheap.org>
parents:
12499
diff
changeset
|
50 rm -rf build mercurial/locale |
1423 | 51 $(MAKE) -C doc clean |
1008
85272e96b96a
Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
52 |
2527
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
53 install: install-bin install-doc |
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
54 |
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
55 install-bin: build |
10961
ce6d56b95f2e
Respect the DESTDIR variable during 'make install'
Dévai Tamás <devait@vnet.hu>
parents:
10134
diff
changeset
|
56 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force |
2527
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
57 |
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
58 install-doc: doc |
2235
457e4247315d
New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2234
diff
changeset
|
59 cd doc && $(MAKE) $(MFLAGS) install |
457e4247315d
New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2234
diff
changeset
|
60 |
2527
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
61 install-home: install-home-bin install-home-doc |
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
62 |
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
63 install-home-bin: build |
7706
0ae7f0b312ea
use PURE option in Makefile
Martin Geisler <mg@daimi.au.dk>
parents:
7687
diff
changeset
|
64 $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --force |
2527
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
65 |
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
66 install-home-doc: doc |
2235
457e4247315d
New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2234
diff
changeset
|
67 cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install |
457e4247315d
New make targets:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2234
diff
changeset
|
68 |
3872
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3865
diff
changeset
|
69 MANIFEST-doc: |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3865
diff
changeset
|
70 $(MAKE) -C doc MANIFEST |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3865
diff
changeset
|
71 |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3865
diff
changeset
|
72 MANIFEST: MANIFEST-doc |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3865
diff
changeset
|
73 hg manifest > MANIFEST |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3865
diff
changeset
|
74 echo mercurial/__version__.py >> MANIFEST |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3865
diff
changeset
|
75 cat doc/MANIFEST >> MANIFEST |
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3865
diff
changeset
|
76 |
2234
9ea93ff67a73
New make target "dist-notests" to create tarballs without running tests first.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2233
diff
changeset
|
77 dist: tests dist-notests |
9ea93ff67a73
New make target "dist-notests" to create tarballs without running tests first.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2233
diff
changeset
|
78 |
3872
9d7ac8613340
fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3865
diff
changeset
|
79 dist-notests: doc MANIFEST |
3865
36a957364b1b
Make make dist a bit quieter
Matt Mackall <mpm@selenic.com>
parents:
3864
diff
changeset
|
80 TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist |
1008
85272e96b96a
Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
81 |
14172
1a919c3271bf
add make check: tests rule
Johan Euphrosine <proppy@google.com>
parents:
13101
diff
changeset
|
82 check: tests |
1a919c3271bf
add make check: tests rule
Johan Euphrosine <proppy@google.com>
parents:
13101
diff
changeset
|
83 |
1008
85272e96b96a
Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
84 tests: |
3969
edaf68032a27
add possibility to pass flags when testing with the Makefile
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3872
diff
changeset
|
85 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) |
1008
85272e96b96a
Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
86 |
1426
e84c69b43cdb
add a target for running only one test
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1423
diff
changeset
|
87 test-%: |
3969
edaf68032a27
add possibility to pass flags when testing with the Makefile
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3872
diff
changeset
|
88 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@ |
1426
e84c69b43cdb
add a target for running only one test
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1423
diff
changeset
|
89 |
7893
606723f4a327
enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents:
7791
diff
changeset
|
90 update-pot: i18n/hg.pot |
606723f4a327
enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents:
7791
diff
changeset
|
91 |
12817
372370923b30
Makefile: var for documentation files
Martin Geisler <mg@lazybytes.net>
parents:
12816
diff
changeset
|
92 i18n/hg.pot: $(PYFILES) $(DOCFILES) |
8542
de150a942ec8
i18n: accurately generate hg.pot
Martin Geisler <mg@lazybytes.net>
parents:
8365
diff
changeset
|
93 $(PYTHON) i18n/hggettext mercurial/commands.py \ |
12854
5d3f3d577218
i18n: extract docstrings from revset module
Wagner Bruna <wbruna@yahoo.com>
parents:
12817
diff
changeset
|
94 hgext/*.py hgext/*/__init__.py mercurial/revset.py \ |
5d3f3d577218
i18n: extract docstrings from revset module
Wagner Bruna <wbruna@yahoo.com>
parents:
12817
diff
changeset
|
95 $(DOCFILES) > i18n/hg.pot |
7710
88326ee85a1b
i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents:
7706
diff
changeset
|
96 # All strings marked for translation in Mercurial contain |
88326ee85a1b
i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents:
7706
diff
changeset
|
97 # ASCII characters only. But some files contain string |
88326ee85a1b
i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents:
7706
diff
changeset
|
98 # literals like this '\037\213'. xgettext thinks it has to |
8273 | 99 # parse them even though they are not marked for translation. |
100 # Extracting with an explicit encoding of ISO-8859-1 will make | |
101 # xgettext "parse" and ignore them. | |
12816
61c73c9dce1d
Makefile: remove underscore in var name
Martin Geisler <mg@lazybytes.net>
parents:
12806
diff
changeset
|
102 echo $(PYFILES) | xargs \ |
9278
3d9f77c03105
Makefile: remove non-default wrapping of hg.pot strings
Martin Geisler <mg@lazybytes.net>
parents:
9079
diff
changeset
|
103 xgettext --package-name "Mercurial" \ |
8272
79983cfa7efe
Makefile: add more meta data to hg.pot
Martin Geisler <mg@lazybytes.net>
parents:
7893
diff
changeset
|
104 --msgid-bugs-address "<mercurial-devel@selenic.com>" \ |
79983cfa7efe
Makefile: add more meta data to hg.pot
Martin Geisler <mg@lazybytes.net>
parents:
7893
diff
changeset
|
105 --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \ |
12806
57b9fd75b6f8
i18n: extract comments marked for translator hints
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
12500
diff
changeset
|
106 --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \ |
7710
88326ee85a1b
i18n: extract strings with xgettext
Martin Geisler <mg@daimi.au.dk>
parents:
7706
diff
changeset
|
107 -d hg -p i18n -o hg.pot |
11390
11cd65611f3f
i18n: translate each paragraph separately
Wagner Bruna <wbruna@yahoo.com>
parents:
10961
diff
changeset
|
108 $(PYTHON) i18n/posplit i18n/hg.pot |
1008
85272e96b96a
Add Makefile for generating release tarballs.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
109 |
7893
606723f4a327
enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents:
7791
diff
changeset
|
110 %.po: i18n/hg.pot |
606723f4a327
enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents:
7791
diff
changeset
|
111 msgmerge --no-location --update $@ $^ |
606723f4a327
enhance Makefile for language translators
Tobias Bell <tobias.bell@gmail.com>
parents:
7791
diff
changeset
|
112 |
2527
c51fad25e59e
Split installation targets into install-bin and install-doc.
Sascha Wilde <wilde@sha-bang.de>
parents:
2244
diff
changeset
|
113 .PHONY: help all local build doc clean install install-bin install-doc \ |
7648
02e358a3a8a7
i18n: let Makefile generate i18n/hg.pot
Martin Geisler <mg@daimi.au.dk>
parents:
4707
diff
changeset
|
114 install-home install-home-bin install-home-doc dist dist-notests tests \ |
02e358a3a8a7
i18n: let Makefile generate i18n/hg.pot
Martin Geisler <mg@daimi.au.dk>
parents:
4707
diff
changeset
|
115 update-pot |