[svnbook commit] r2402 - trunk/src/ru
dmitriy
noreply at red-bean.com
Sun Sep 3 09:24:24 CDT 2006
Author: dmitriy
Date: Sun Sep 3 09:24:24 2006
New Revision: 2402
Modified:
trunk/src/ru/TRANSLATION-STATUS
trunk/src/ru/sync.py
Log:
* ru/sync.py: New function for the automatical updating ...
ru/TRANSLATION-STATUS: ... this file
Modified: trunk/src/ru/TRANSLATION-STATUS
==============================================================================
--- trunk/src/ru/TRANSLATION-STATUS (original)
+++ trunk/src/ru/TRANSLATION-STATUS Sun Sep 3 09:24:24 2006
@@ -1,65 +1,96 @@
-
Status file for the Russian translation of the Subversion
documentation.
-Status of translation for each file is stored in svn-property 'status'.
-For looking or changing this status use corresponding svn commands.
-For example:
-
- svn propget status book/ch00.xml
+Translation status
-0. Urgent needs
-
- book/ch00.xml:
- - Finish translation of svn.preface.acks, somewhat depends on
- ru/ProperNames.
-
-1. Synchronisation history against the English version
+ Needs update
- The revision number for the last synchronisation is stored in
- svn-property 'last-sync', for each file separately.
+ These files have been "Finished" before, but recent changes are not
+ yet translated.
-2. Possible values of property 'status':
+ * [none]
Finished
These files have been translated, edited, proofread and are in
sync with 'last-sync' revision number.
- Needs update
+ * book.xml
+ * foreword.xml
- These files have been "Finished" before, but recent changes are not
- yet translated.
Translation in progress
These files are partially translated and work is continued by the
specified commiter, or they are in process of being updated.
+ * ch06.xml, 13%
+ * ch07.xml, 32%
+ * ch09.xml, 22%
+
+
Forsaken
These files are partially translated and wait for someone
interested enough to continue.
+ * ch00.xml
+
+
Not translated
These files have never been translated.
+ * appa.xml
+ * appb.xml
+ * appc.xml
+ * ch05.xml
+ * ch08.xml
+ * copyright.xml
+
+
Ready for editing
These files are ready for editing, translation work is finished on
them for now.
+ * ch02.xml
+ * ch03.xml
+ * ch04.xml
+
+
Editing in progress
These files are being proofread and edited now.
-3. Technical errors
+ * ch01.xml
+
+
+ Technical errors
- The following files have markup problems, screaming for attention.
+ The following files have markup problems, screaming for attention.
- [none yet]
+ * [none]
+
+
+Status of translation for each file is stored in svn-property 'status'.
+For looking or changing this status use corresponding svn commands.
+For example:
+
+ svn propget status book/ch00.xml
+
+Synchronisation history against the English version
+
+ The revision number for the last synchronisation is stored in
+ svn-property 'last-sync', for each file separately.
+
+Urgent needs
+
+ book/ch00.xml:
+ - Finish translation of svn.preface.acks, somewhat depends on
+ ru/ProperNames.
$Id$
vim: set tw=72 nowrap et sw=2 ts=2 sts=2 fo+=2w fenc=utf8 :
+
Modified: trunk/src/ru/sync.py
==============================================================================
--- trunk/src/ru/sync.py (original)
+++ trunk/src/ru/sync.py Sun Sep 3 09:24:24 2006
@@ -15,8 +15,9 @@
Options:
-a: Synchronizing all files
- -f: File which needs to be synchronized
+ -f: File(s) which needs to be synchronized
-l: List all files and revisions with which they are sinchronized
+ -u: Update TRANSLATION-STATUS file
--dry-run: Execute a command, but don't make actual changes
""" % (os.path.basename(sys.argv[0])))
@@ -46,7 +47,7 @@
rlist.append(rev)
return max(rlist)
-def get_status(fname):
+def get_percent(fname):
f = file(fname)
ru = 0.0
en = 0.001
@@ -65,7 +66,7 @@
in_para = False
if re.search('@ *ENGLISH \}\}\} -->$', line):
in_tr = False
- return "(%3.2f%%)" % ((ru / en) * 100)
+ return '%i%%' % ((ru / en) * 100)
def get_list():
import platform
@@ -82,14 +83,55 @@
rdelta2 = rbase - ((rbase - rmin) / 3)
for f, r in frlist:
if platform.system() == 'Windows':
- print f, '\t', r, '\t', get_status(f)
+ sys.stdout.write(f+'\t'+str(r)+'\t'+get_percent(f)+'\t'+get_status(f))
else:
if r in range(rdelta2, rbase):
- print '\x1b[32m', f, '\t', r, '\t', get_status(f), '\x1b[0m'
+ sys.stdout.write('\x1b[32m'+f+'\t'+str(r)+'\t'+get_percent(f)+
+ '\t'+get_status(f)+'\x1b[0m')
elif r in range(rdelta1, rdelta2):
- print '\x1b[33m', f, '\t', r, '\t', get_status(f), '\x1b[0m'
+ sys.stdout.write('\x1b[33m'+f+'\t'+str(r)+'\t'+get_percent(f)+
+ '\t'+get_status(f)+'\x1b[0m')
elif r in range(rmin, rdelta1):
- print '\x1b[31m', f, '\t', r, '\t', get_status(f), '\x1b[0m'
+ sys.stdout.write('\x1b[31m'+f+'\t'+str(r)+'\t'+get_percent(f)+
+ '\t'+get_status(f)+'\x1b[0m')
+ print
+
+def get_status(fname):
+ return os.popen('svn propget status '+fname).readline()
+
+def update_status_file():
+ global bfiles
+ st_f = file('../TRANSLATION-STATUS')
+ tmp_st_f = file('../TRANSLATION-STATUS.tmp', 'w')
+ curr_sta = ''
+ in_sta = False
+ indention = ' '
+ for line in st_f:
+ if in_sta:
+ if re.match(' {8}\*', line):
+ fcount = 0
+ for f in bfiles:
+ if re.match(curr_sta, get_status(f)):
+ if curr_sta == 'Transl':
+ tmp_st_f.write(indention+'* '+f+', '+get_percent(f)+'\n')
+ else:
+ tmp_st_f.write(indention+'* '+f+'\n')
+ fcount += 1
+ if fcount == 0:
+ tmp_st_f.write(indention+'* [none]\n')
+ in_sta = False
+ else:
+ tmp_st_f.write(line)
+ else:
+ if re.match(' {2}\w', line):
+ in_sta = True
+ curr_sta = line[2:8]
+ if not re.match(' {8}\*', line):
+ tmp_st_f.write(line)
+ tmp_st_f.close()
+ st_f.close()
+ os.remove('../TRANSLATION-STATUS')
+ os.rename('../TRANSLATION-STATUS.tmp', '../TRANSLATION-STATUS')
def main():
global bfiles
@@ -100,7 +142,7 @@
except:
pass
try:
- opts, args = getopt.getopt(sys.argv[1:], 'af:l', ['dry-run'])
+ opts, args = getopt.getopt(sys.argv[1:], 'af:lu', ['dry-run'])
except:
usage('Invalid syntax')
sync_list = []
@@ -119,6 +161,8 @@
return get_list()
elif o == '--dry-run':
dry_run = True
+ elif o == '-u':
+ update_status_file()
cmd = string.Template('svn $a -r $r1:$r2 \
http://svn.red-bean.com/svnbook/trunk/src/en/book/$t')
for fname in sync_list:
More information about the svnbook-dev
mailing list