summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2013-05-14 04:36:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-05-15 19:33:39 (GMT)
commit760ee1c70a4dbbc792a4bb31731576d8648d24f4 (patch)
treeccf9a489cb9d227f43e0fe4e468aeab93aa1aa15 /contrib
parent679e87c02bf02b34fe4dba5bd09e17269223c96f (diff)
downloadgit-760ee1c70a4dbbc792a4bb31731576d8648d24f4.zip
git-760ee1c70a4dbbc792a4bb31731576d8648d24f4.tar.gz
git-760ee1c70a4dbbc792a4bb31731576d8648d24f4.tar.bz2
remote-hg: add new get_config_bool() helper
No functional changes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/remote-helpers/git-remote-hg24
1 files changed, 13 insertions, 11 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index de3a96e..4a5c72f 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -87,6 +87,15 @@ def get_config(config):
output, _ = process.communicate()
return output
+def get_config_bool(config, default=False):
+ value = get_config(config).rstrip('\n')
+ if value == "true":
+ return True
+ elif value == "false":
+ return False
+ else:
+ return default
+
class Marks:
def __init__(self, path):
@@ -327,7 +336,7 @@ def get_repo(url, alias):
myui.setconfig('ui', 'interactive', 'off')
myui.fout = sys.stderr
- if get_config('remote-hg.insecure') == 'true\n':
+ if get_config_bool('remote-hg.insecure'):
myui.setconfig('web', 'cacerts', '')
try:
@@ -903,16 +912,9 @@ def main(args):
url = args[2]
peer = None
- hg_git_compat = False
- track_branches = True
- force_push = True
-
- if get_config('remote-hg.hg-git-compat') == 'true\n':
- hg_git_compat = True
- if get_config('remote-hg.track-branches') == 'false\n':
- track_branches = False
- if get_config('remote-hg.force-push') == 'false\n':
- force_push = False
+ hg_git_compat = get_config_bool('remote-hg.hg-git-compat')
+ track_branches = get_config_bool('remote-hg.track-branches', True)
+ force_push = get_config_bool('remote-hg.force-push', True)
if hg_git_compat:
mode = 'hg'