Mercurial > public > mercurial-scm > hg
diff hgext/convert/common.py @ 4810: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 Thu Jul 05 12:00:43 2007 -0700 +++ b/hgext/convert/common.py Thu Jul 05 12:08:48 2007 -0700 @@ -17,7 +17,11 @@ 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 @@ 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")