File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,15 @@ def get_config(config):
87
87
output , _ = process .communicate ()
88
88
return output
89
89
90
+ def get_config_bool (config , default = False ):
91
+ value = get_config (config ).rstrip ('\n ' )
92
+ if value == "true" :
93
+ return True
94
+ elif value == "false" :
95
+ return False
96
+ else :
97
+ return default
98
+
90
99
class Marks :
91
100
92
101
def __init__ (self , path ):
@@ -327,7 +336,7 @@ def get_repo(url, alias):
327
336
myui .setconfig ('ui' , 'interactive' , 'off' )
328
337
myui .fout = sys .stderr
329
338
330
- if get_config ('remote-hg.insecure' ) == 'true \n ' :
339
+ if get_config_bool ('remote-hg.insecure' ):
331
340
myui .setconfig ('web' , 'cacerts' , '' )
332
341
333
342
try :
@@ -903,16 +912,9 @@ def main(args):
903
912
url = args [2 ]
904
913
peer = None
905
914
906
- hg_git_compat = False
907
- track_branches = True
908
- force_push = True
909
-
910
- if get_config ('remote-hg.hg-git-compat' ) == 'true\n ' :
911
- hg_git_compat = True
912
- if get_config ('remote-hg.track-branches' ) == 'false\n ' :
913
- track_branches = False
914
- if get_config ('remote-hg.force-push' ) == 'false\n ' :
915
- force_push = False
915
+ hg_git_compat = get_config_bool ('remote-hg.hg-git-compat' )
916
+ track_branches = get_config_bool ('remote-hg.track-branches' , True )
917
+ force_push = get_config_bool ('remote-hg.force-push' , True )
916
918
917
919
if hg_git_compat :
918
920
mode = 'hg'
You can’t perform that action at this time.
0 commit comments