From c77ae926f07c67cb4c332fb93048a47c688f2b52 Mon Sep 17 00:00:00 2001 From: Frej Drejhammar Date: Thu, 2 Apr 2026 21:51:43 +0200 Subject: [PATCH 1/2] Bugfix: Handle closed branches The update for Mercurial 7.2 in "Support Mercurial 7.2" (76db75d9631f) broke the handling of closed branches as it did not tell repo.branchmap().branchheads() to fetch all branch heads, including closed heads. This patch explicitly asks for all heads, thus restoring support for closed branches. --- hg-fast-export.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hg-fast-export.py b/hg-fast-export.py index fa4e852..ba76cf3 100755 --- a/hg-fast-export.py +++ b/hg-fast-export.py @@ -490,7 +490,7 @@ def verify_heads(ui,repo,cache,force,ignore_unnamed_heads,branchesmap): branches={} for bn in repo.branchmap(): - heads = repo.branchmap().branchheads(bn) + heads = repo.branchmap().branchheads(bn, closed=True) branches[bn] = branchtip(repo, heads) l=[(-repo.changelog.rev(n), n, t) for t, n in branches.items()] l.sort() From 3285df78749471ba4e7640809b16f8cb65ef9d9f Mon Sep 17 00:00:00 2001 From: Frej Drejhammar Date: Thu, 2 Apr 2026 20:48:36 +0200 Subject: [PATCH 2/2] Add test for closed branches --- t/smoke-test.expected | 22 ++++++++++++++++++++++ t/smoke-test.t | 7 +++++++ 2 files changed, 29 insertions(+) diff --git a/t/smoke-test.expected b/t/smoke-test.expected index 54b8be4..e4bca48 100644 --- a/t/smoke-test.expected +++ b/t/smoke-test.expected @@ -298,3 +298,25 @@ Added file in branch åäö from :41 M 100644 :42 a0d01fcbff5d86327d542687dcfd8b299d054147 +blob +mark :44 +data 24 +this-is-a-closed-branch + +commit refs/heads/this-is-a-closed-branch +mark :45 +author Grevious Bodily Harmsworth 1679083200 +0000 +committer Grevious Bodily Harmsworth 1679083200 +0000 +data 45 +Added file in branch this-is-a-closed-branch +from :43 +M 100644 :44 9d7dfd0ecce946dca320dd7826e5b9f97a0e9e79 + +commit refs/heads/this-is-a-closed-branch +mark :46 +author Grevious Bodily Harmsworth 1679086800 +0000 +committer Grevious Bodily Harmsworth 1679086800 +0000 +data 39 +Closing branch this-is-a-closed-branch +from :45 + diff --git a/t/smoke-test.t b/t/smoke-test.t index 0e0d206..d0678cb 100755 --- a/t/smoke-test.t +++ b/t/smoke-test.t @@ -108,6 +108,8 @@ commit_rest() { make-branch "_1" 17 && make-branch "Feature- 12V Vac \"Venom\"" 18 && make-branch "åäö" 19 && + make-branch "this-is-a-closed-branch" 20 && + close-branch "this-is-a-closed-branch" 21 && hg bookmark bm-for-the-rest ) @@ -121,6 +123,11 @@ make-branch() { hg commit -d "2023-03-17 $2:00Z" -m "Added file in branch $1" } +close-branch() { + hg branch "$1" + hg commit --close-branch -d "2023-03-17 $2:00Z" -m "Closing branch $1" +} + setup test_expect_success 'all in one' '