comparison python/hgrc.py @ 831:d1c147c73f34

bytes vs string
author Jeff Hammel <k0scist@gmail.com>
date Sun, 19 Feb 2017 18:02:32 -0800
parents 6de24d387889
children b9be1237fffa
comparison
equal deleted inserted replaced
830:6de24d387889 831:d1c147c73f34
19 import optparse 19 import optparse
20 import os 20 import os
21 import subprocess 21 import subprocess
22 import sys 22 import sys
23 from collections import OrderedDict 23 from collections import OrderedDict
24 from StringIO import StringIO 24
25 25
26 try: 26 try:
27 # python 2 27 # python 2
28 import urlparse 28 import urlparse
29 from ConfigParser import RawConfigParser as ConfigParser 29 from ConfigParser import RawConfigParser as ConfigParser
30 from StringIO import StringIO
30 except ImportError: 31 except ImportError:
31 # python 3 32 # python 3
32 import urllib.parse as urlparse 33 import urllib.parse as urlparse
33 from configparser import RawConfigParser as ConfigParser 34 from configparser import RawConfigParser as ConfigParser
35 from io import StringIO
34 36
35 ### global methods 37 ### global methods
36 38
37 def isHTTP(path): 39 def isHTTP(path):
38 """is path an {http,https}:// URL?""" 40 """is path an {http,https}:// URL?"""
114 if options.default_push and options.default_push_ssh: 116 if options.default_push and options.default_push_ssh:
115 parser.error("Cannot set --push and --ssh") 117 parser.error("Cannot set --push and --ssh")
116 118
117 # if not specified, use repo from `hg root` 119 # if not specified, use repo from `hg root`
118 if not args: 120 if not args:
119 args = [subprocess.check_output(['hg', 'root']).strip()] 121 args = [subprocess.check_output(['hg', 'root']).strip().decode('utf-8')]
120 122
121 # if not specified, set a default action 123 # if not specified, set a default action
122 default_action = 'default_push_ssh' 124 default_action = 'default_push_ssh'
123 available_actions = ('default', 125 available_actions = ('default',
124 'default_push', 126 'default_push',