remote-hg: force remote push
Ideally we shouldn't do this, as it's not recommended in mercurial documentation, but there's no other way to push multiple bookmarks (on the same branch), which would be the behavior most similar to git. At the same time, add a configuration option for the people that don't want to risk creating new remote heads. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
11dc88f49c
commit
b0c3db860c
@ -27,6 +27,9 @@ import urllib
|
|||||||
# named branches:
|
# named branches:
|
||||||
# git config --global remote-hg.track-branches false
|
# git config --global remote-hg.track-branches false
|
||||||
#
|
#
|
||||||
|
# If you don't want to force pushes (and thus risk creating new remote heads):
|
||||||
|
# git config --global remote-hg.force-push false
|
||||||
|
#
|
||||||
# git:
|
# git:
|
||||||
# Sensible defaults for git.
|
# Sensible defaults for git.
|
||||||
# hg bookmarks are exported as git branches, hg branches are prefixed
|
# hg bookmarks are exported as git branches, hg branches are prefixed
|
||||||
@ -730,7 +733,7 @@ def do_export(parser):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if peer:
|
if peer:
|
||||||
parser.repo.push(peer, force=False)
|
parser.repo.push(peer, force=force_push)
|
||||||
|
|
||||||
# handle bookmarks
|
# handle bookmarks
|
||||||
for bmark, node in p_bmarks:
|
for bmark, node in p_bmarks:
|
||||||
@ -773,7 +776,7 @@ def main(args):
|
|||||||
global prefix, dirname, branches, bmarks
|
global prefix, dirname, branches, bmarks
|
||||||
global marks, blob_marks, parsed_refs
|
global marks, blob_marks, parsed_refs
|
||||||
global peer, mode, bad_mail, bad_name
|
global peer, mode, bad_mail, bad_name
|
||||||
global track_branches
|
global track_branches, force_push
|
||||||
|
|
||||||
alias = args[1]
|
alias = args[1]
|
||||||
url = args[2]
|
url = args[2]
|
||||||
@ -781,12 +784,16 @@ def main(args):
|
|||||||
|
|
||||||
hg_git_compat = False
|
hg_git_compat = False
|
||||||
track_branches = True
|
track_branches = True
|
||||||
|
force_push = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if get_config('remote-hg.hg-git-compat') == 'true\n':
|
if get_config('remote-hg.hg-git-compat') == 'true\n':
|
||||||
hg_git_compat = True
|
hg_git_compat = True
|
||||||
track_branches = False
|
track_branches = False
|
||||||
if get_config('remote-hg.track-branches') == 'false\n':
|
if get_config('remote-hg.track-branches') == 'false\n':
|
||||||
track_branches = False
|
track_branches = False
|
||||||
|
if get_config('remote-hg.force-push') == 'false\n':
|
||||||
|
force_push = False
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user