@@ -87,6 +87,15 @@ def get_config(config):
8787 output , _ = process .communicate ()
8888 return output
8989
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+
9099class Marks :
91100
92101 def __init__ (self , path ):
@@ -327,11 +336,8 @@ def get_repo(url, alias):
327336 myui .setconfig ('ui' , 'interactive' , 'off' )
328337 myui .fout = sys .stderr
329338
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' , '' )
335341
336342 try :
337343 mod = extensions .load (myui , 'hgext.schemes' , None )
@@ -357,6 +363,9 @@ def get_repo(url, alias):
357363 die ('Repository error' )
358364 repo .pull (peer , heads = None , force = True )
359365
366+ rb = peer .listkeys ('bookmarks' )
367+ bookmarks .updatefromremote (myui , repo , rb , url )
368+
360369 return repo
361370
362371def rev_to_mark (rev ):
@@ -538,7 +547,7 @@ def list_head(repo, cur):
538547 g_head = (head , node )
539548
540549def do_list (parser ):
541- global branches , bmarks , mode , track_branches
550+ global branches , bmarks , track_branches
542551
543552 repo = parser .repo
544553 for bmark , node in bookmarks .listbookmarks (repo ).iteritems ():
@@ -850,7 +859,7 @@ def do_export(parser):
850859 continue
851860
852861 if peer :
853- parser .repo .push (peer , force = force_push )
862+ parser .repo .push (peer , force = force_push , newbranch = True )
854863
855864 # handle bookmarks
856865 for bmark , node in p_bmarks :
@@ -867,7 +876,8 @@ def do_export(parser):
867876
868877 if bmark == 'master' and 'master' not in parser .repo ._bookmarks :
869878 # fake bookmark
870- pass
879+ print "ok %s" % ref
880+ continue
871881 elif bookmarks .pushbookmark (parser .repo , bmark , old , new ):
872882 # updated locally
873883 pass
@@ -906,20 +916,9 @@ def main(args):
906916 url = args [2 ]
907917 peer = None
908918
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' )
923922
924923 if hg_git_compat :
925924 mode = 'hg'
0 commit comments