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 runs-on: ubuntu-latest
strategy: strategy:
matrix: 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: env:
HG_VERSION: ${{ matrix.hg }} HG_VERSION: ${{ matrix.hg }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
python-version: '3.8' python-version: '3.10'
check-latest: true check-latest: true
- name: Cache check-versions script - name: Cache check-versions script
id: cache-check-versions id: cache-check-versions

View File

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

View File

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