mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2025-11-02 01:25:49 +01:00
Merge commit 'b3cd' into felipec
These changes can be merged with limited to none conflict resolution.
This commit is contained in:
@@ -1273,6 +1273,10 @@ def push(repo, remote, p_revs, force):
|
||||
|
||||
return ret
|
||||
|
||||
def bookmark_is_fake(bmark, real_bmarks):
|
||||
return bmark == fake_bmark or \
|
||||
(bmark == 'master' and bmark not in real_bmarks)
|
||||
|
||||
def do_export(parser):
|
||||
do_push_hg(parser)
|
||||
print
|
||||
@@ -1338,8 +1342,7 @@ def do_push_hg(parser):
|
||||
continue
|
||||
|
||||
print "ok %s" % ref
|
||||
if bmark != fake_bmark and \
|
||||
not (bmark == 'master' and bmark not in parser.repo._bookmarks):
|
||||
if not bookmark_is_fake(bmark, parser.repo._bookmarks):
|
||||
p_bmarks.append((ref, bmark, old, new))
|
||||
|
||||
p_revs[bnode] = ref
|
||||
@@ -1372,7 +1375,7 @@ def do_push_hg(parser):
|
||||
continue
|
||||
|
||||
if dry_run:
|
||||
if peer and not force_push:
|
||||
if peer:
|
||||
checkheads(parser.repo, peer, p_revs, force_push)
|
||||
return
|
||||
|
||||
|
||||
62
test/main.t
62
test/main.t
@@ -96,14 +96,14 @@ check_push () {
|
||||
'')
|
||||
grep "^ [a-f0-9]*\.\.[a-f0-9]* *${branch} -> ${branch}$" error || ref_ret=1
|
||||
;;
|
||||
*)
|
||||
echo "BUG: wrong kind '$kind'" && return 3
|
||||
;;
|
||||
esac
|
||||
test $ref_ret -ne 0 && echo "match for '$branch' failed" && break
|
||||
test $ref_ret -ne 0 && echo "match for '$branch' failed" && return 2
|
||||
done
|
||||
|
||||
if test $expected_ret -ne $ret || test $ref_ret -ne 0
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
test $expected_ret -ne $ret && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -686,11 +686,11 @@ test_expect_success 'remote big push' '
|
||||
check_branch hgrepo default one &&
|
||||
check_branch hgrepo good_branch "good branch" &&
|
||||
check_branch hgrepo bad_branch "bad branch" &&
|
||||
check_branch hgrepo new_branch '' &&
|
||||
check_branch hgrepo new_branch &&
|
||||
check_bookmark hgrepo good_bmark one &&
|
||||
check_bookmark hgrepo bad_bmark1 one &&
|
||||
check_bookmark hgrepo bad_bmark2 one &&
|
||||
check_bookmark hgrepo new_bmark ''
|
||||
check_bookmark hgrepo new_bmark
|
||||
fi
|
||||
'
|
||||
|
||||
@@ -845,11 +845,55 @@ test_expect_success 'remote big push dry-run' '
|
||||
check_branch hgrepo default one &&
|
||||
check_branch hgrepo good_branch "good branch" &&
|
||||
check_branch hgrepo bad_branch "bad branch" &&
|
||||
check_branch hgrepo new_branch '' &&
|
||||
check_branch hgrepo new_branch &&
|
||||
check_bookmark hgrepo good_bmark one &&
|
||||
check_bookmark hgrepo bad_bmark1 one &&
|
||||
check_bookmark hgrepo bad_bmark2 one &&
|
||||
check_bookmark hgrepo new_bmark ''
|
||||
check_bookmark hgrepo new_bmark
|
||||
'
|
||||
|
||||
test_expect_success 'remote big push force dry-run' '
|
||||
test_when_finished "rm -rf hgrepo gitrepo*" &&
|
||||
|
||||
setup_big_push
|
||||
|
||||
(
|
||||
cd gitrepo &&
|
||||
|
||||
if test "$CAPABILITY_PUSH" = "t"
|
||||
then
|
||||
check_push 0 --force --dry-run --all <<-\EOF
|
||||
master:forced-update
|
||||
good_bmark:forced-update
|
||||
branches/good_branch:forced-update
|
||||
new_bmark:new
|
||||
branches/new_branch:new
|
||||
bad_bmark1:forced-update
|
||||
bad_bmark2:forced-update
|
||||
branches/bad_branch:forced-update
|
||||
EOF
|
||||
else
|
||||
check_push 0 --force --dry-run --all <<-\EOF
|
||||
master
|
||||
good_bmark
|
||||
branches/good_branch
|
||||
new_bmark:new
|
||||
branches/new_branch:new
|
||||
bad_bmark1:forced-update
|
||||
bad_bmark2:forced-update
|
||||
branches/bad_branch:forced-update
|
||||
EOF
|
||||
fi
|
||||
) &&
|
||||
|
||||
check_branch hgrepo default one &&
|
||||
check_branch hgrepo good_branch "good branch" &&
|
||||
check_branch hgrepo bad_branch "bad branch" &&
|
||||
check_branch hgrepo new_branch &&
|
||||
check_bookmark hgrepo good_bmark one &&
|
||||
check_bookmark hgrepo bad_bmark1 one &&
|
||||
check_bookmark hgrepo bad_bmark2 one &&
|
||||
check_bookmark hgrepo new_bmark
|
||||
'
|
||||
|
||||
test_expect_success 'remote double failed push' '
|
||||
|
||||
Reference in New Issue
Block a user