changeset 1281:e74fad41077b

svnmeta: copy util.getmessage to here so we can refactor This doesn't do anything currently but will be used in upcoming patches to refactor the call to ui.config.
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 24 Mar 2014 11:20:51 -0500
parents c791efb7082a
children 5aecb986a5a0
files hgsubversion/svnmeta.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svnmeta.py
+++ b/hgsubversion/svnmeta.py
@@ -366,6 +366,20 @@ class SVNMeta(object):
     def taglocations(self):
         return self.layoutobj.taglocations(self.metapath)
 
+    def getmessage(self, rev):
+        msg = rev.message
+
+        if msg:
+            try:
+                msg.decode('utf-8')
+                return msg
+
+            except UnicodeDecodeError:
+                # ancient svn failed to enforce utf8 encoding
+                return msg.decode('iso-8859-1').encode('utf-8')
+        else:
+            return self.ui.config('hgsubversion', 'defaultmessage', '')
+
     def get_path_tag(self, path):
         """If path could represent the path to a tag, returns the
         potential (non-empty) tag name. Otherwise, returns None