Merge commit '22229dd738ae3d0752b293cca1cf948c1d154cfa' into felipec

These changes can be merged with limited to no conflict resolution.
This commit is contained in:
Mark Nauwelaerts
2025-04-29 17:48:08 +02:00
4 changed files with 84 additions and 39 deletions

View File

@@ -7,14 +7,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
hg: [ '5.5', '5.6', '5.7', '5.8', '5.9', '6.0', '6.1', '6.2' ]
hg: [ '5.5', '5.6', '5.7', '5.8', '5.9', '6.0', '6.1', '6.2', '6.3' ]
env:
HG_VERSION: ${{ matrix.hg }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'
check-latest: true
- name: Cache check-versions script
id: cache-check-versions

View File

@@ -1417,6 +1417,7 @@ def do_push_hg(parser):
global parsed_refs, parsed_tags
p_bmarks = []
p_revs = {}
ok_refs = []
parsed_refs = {}
parsed_tags = {}
@@ -1463,7 +1464,7 @@ def do_push_hg(parser):
continue
p_revs[bnode] = ref
puts(b"ok %s" % ref)
ok_refs.append(ref)
elif ref.startswith(b'refs/heads/'):
bmark = ref[len(b'refs/heads/'):]
new = node
@@ -1473,14 +1474,14 @@ def do_push_hg(parser):
puts(b"ok %s up to date" % ref)
continue
puts(b"ok %s" % ref)
ok_refs.append(ref)
if not bookmark_is_fake(bmark, parser.repo._bookmarks):
p_bmarks.append((ref, bmark, old, new))
p_revs[bnode] = ref
elif ref.startswith(b'refs/tags/'):
if dry_run:
puts(b"ok %s" % ref)
ok_refs.append(ref)
continue
tag = ref[len(b'refs/tags/'):]
tag = hgref(tag)
@@ -1507,14 +1508,15 @@ def do_push_hg(parser):
fp.write(b'%s %s\n' % (node, tag))
fp.close()
p_revs[bnode] = ref
puts(b"ok %s" % ref)
ok_refs.append(ref)
else:
# transport-helper/fast-export bugs
continue
if dry_run:
if peer:
checkheads(parser.repo, peer, p_revs, force_push)
if not peer or checkheads(parser.repo, peer, p_revs, force_push):
for ref in ok_refs:
puts(b"ok %s" % ref)
return
success = True
@@ -1535,12 +1537,18 @@ def do_push_hg(parser):
if not peer.pushkey(b'bookmarks', bmark, old, new):
success = False
puts(b"error %s" % ref)
ok_refs.remove(ref)
else:
# update local bookmarks
for ref, bmark, old, new in p_bmarks:
if not bookmarks.pushbookmark(parser.repo, bmark, old, new):
success = False
puts(b"error %s" % ref)
ok_refs.remove(ref)
# update rest of the refs
for ref in ok_refs:
puts(b"ok %s" % ref)
return success

View File

@@ -652,16 +652,27 @@ test_expect_success 'remote big push' '
(
cd gitrepo &&
check_push 1 --all <<-\EOF
master
good_bmark
branches/good_branch
new_bmark:new
branches/new_branch:new
bad_bmark1:non-fast-forward
bad_bmark2:non-fast-forward
branches/bad_branch:non-fast-forward
EOF
if test "$CAPABILITY_PUSH" = "t"
then
# cap push handles refs one by one
# so it will still correctly report several ok
check_push 1 --all <<-\EOF
master
good_bmark
branches/good_branch
new_bmark:new
branches/new_branch:new
bad_bmark1:non-fast-forward
bad_bmark2:non-fast-forward
branches/bad_branch:non-fast-forward
EOF
else
check_push 1 --all <<-\EOF
bad_bmark1:non-fast-forward
bad_bmark2:non-fast-forward
branches/bad_branch:non-fast-forward
EOF
fi
) &&
if test "$CAPABILITY_PUSH" = "t"
@@ -675,7 +686,8 @@ test_expect_success 'remote big push' '
check_bookmark hgrepo good_bmark three &&
check_bookmark hgrepo bad_bmark1 one &&
check_bookmark hgrepo bad_bmark2 one &&
check_bookmark hgrepo new_bmark six
check_bookmark hgrepo new_bmark six &&
check gitrepo origin/master two
else
check_branch hgrepo default one &&
check_branch hgrepo good_branch "good branch" &&
@@ -684,7 +696,8 @@ test_expect_success 'remote big push' '
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 &&
check gitrepo origin/master one
fi
'
@@ -734,12 +747,21 @@ test_expect_success 'remote big push non fast forward' '
echo five > content &&
git commit -q -a -m five &&
check_push 1 --all <<-\EOF &&
master
good_bmark
bad_bmark:non-fast-forward
branches/bad_branch:non-fast-forward
EOF
if test "$CAPABILITY_PUSH" = "t"
then
check_push 1 --all <<-\EOF
master
good_bmark
bad_bmark:non-fast-forward
branches/bad_branch:non-fast-forward
EOF
else
# cap export now only report error cases
check_push 1 --all <<-\EOF
bad_bmark:non-fast-forward
branches/bad_branch:non-fast-forward
EOF
fi &&
git fetch &&
@@ -753,9 +775,8 @@ test_expect_success 'remote big push non fast forward' '
branches/bad_branch:non-fast-forward
EOF
else
# cap export now only report error cases
check_push 1 --all <<-\EOF
master
good_bmark
bad_bmark:non-fast-forward
branches/bad_branch:non-fast-forward
EOF
@@ -797,6 +818,7 @@ test_expect_success 'remote big push force' '
fi
) &&
check gitrepo origin/master two &&
check_branch hgrepo good_branch eight &&
check_branch hgrepo bad_branch nine &&
check_branch hgrepo new_branch ten &&
@@ -814,16 +836,27 @@ test_expect_success 'remote big push dry-run' '
(
cd gitrepo &&
check_push 1 --dry-run --all <<-\EOF &&
master
good_bmark
branches/good_branch
new_bmark:new
branches/new_branch:new
bad_bmark1:non-fast-forward
bad_bmark2:non-fast-forward
branches/bad_branch:non-fast-forward
EOF
if test "$CAPABILITY_PUSH" = "t"
then
# cap push handles refs one by one
# so it will still correctly report several ok
check_push 1 --dry-run --all <<-\EOF
master
good_bmark
branches/good_branch
new_bmark:new
branches/new_branch:new
bad_bmark1:non-fast-forward
bad_bmark2:non-fast-forward
branches/bad_branch:non-fast-forward
EOF
else
check_push 1 --dry-run --all <<-\EOF
bad_bmark1:non-fast-forward
bad_bmark2:non-fast-forward
branches/bad_branch:non-fast-forward
EOF
fi &&
check_push 0 --dry-run master good_bmark new_bmark branches/good_branch branches/new_branch <<-\EOF
master
@@ -834,6 +867,7 @@ test_expect_success 'remote big push dry-run' '
EOF
) &&
check gitrepo origin/master one &&
check_branch hgrepo default one &&
check_branch hgrepo good_branch "good branch" &&
check_branch hgrepo bad_branch "bad branch" &&
@@ -878,6 +912,7 @@ test_expect_success 'remote big push force dry-run' '
fi
) &&
check gitrepo origin/master one &&
check_branch hgrepo default one &&
check_branch hgrepo good_branch "good branch" &&
check_branch hgrepo bad_branch "bad branch" &&

View File

@@ -47,4 +47,6 @@ hg:6.0 hggit:0.10.2 dulwich:0.20.0 # 2021_11
hg:6.1 hggit:0.10.2 dulwich:0.20.0 # 2022_02
hg:6.2 hggit:0.10.2 dulwich:0.20.0 # 2022_07
hg:6.2 hggit:1.0.0 dulwich:0.20.45 # latest
hg:6.3 hggit:1.0.1 dulwich:0.20.50
# hg:6.3 hggit:1.0.1 dulwich:0.21.3 # latest