summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe2006-12-14 17:11:58 (GMT)
committercvs2git2012-06-24 12:13:13 (GMT)
commit2303b359be2b477bc0952095e47d92f2d4ec750c (patch)
tree3e92515026008ca7f4438bb78b5331dc928740c1
parent0800239bff36e64119477a25f56c2fa746277465 (diff)
downloadsvn2log-2303b359be2b477bc0952095e47d92f2d4ec750c.zip
svn2log-2303b359be2b477bc0952095e47d92f2d4ec750c.tar.gz
- add --users-charset option, based on svn2log.py i got oneday from arekm
Changed files: svn2log-users-encoding.patch -> 1.1
-rw-r--r--svn2log-users-encoding.patch111
1 files changed, 111 insertions, 0 deletions
diff --git a/svn2log-users-encoding.patch b/svn2log-users-encoding.patch
new file mode 100644
index 0000000..a63155a
--- /dev/null
+++ b/svn2log-users-encoding.patch
@@ -0,0 +1,111 @@
+--- ./svn2log~ 2006-05-28 23:38:36.000000000 +0300
++++ ./svn2log 2006-12-14 19:09:11.752041366 +0200
+@@ -1,4 +1,5 @@
+ #!/usr/bin/python
++# -*- coding: UTF-8 -*-
+ #
+ # Copyright (c) 2003 The University of Wroclaw.
+ # All rights reserved.
+@@ -34,6 +35,7 @@
+ import getopt
+ import string
+ import codecs
++import locale
+
+ import qp_xml
+
+@@ -83,7 +85,7 @@
+ if users.has_key(u):
+ return users[u]
+ else:
+- return "%s <%s@%s>" % (u, u, default_domain)
++ return u"%s <%s@%s>" % (u, u, default_domain)
+
+ def wrap_text_line(str, pref, width):
+ ret = u""
+@@ -139,7 +141,7 @@
+ (time.strftime("%Y-%m-%d %H:%M +0000", time.localtime(self.beg_tm)), \
+ self.rev, self.beg_rev, convert_user(self.author)))
+ else:
+- out.write("%s [r%s] %s\n\n" % \
++ out.write(u"%s [r%s] %s\n\n" % \
+ (time.strftime("%Y-%m-%d %H:%M +0000", time.localtime(self.beg_tm)), \
+ self.rev, convert_user(self.author)))
+ out.write(self.msg)
+@@ -211,6 +213,8 @@
+ -o, --output set output file (defaults to 'ChangeLog')
+ -d, --domain=DOMAIN set default domain for logins not listed in users file
+ -u, --users=FILE read logins from specified file
++ --users-encoding=ENCODING
++ specify encoding of users. defaults to ISO8859-1
+ -F, --list-format format commit logs with enumerated change list (items
+ prefixed by '- ')
+ -r, --relocate=X=Y before doing any other operations on paths, replace
+@@ -242,7 +246,7 @@
+ def process_opts():
+ try:
+ opts, args = getopt.gnu_getopt(sys.argv[1:], "o:u:p:x:d:r:d:D:Fh",
+- ["users=", "prefix=", "domain=", "delta=",
++ ["users-charset=", "users=", "prefix=", "domain=", "delta=",
+ "exclude=", "help", "output=", "relocate=",
+ "list-format"])
+ except getopt.GetoptError:
+@@ -250,6 +254,8 @@
+ sys.exit(2)
+ fin = sys.stdin
+ fout = None
++ users_file = None
++ users_charset = 'ISO8859-1'
+ global kill_prefix_rx, exclude, users, default_domain, reloc, max_join_delta, list_format
+ for o, a in opts:
+ if o in ("--prefix", "-p"):
+@@ -260,16 +266,13 @@
+ usage()
+ sys.exit(0)
+ elif o in ("--output", "-o"):
+- fout = open(a, "w")
++ fout = utf_open(a, "w")
+ elif o in ("--domain", "-d"):
+ default_domain = a
+ elif o in ("--users", "-u"):
+- f = utf_open(a, "r")
+- for line in f.xreadlines():
+- w = line.split()
+- if len(line) < 1 or line[0] == '#' or len(w) < 2:
+- continue
+- users[w[0]] = " ".join(w[1:])
++ users_file = a
++ elif o in ("--users-charset"):
++ users_charset = a
+ elif o in ("--relocate", "-r"):
+ (src, target) = a.split("=")
+ reloc[src] = target
+@@ -280,6 +283,7 @@
+ else:
+ usage()
+ sys.exit(2)
++
+ if len(args) > 1:
+ usage()
+ sys.exit(2)
+@@ -287,6 +291,14 @@
+ fin = open(args[0], "r")
+ if fout == None:
+ fout = utf_open("ChangeLog", "w")
++
++ if users_file != None:
++ f = utf_open(users_file, "r")
++ for line in f.xreadlines():
++ w = line.split()
++ if len(line) < 1 or line[0] == '#' or len(w) < 2:
++ continue
++ users[w[0]] = " ".join(w[1:]).decode(users_charset)
+ process(fin, fout)
+
+ if __name__ == "__main__":
+@@ -296,3 +308,5 @@
+ except AttributeError:
+ pass
+ process_opts()
++
++# vim:ts=2:sw=2:et