Mercurial > hg
comparison hgext/convert/convcmd.py @ 7948:de377b1a9a84
move encoding bits from util to encoding
In addition to cleaning up util, this gets rid of some circular dependencies.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 03 Apr 2009 14:51:48 -0500 |
parents | eba7f12b0c51 |
children | 62154415821f |
comparison
equal
deleted
inserted
replaced
7947:a454eeb1b827 | 7948:de377b1a9a84 |
---|---|
16 from bzr import bzr_source | 16 from bzr import bzr_source |
17 from p4 import p4_source | 17 from p4 import p4_source |
18 import filemap | 18 import filemap |
19 | 19 |
20 import os, shutil | 20 import os, shutil |
21 from mercurial import hg, util | 21 from mercurial import hg, util, encoding |
22 from mercurial.i18n import _ | 22 from mercurial.i18n import _ |
23 | 23 |
24 orig_encoding = 'ascii' | 24 orig_encoding = 'ascii' |
25 | 25 |
26 def recode(s): | 26 def recode(s): |
273 num -= 1 | 273 num -= 1 |
274 desc = self.commitcache[c].desc | 274 desc = self.commitcache[c].desc |
275 if "\n" in desc: | 275 if "\n" in desc: |
276 desc = desc.splitlines()[0] | 276 desc = desc.splitlines()[0] |
277 # convert log message to local encoding without using | 277 # convert log message to local encoding without using |
278 # tolocal() because util._encoding conver() use it as | 278 # tolocal() because encoding.encoding conver() use it as |
279 # 'utf-8' | 279 # 'utf-8' |
280 self.ui.status("%d %s\n" % (num, recode(desc))) | 280 self.ui.status("%d %s\n" % (num, recode(desc))) |
281 self.ui.note(_("source: %s\n") % recode(c)) | 281 self.ui.note(_("source: %s\n") % recode(c)) |
282 self.copy(c) | 282 self.copy(c) |
283 | 283 |
306 self.source.after() | 306 self.source.after() |
307 self.map.close() | 307 self.map.close() |
308 | 308 |
309 def convert(ui, src, dest=None, revmapfile=None, **opts): | 309 def convert(ui, src, dest=None, revmapfile=None, **opts): |
310 global orig_encoding | 310 global orig_encoding |
311 orig_encoding = util._encoding | 311 orig_encoding = encoding.encoding |
312 util._encoding = 'UTF-8' | 312 encoding.encoding = 'UTF-8' |
313 | 313 |
314 if not dest: | 314 if not dest: |
315 dest = hg.defaultdest(src) + "-hg" | 315 dest = hg.defaultdest(src) + "-hg" |
316 ui.status(_("assuming destination %s\n") % dest) | 316 ui.status(_("assuming destination %s\n") % dest) |
317 | 317 |