[issue2223] File name encoding issue in hg convert
Kyung-Kook Park
bugs at mercurial.selenic.com
Thu Jun 3 03:29:22 UTC 2010
New submission from Kyung-Kook Park <gegogi at gmail.com>:
When converting an SVN repo to Mercurial repo using 'hg convert', all the file names are committed in
UTF-8 encoding into the new Mercurial repository and there seems no way to adjust this (HGENCODING
only involves for file contents and log messages). So I changed 'hgext/convert/hg.py:132' as follows
and it seems to work well. But it's hard-coded for Korean encoding and I hope somebody change this
into a elegant code.
def putcommit(self, files, copies, parents, commit, source, revmap):
### gegogi mod ###
def _cp949(s):
return s.decode('utf-8').encode('cp949')
def _utf8(s):
return s.decode('cp949').encode('utf-8')
##################
files = dict(files)
### gegogi mod ###
for k, v in files.items():
del files[k]
files[_cp949(k)] = v
for k, v in copies.items():
del copies[k]
copies[_cp949(k)] = _cp949(v)
##################
def getfilectx(repo, memctx, f):
### gegogi mod ###
v = files[f]
data = source.getfile(_utf8(f), v)
e = source.getmode(_utf8(f), v)
if f == '.hgtags':
data = self._rewritetags(source, revmap, data)
return context.memfilectx(f, data, 'l' in e, 'x' in e, copies.get(f))
##################
----------
messages: 12732
nosy: gegogi
priority: bug
status: unread
title: File name encoding issue in hg convert
____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2223>
____________________________________________________
More information about the Mercurial-devel
mailing list