comparison mercurial/dispatch.py @ 30468:7f2b18c34c02

py3: use pycompat.sysargv in dispatch.run() Another one to have a bytes result from sys.argv in Python 3. This one is also a part of running `hg version` on Python 3.
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 21 Nov 2016 15:35:22 +0530
parents 869d660b8669
children 39d13b8c101d
comparison
equal deleted inserted replaced
30467:5b0baa9f3362 30468:7f2b18c34c02
34 fancyopts, 34 fancyopts,
35 fileset, 35 fileset,
36 hg, 36 hg,
37 hook, 37 hook,
38 profiling, 38 profiling,
39 pycompat,
39 revset, 40 revset,
40 templatefilters, 41 templatefilters,
41 templatekw, 42 templatekw,
42 templater, 43 templater,
43 ui as uimod, 44 ui as uimod,
56 self.fout = fout 57 self.fout = fout
57 self.ferr = ferr 58 self.ferr = ferr
58 59
59 def run(): 60 def run():
60 "run the command in sys.argv" 61 "run the command in sys.argv"
61 sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) 62 sys.exit((dispatch(request(pycompat.sysargv[1:])) or 0) & 255)
62 63
63 def _getsimilar(symbols, value): 64 def _getsimilar(symbols, value):
64 sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio() 65 sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio()
65 # The cutoff for similarity here is pretty arbitrary. It should 66 # The cutoff for similarity here is pretty arbitrary. It should
66 # probably be investigated and tweaked. 67 # probably be investigated and tweaked.