remote-hg: make sure the encoding is correct
Independently of the environment. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Jeff King <peff@peff.net>
Felipe Contreras committed
Nov 4, 2012 at 03:13 UTC
ff247d9e56366a3b03d8ca926fd88b51d3c2df52
1 file changed
+11
-1
contrib/remote-helpers/git-remote-hg
+11
-1
@@ -9,7 +9,7 @@
9
# Then you can clone with:
10
# git clone hg::/path/to/mercurial/repo/
11
12
-from mercurial import hg, ui, bookmarks, context, util
12
+from mercurial import hg, ui, bookmarks, context, util, encoding
13
14
import re
15
import sys
@@ -391,6 +391,9 @@ def do_import(parser):
391
print "feature export-marks=%s" % path
392
sys.stdout.flush()
393
394
+ tmp = encoding.encoding
395
+ encoding.encoding = 'utf-8'
396
+
397
# lets get all the import lines
398
while parser.check('import'):
399
ref = parser[1]
@@ -409,6 +412,8 @@ def do_import(parser):
412
413
parser.next()
414
415
+ encoding.encoding = tmp
416
+
417
print 'done'
418
419
def parse_blob(parser):
@@ -491,8 +496,13 @@ def parse_commit(parser):
496
files.keys(), getfilectx,
497
user, (date, tz), extra)
498
499
+ tmp = encoding.encoding
500
+ encoding.encoding = 'utf-8'
501
+
502
node = repo.commitctx(ctx)
503
504
+ encoding.encoding = tmp
505
+
506
rev = repo[node].rev()
507
508
parsed_refs[ref] = node