@@ -69,20 +69,25 @@ build: setup po-install
69
69
2> >( tee -a $( LOGS_DIR) /build/err-$( NOW) .txt >&2 )
70
70
71
71
72
- # push: Push changed translation files and Transifex config file to repository .
73
- # First it git-adds tracked file whose changes are not limited to the
74
- # POT-Creation-Date header field. Then it git-adds untracked PO files
72
+ # push: Commit and push translation files and Transifex config file to repo .
73
+ # First it git-adds tracked file that doesn't exclusively match changes
74
+ # in POT-Creation-Date header field. Then it git-adds untracked PO files
75
75
# that might have been created in the update process, and the Transifex
76
- # configuration. If no file changed, it does nothing.
77
- # The MSG variable has a default commit message, but one can overrride it
76
+ # configuration. Finally, only commit and push only if any file was
77
+ # git-added (staged); otherwise, it does nothing.
78
+ # The MSG variable has a default commit message, but one can override it
78
79
# e.g. make push MSG='my message'
79
80
push : MSG := 'Update translations from Transifex'
80
81
push :
81
82
@git diff -I' ^"POT-Creation-Date: ' --numstat * .po ** /* .po \
82
83
| cut -f3 | xargs -r git add
83
84
@git add $(git ls-files -o --exclude-standard *.po **/*.po ) .tx/config
84
- @git diff-index --quiet HEAD || git commit --allow-empty -m $(MSG )
85
- @git push
85
+ @if [[ $( git diff --name-only --cached) != " " ]]; then
86
+ git commit -m $(MSG )
87
+ git push
88
+ else
89
+ echo ' Nothing to commit'
90
+ fi
86
91
87
92
88
93
# pull: Download translations files from Transifex, and apply line wrapping.
@@ -223,13 +228,14 @@ $(LOGS_DIR)/pospell-$(NOW)/all.txt:
223
228
@cut -d: -f3- $(DESTS ) | sort -u > $@
224
229
225
230
226
- # merge: merge translations from BRANCH (Python version currently aim of
231
+ # merge: Merge translations from BRANCH (Python version currently aim of
227
232
# translation) into each branch listed by BUGFIXBRANCH and
228
233
# OLDERBRANCHES (branches of older Python versions) so that older
229
- # versions of the Python Docs make at least some use the latest
230
- # translations, if possible. OLDERBRANCHES has '--no-overwrite'
231
- # flag so it does not overwrite translated strings, preserving history.
232
- # After merging, git-push merged files (if any) to the target branch.
234
+ # versions of the Python Docs try make at least some use of the latest
235
+ # translations. OLDERBRANCHES has '--no-overwrite' flag so it does not
236
+ # overwrite translated strings, preserving history.
237
+ # After merging, only commit and push only if any file was git-added
238
+ # (staged) to the target branch; otherwise, it does nothing.
233
239
merge : venv $(BUGFIXBRANCH ) $(OLDERBRANCHES )
234
240
235
241
$(OLDERBRANCHES ) : OVERWRITEFLAG = --no-overwrite
@@ -242,12 +248,18 @@ $(BUGFIXBRANCH) $(OLDERBRANCHES):
242
248
git checkout $@ ; \
243
249
$(VENV_DIR ) /bin/pomerge $(OVERWRITEFLAG ) --to-files * .po ** /* .po; \
244
250
$(VENV_DIR ) /bin/powrap --modified * .po ** /* .po; \
245
- $(MAKE ) push MSG=" Merge $( BRANCH) branch into $@ " ; \
251
+ git add -u; \
252
+ if [[ $( git diff --name-only --cached) != " " ]]; then \
253
+ git commit -m $(MSG ) ; \
254
+ git push; \
255
+ else \
256
+ echo ' Nothing to commit' ; \
257
+ fi ; \
246
258
git checkout $(BRANCH ) ; \
247
259
fi
248
260
249
261
250
- # lint: Report reStrutcturedText syntax errors in the translation files
262
+ # lint: Report reStructuredText syntax errors in the translation files
251
263
lint : venv
252
264
@mkdir -p " $( LOGS_DIR) "
253
265
@$(VENV_DIR ) /bin/sphinx-lint * .po ** /* .po | & \
0 commit comments