hgext/convert/common.py
changeset 37622 bfdd20d22a86
parent 37582 39ced3ef586d
child 38312 79dd61a4554f
equal deleted inserted replaced
37621:5537d8f5e989 37622:bfdd20d22a86
   215             encoding = self.encoding or 'utf-8'
   215             encoding = self.encoding or 'utf-8'
   216 
   216 
   217         if isinstance(s, unicode):
   217         if isinstance(s, unicode):
   218             return s.encode("utf-8")
   218             return s.encode("utf-8")
   219         try:
   219         try:
   220             return s.decode(encoding).encode("utf-8")
   220             return s.decode(pycompat.sysstr(encoding)).encode("utf-8")
   221         except UnicodeError:
   221         except UnicodeError:
   222             try:
   222             try:
   223                 return s.decode("latin-1").encode("utf-8")
   223                 return s.decode("latin-1").encode("utf-8")
   224             except UnicodeError:
   224             except UnicodeError:
   225                 return s.decode(encoding, "replace").encode("utf-8")
   225                 return s.decode(pycompat.sysstr(encoding),
       
   226                                 "replace").encode("utf-8")
   226 
   227 
   227     def getchangedfiles(self, rev, i):
   228     def getchangedfiles(self, rev, i):
   228         """Return the files changed by rev compared to parent[i].
   229         """Return the files changed by rev compared to parent[i].
   229 
   230 
   230         i is an index selecting one of the parents of rev.  The return
   231         i is an index selecting one of the parents of rev.  The return