Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
4a4280dd
Commit
4a4280dd
authored
Jan 12, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add command to commit pending changes after some delay (issue #182)
parent
77c25521
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
0 deletions
+90
-0
docs/admin.rst
docs/admin.rst
+3
-0
docs/management.rst
docs/management.rst
+17
-0
weblate/trans/management/commands/commit_pending.py
weblate/trans/management/commands/commit_pending.py
+70
-0
No files found.
docs/admin.rst
View file @
4a4280dd
...
...
@@ -302,6 +302,9 @@ fulfilled:
* translation for a language is completed
* explicit commit is requested
You can also additionally set a cron job to commit pending changes after some
delay, see :djadmin:`commit_pending`.
.. _fulltext:
Fulltext search
...
...
docs/management.rst
View file @
4a4280dd
...
...
@@ -25,6 +25,23 @@ Commits any possible pending changes to backend git repository.
You can either define which project or subproject to update (eg.
``weblate/master``) or use ``--all`` to update all existing subprojects.
commit_pending <project|project/subproject>
-------------------------------------------
.. django-admin:: commit_pending
Commits pending changes older than given age (using ``--age`` parameter,
defaults to 24 hours).
You can either define which project or subproject to update (eg.
``weblate/master``) or use ``--all`` to update all existing subprojects.
This is most useful if executed periodically from cron or similar tool:
.. code-block:: sh
./manage.py commit_pending --all --age=48
cleanuptrans
------------
...
...
weblate/trans/management/commands/commit_pending.py
0 → 100644
View file @
4a4280dd
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2013 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from
weblate.trans.management.commands
import
WeblateCommand
from
django.utils
import
timezone
from
datetime
import
timedelta
from
optparse
import
make_option
class
Command
(
WeblateCommand
):
help
=
'commits pending changes older than given age'
option_list
=
WeblateCommand
.
option_list
+
(
make_option
(
'--age'
,
action
=
'store'
,
type
=
'int'
,
dest
=
'age'
,
default
=
24
,
help
=
'Age of changes to commit in hours (default is 24 hours)'
),
make_option
(
'--lang'
,
action
=
'store'
,
type
=
'string'
,
dest
=
'lang'
,
default
=
None
,
help
=
'Limit only to given languages (comma separated list)'
),
)
def
handle
(
self
,
*
args
,
**
options
):
age
=
timezone
.
now
()
-
timedelta
(
hours
=
options
[
'age'
])
langs
=
None
if
options
[
'lang'
]
is
not
None
:
langs
=
options
[
'lang'
].
split
(
','
)
for
subproject
in
self
.
get_subprojects
(
*
args
,
**
options
):
if
langs
is
None
:
translations
=
subproject
.
translation_set
.
all
()
else
:
translations
=
subproject
.
translation_set
.
filter
(
language_code__in
=
langs
)
for
translation
in
translations
:
if
not
translation
.
git_needs_commit
():
continue
last_change
=
translation
.
get_last_change
()
if
last_change
>
age
:
continue
print
'Committing %s'
%
translation
translation
.
commit_pending
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment