diff hgext/convert/common.py @ 4809:c2d529f288a1

convert: move some code into common init function
author Brendan Cully <brendan@kublai.com>
date Thu, 05 Jul 2007 12:08:48 -0700
parents 15a3cbfc6568
children a5209b0487e0
line wrap: on
line diff
--- a/hgext/convert/common.py
+++ b/hgext/convert/common.py
@@ -17,7 +17,11 @@ class converter_source(object):
     def __init__(self, ui, path, rev=None):
         """Initialize conversion source (or raise NoRepo("message")
         exception if path is not a valid repository)"""
-        pass
+        self.ui = ui
+        self.path = path
+        self.rev = rev
+
+        self.encoding = 'utf-8'
 
     def getheads(self):
         """Return a list of this repository's heads"""
@@ -48,7 +52,7 @@ class converter_source(object):
 
     def recode(self, s, encoding=None):
         if not encoding:
-            encoding = hasattr(self, 'encoding') and self.encoding or 'utf-8'
+            encoding = self.encoding or 'utf-8'
             
         try:
             return s.decode(encoding).encode("utf-8")