[svnbook commit] r2662 - in trunk/src/ru: . book
dmitriy
noreply at red-bean.com
Tue Feb 6 04:32:45 CST 2007
Author: dmitriy
Date: Tue Feb 6 04:32:44 2007
New Revision: 2662
Modified:
trunk/src/ru/TRANSLATION-STATUS
trunk/src/ru/book/ (props changed)
trunk/src/ru/book/app-quickstart.xml (props changed)
trunk/src/ru/book/app-svn-for-cvs-users.xml (props changed)
trunk/src/ru/book/app-third-party-tools.xml (props changed)
trunk/src/ru/book/app-webdav.xml (props changed)
trunk/src/ru/book/book.xml (props changed)
trunk/src/ru/book/ch-advanced-topics.xml (props changed)
trunk/src/ru/book/ch-basic-usage.xml (props changed)
trunk/src/ru/book/ch-branching-and-merging.xml (props changed)
trunk/src/ru/book/ch-customizing-svn.xml (props changed)
trunk/src/ru/book/ch-developer-info.xml (props changed)
trunk/src/ru/book/ch-fundamental-concepts.xml (props changed)
trunk/src/ru/book/ch-preface.xml (props changed)
trunk/src/ru/book/ch-reference.xml (props changed)
trunk/src/ru/book/ch-repository-admin.xml (props changed)
trunk/src/ru/book/ch-server-configuration.xml (props changed)
trunk/src/ru/book/copyright.xml (props changed)
trunk/src/ru/book/foreword.xml (props changed)
trunk/src/ru/book/index.xml (props changed)
trunk/src/ru/book/styles.css (props changed)
trunk/src/ru/sync.py
Log:
* src/ru/book/*
Remove property 'last-sync', and set this property on 'book' directory,
globally for all files.
* src/ru/sync.py: move from per-file syncing to syncing all-files-at-once.
* src/ru/TRANSLATION-STATUS: update status of translation.
Modified: trunk/src/ru/TRANSLATION-STATUS
==============================================================================
--- trunk/src/ru/TRANSLATION-STATUS (original)
+++ trunk/src/ru/TRANSLATION-STATUS Tue Feb 6 04:32:44 2007
@@ -16,7 +16,7 @@
sync with 'last-sync' revision number.
* book.xml
- * ch00.xml
+ * ch-preface.xml
* foreword.xml
@@ -25,9 +25,11 @@
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%
+ * ch-advanced-topics.xml, 17%
+ * ch-branching-and-merging.xml, 82%
+ * ch-customizing-svn.xml, 64%
+ * ch-reference.xml, 21%
+ * ch-server-configuration.xml, 13%
Forsaken
@@ -42,11 +44,11 @@
These files have never been translated.
- * appa.xml
- * appb.xml
- * appc.xml
- * ch05.xml
- * ch08.xml
+ * app-svn-for-cvs-users.xml
+ * app-third-party-tools.xml
+ * app-webdav.xml
+ * ch-developer-info.xml
+ * ch-repository-admin.xml
* copyright.xml
@@ -55,16 +57,15 @@
These files are ready for editing, translation work is finished on
them for now.
- * ch02.xml
- * ch03.xml
- * ch04.xml
+ * ch-basic-usage.xml
+ * ch-fundamental-concepts.xml
Editing in progress
These files are being proofread and edited now.
- * ch01.xml
+ * app-quickstart.xml
Technical errors
@@ -78,12 +79,12 @@
For looking or changing this status use corresponding svn commands.
For example:
- svn propget status book/ch00.xml
+ svn propget status book/foreword.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.
+ svn-property 'last-sync' of 'book' directory, for all files globally.
Urgent needs
Modified: trunk/src/ru/sync.py
==============================================================================
--- trunk/src/ru/sync.py (original)
+++ trunk/src/ru/sync.py Tue Feb 6 04:32:44 2007
@@ -1,51 +1,28 @@
#!/usr/bin/env python
-import sys, os, string, getopt, re
-
-bfiles = ['appa.xml', 'appb.xml', 'appc.xml', 'book.xml', 'ch00.xml', \
- 'ch01.xml', 'ch02.xml', 'ch03.xml', 'ch04.xml', 'ch05.xml', \
- 'ch06.xml', 'ch07.xml', 'ch08.xml', 'ch09.xml', 'copyright.xml', \
- 'foreword.xml', 'styles.css']
+import sys, os, string, getopt, re, glob
def usage(err_msg):
stream = err_msg and sys.stderr or sys.stdout
if err_msg:
stream.write("ERROR: %s\n\n" % (err_msg))
- stream.write("""Usage: %s [-a] [-l] [-f <filename(s)>] [--dry-run]
+ stream.write("""Usage: %s [-r <revision>] [-u] [--dry-run]
Options:
- -a: Synchronizing all files
- -f: File(s) which needs to be synchronized
- -l: List all files and revisions with which they are sinchronized
- -u: Update TRANSLATION-STATUS file
-
+ -r: Revision to sync
+ -u: Update TRANSLATION-STATUS file
+
--dry-run: Execute a command, but don't make actual changes
""" % (os.path.basename(sys.argv[0])))
sys.exit(err_msg and 1 or 0)
-def get_last(fname):
- return int(os.popen('svn propget last-sync '+fname).readline())
+def get_last():
+ return int(os.popen('svn propget last-sync book').readline())
-def set_last(fname, last):
- os.system('svn propset last-sync '+last+' '+fname)
-
-def get_base(fname = ''):
- global bfiles
- if fname != '':
- for line in os.popen('svn info '+fname):
- if re.match('Revision: ', line):
- return int(re.sub('Revision: ', '', line))
- else:
- rmin = sys.maxint
- rlist = []
- for file in bfiles:
- for line in os.popen('svn info '+file):
- if re.match('Revision: ', line):
- rev = int(re.sub('Revision: ', '', line))
- if rev < rmin:
- rmin = rev
- rlist.append(rev)
- return max(rlist)
+def set_last(last):
+ c = 'svn propset last-sync '+last+' book'
+ print c
+ os.system(c)
def get_percent(fname):
f = file(fname)
@@ -68,41 +45,13 @@
in_tr = False
return '%i%%' % ((ru / en) * 100)
-def get_list():
- import platform
- global bfiles
- frlist = ()
- rmin = sys.maxint
- rbase = get_base() + 1
- for file in bfiles:
- rev = get_last(file)
- if rev < rmin:
- rmin = rev
- frlist += (file, rev),
- rdelta1 = rmin + ((rbase - rmin) / 3)
- rdelta2 = rbase - ((rbase - rmin) / 3)
- for f, r in frlist:
- if platform.system() == 'Windows':
- sys.stdout.write(f+'\t'+str(r)+'\t'+get_percent(f)+'\t'+get_status(f))
- else:
- if r in range(rdelta2, rbase):
- 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):
- 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):
- 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')
+ bfiles = glob.glob('book/*.xml')
+ st_f = file('TRANSLATION-STATUS')
+ tmp_st_f = file('TRANSLATION-STATUS.tmp', 'w')
curr_sta = ''
in_sta = False
indention = ' '
@@ -113,9 +62,9 @@
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')
+ tmp_st_f.write(indention+'* '+os.path.basename(f)+', '+get_percent(f)+'\n')
else:
- tmp_st_f.write(indention+'* '+f+'\n')
+ tmp_st_f.write(indention+'* '+os.path.basename(f)+'\n')
fcount += 1
if fcount == 0:
tmp_st_f.write(indention+'* [none]\n')
@@ -130,56 +79,39 @@
tmp_st_f.write(line)
tmp_st_f.close()
st_f.close()
- os.remove('../TRANSLATION-STATUS')
- os.rename('../TRANSLATION-STATUS.tmp', '../TRANSLATION-STATUS')
+ os.remove('TRANSLATION-STATUS')
+ os.rename('TRANSLATION-STATUS.tmp', 'TRANSLATION-STATUS')
def main():
- global bfiles
if len(sys.argv) < 2:
usage(None)
try:
- os.chdir('book')
- except:
- pass
- try:
- opts, args = getopt.getopt(sys.argv[1:], 'af:lu', ['dry-run'])
+ opts, args = getopt.getopt(sys.argv[1:], 'r:u', ['dry-run'])
except:
usage('Invalid syntax')
- sync_list = []
dry_run = False
+ last = base = get_last()
for o, a in opts:
- if o == '-a':
- sync_list = bfiles
- elif o == '-f':
- for f in a.split(','):
- f = os.path.basename(f)
- if f in bfiles:
- sync_list.append(f)
- else:
- usage('Invalid syntax')
- elif o == '-l':
- return get_list()
+ if o == '-r':
+ base = int(a)
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:
- last = get_last(fname)
- base = get_base(fname)
- print ('########################################################################')
- print 'Sync r%s:r%s of %s' % (last, base, fname)
- diff = os.popen(cmd.substitute(a='diff', r1=last, r2=base, t=fname)).read()
- if len(diff) != 0:
- os.system(cmd.substitute(a='log', r1=last, r2=base, t=fname))
- f = file('../'+fname+'.diff', 'w'); f.write(diff); f.close()
- c = cmd.substitute(a='merge', r1=last, r2=base, t=fname)
- if dry_run:
- c += ' --dry-run'
- os.system(c)
- if not dry_run:
- set_last(fname, str(base))
+ return update_status_file()
+ cmd = string.Template(
+ 'svn $a -r $r1:$r2 http://svn.red-bean.com/svnbook/trunk/src/en/book/$t')
+ print ('########################################################################')
+ print 'Sync r%s:r%s' % (last, base)
+ diff = os.popen(cmd.substitute(a='diff', r1=last, r2=base, t='')).read()
+ if len(diff) != 0:
+ os.system(cmd.substitute(a='log', r1=last+1, r2=base, t=''))
+ c = cmd.substitute(a='merge', r1=last, r2=base, t=' book/')
+ if dry_run:
+ c += ' --dry-run'
+ print c
+ os.system(c)
+ if not dry_run:
+ set_last(str(base))
if __name__ == "__main__":
main()
More information about the svnbook-dev
mailing list