@@ -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,11 +336,8 @@ def get_repo(url, alias):
327
336
myui .setconfig ('ui' , 'interactive' , 'off' )
328
337
myui .fout = sys .stderr
329
338
330
- try :
331
- if get_config ('remote-hg.insecure' ) == 'true\n ' :
332
- myui .setconfig ('web' , 'cacerts' , '' )
333
- except subprocess .CalledProcessError :
334
- pass
339
+ if get_config_bool ('remote-hg.insecure' ):
340
+ myui .setconfig ('web' , 'cacerts' , '' )
335
341
336
342
try :
337
343
mod = extensions .load (myui , 'hgext.schemes' , None )
@@ -357,6 +363,9 @@ def get_repo(url, alias):
357
363
die ('Repository error' )
358
364
repo .pull (peer , heads = None , force = True )
359
365
366
+ rb = peer .listkeys ('bookmarks' )
367
+ bookmarks .updatefromremote (myui , repo , rb , url )
368
+
360
369
return repo
361
370
362
371
def rev_to_mark (rev ):
@@ -538,7 +547,7 @@ def list_head(repo, cur):
538
547
g_head = (head , node )
539
548
540
549
def do_list (parser ):
541
- global branches , bmarks , mode , track_branches
550
+ global branches , bmarks , track_branches
542
551
543
552
repo = parser .repo
544
553
for bmark , node in bookmarks .listbookmarks (repo ).iteritems ():
@@ -850,7 +859,7 @@ def do_export(parser):
850
859
continue
851
860
852
861
if peer :
853
- parser .repo .push (peer , force = force_push )
862
+ parser .repo .push (peer , force = force_push , newbranch = True )
854
863
855
864
# handle bookmarks
856
865
for bmark , node in p_bmarks :
@@ -867,7 +876,8 @@ def do_export(parser):
867
876
868
877
if bmark == 'master' and 'master' not in parser .repo ._bookmarks :
869
878
# fake bookmark
870
- pass
879
+ print "ok %s" % ref
880
+ continue
871
881
elif bookmarks .pushbookmark (parser .repo , bmark , old , new ):
872
882
# updated locally
873
883
pass
@@ -906,20 +916,9 @@ def main(args):
906
916
url = args [2 ]
907
917
peer = None
908
918
909
- hg_git_compat = False
910
- track_branches = True
911
- force_push = True
912
-
913
- try :
914
- if get_config ('remote-hg.hg-git-compat' ) == 'true\n ' :
915
- hg_git_compat = True
916
- track_branches = False
917
- if get_config ('remote-hg.track-branches' ) == 'false\n ' :
918
- track_branches = False
919
- if get_config ('remote-hg.force-push' ) == 'false\n ' :
920
- force_push = False
921
- except subprocess .CalledProcessError :
922
- pass
919
+ hg_git_compat = get_config_bool ('remote-hg.hg-git-compat' )
920
+ track_branches = get_config_bool ('remote-hg.track-branches' , True )
921
+ force_push = get_config_bool ('remote-hg.force-push' )
923
922
924
923
if hg_git_compat :
925
924
mode = 'hg'
0 commit comments