Cope with UnicodeDecodeError on git svn output

svn: r23138
This commit is contained in:
Vassilii Khachaturov 2013-09-15 14:56:01 +00:00
parent f7c036ab52
commit f4be9dfc70

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
@ -20,6 +21,8 @@
# $Id$
from __future__ import unicode_literals
import sys
import subprocess
import re
@ -43,7 +46,10 @@ def _get_svn_revision(path, command, stdout_to_rev):
return "" # subprocess failed
# subprocess worked
if stdout and len(stdout) > 0: # has output
stdout = cuni(stdout) # get a proper string
try:
stdout = cuni(stdout) # get a proper string
except UnicodeDecodeError:
pass
rev = stdout_to_rev(stdout)
return "-r" + rev if rev else ""
else: # no output from svnversion