changeset 49618:3adca6eb6659 stable

commit: properly consider file include and exclude options when closing branch It looks like this is meant to prevent adding another commit that does nothing but close a branch on top of a commit that already closed the branch. The matcher building functions want `Dict[bytes, Any]`, not `Dict[str, Any]`, which was found by adding type hints to the matcher related methods in scmutil.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 18 Nov 2022 13:43:03 -0500
parents 7ddbb3623a07
children 302dd8ae2745
files mercurial/commands.py tests/test-branches.t
diffstat 2 files changed, 5 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Nov 18 14:03:56 2022 -0500
+++ b/mercurial/commands.py	Fri Nov 18 13:43:03 2022 -0500
@@ -2114,7 +2114,9 @@
         if repo[b'.'].closesbranch():
             # Not ideal, but let us do an extra status early to prevent early
             # bail out.
-            matcher = scmutil.match(repo[None], pats, opts)
+            matcher = scmutil.match(
+                repo[None], pats, pycompat.byteskwargs(opts)
+            )
             s = repo.status(match=matcher)
             if s.modified or s.added or s.removed:
                 bheads = repo.branchheads(branch, closed=True)
--- a/tests/test-branches.t	Fri Nov 18 14:03:56 2022 -0500
+++ b/tests/test-branches.t	Fri Nov 18 13:43:03 2022 -0500
@@ -293,23 +293,9 @@
   $ hg commit -d '9 0' --close-branch -m 're-closing this branch' b
 
   $ echo baz > b
-  $ hg log -r .
-  changeset:   14:acc63dd7207f
-  branch:      b
-  tag:         tip
-  user:        test
-  date:        Thu Jan 01 00:00:09 1970 +0000
-  summary:     re-closing this branch
-  
   $ hg commit -d '9 0' --close-branch -m 'empty re-closing this branch' -X b
-  $ hg log -r .
-  changeset:   15:3c41ebd8ea8b
-  branch:      b
-  tag:         tip
-  user:        test
-  date:        Thu Jan 01 00:00:09 1970 +0000
-  summary:     empty re-closing this branch
-  
+  abort: current revision is already a branch closing head
+  [10]
   $ hg revert b
 
   $ hg debugstrip --rev 13: --no-backup