comparison lib/hg/hggit_sync.py @ 322:e7fe049b7f8b

Use UTF8 encoding.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 12 Oct 2015 08:32:35 -0700
parents e40cdce29e5a
children
comparison
equal deleted inserted replaced
321:7ab2a4418eaf 322:e7fe049b7f8b
1 import os 1 import os
2 import os.path 2 import os.path
3 import sys 3 import sys
4 import codecs
4 import subprocess 5 import subprocess
5 6
6 7
7 class CommitInfo(object): 8 class CommitInfo(object):
8 def __init__(self): 9 def __init__(self):
76 77
77 map_file = os.path.join(hg_repo, '.hg', 'git-mapfile') 78 map_file = os.path.join(hg_repo, '.hg', 'git-mapfile')
78 if len(sys.argv) > 1: 79 if len(sys.argv) > 1:
79 map_file = sys.argv[1] 80 map_file = sys.argv[1]
80 print "Saving map file: %s" % map_file 81 print "Saving map file: %s" % map_file
81 with open(map_file, 'w') as fp: 82 with codecs.open(map_file, 'w', encoding='utf8') as fp:
82 for key, val in commit_map.iteritems(): 83 for key, val in commit_map.iteritems():
83 if val[0] is None or val[1] is None: 84 if val[0] is None or val[1] is None:
84 continue 85 continue
85 fp.write(val[0].nodeid) 86 fp.write(val[0].nodeid)
86 fp.write(' ') 87 fp.write(' ')