[PATCH] Makefile: intermediate steps work with temporary copy of hg.pot

Simon Heimberg simohe at besonet.ch
Tue Nov 5 02:27:44 CST 2013


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1383639939 -3600
#      Tue Nov 05 09:25:39 2013 +0100
# Branch stable
# Node ID 2b8d5d7a0cce24e8c1624f547d1b8aead1de3bf6
# Parent  2e096bfe9691bc594c925e19bf4f0c5d195b79dc
Makefile: intermediate steps work with temporary copy of hg.pot

In case of abortion or a failing step, the target file remains untouched
instead of being in an intermediate state.

diff -r 2e096bfe9691 -r 2b8d5d7a0cce Makefile
--- a/Makefile	Tue Nov 05 09:00:31 2013 +0100
+++ b/Makefile	Tue Nov 05 09:25:39 2013 +0100
@@ -107,7 +107,7 @@
 	  mercurial/fileset.py mercurial/revset.py \
 	  mercurial/templatefilters.py mercurial/templatekw.py \
 	  mercurial/filemerge.py \
-	  $(DOCFILES) > i18n/hg.pot
+	  $(DOCFILES) > i18n/hg.pot~
         # All strings marked for translation in Mercurial contain
         # ASCII characters only. But some files contain string
         # literals like this '\037\213'. xgettext thinks it has to
@@ -119,8 +119,11 @@
 	  --msgid-bugs-address "<mercurial-devel at selenic.com>" \
 	  --copyright-holder "Matt Mackall <mpm at selenic.com> and others" \
 	  --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
-	  -d hg -p i18n -o hg.pot
-	$(PYTHON) i18n/posplit i18n/hg.pot
+	  -d hg -p i18n -o hg.pot~
+	$(PYTHON) i18n/posplit i18n/hg.pot~
+       # The target file is not created before the last step. So it never is in
+       # an intermediate state.
+	mv -f i18n/hg.pot~ i18n/hg.pot
 
 %.po: i18n/hg.pot
 	msgmerge --no-location --update $@ $^


More information about the Mercurial-devel mailing list