tl;dr:
Use the COMMITTED alias instead of HEAD
Details:
The most direct way to get the revision at the "tip" of the current branch is to use the COMMITTED alias instead of HEAD (it's amazing that I wasn't aware of the COMMITTED alias for so long).
Git uses HEAD to refer to the tip of the current branch.
Subversion uses HEAD to refer to the tip of the entire repository - not the current branch for the workspace. Subversion uses the COMMITTED alias for that.
svn info shows both pieces of information:
C:>svn info
Path: .
Working Copy Root Path: --elided--
URL: svn:--elided--
Relative URL: ^--elided--
Repository Root: svn:--elided--
Repository UUID: dcba06d3-f740-481d-b6cf-80debfe3ba96
1) ---> Revision: 40018
Node Kind: directory
Schedule: normal
Last Changed Author: mike
2) ---> Last Changed Rev: 40013
Last Changed Date: 2022-06-15 08:06:48 -0700 (Wed, 15 Jun 2022)
- #1 is the tip of the repository
- #2 is the tip of the current workspace's branch
If you just want the commit ID:
C:>svn info -r HEAD --show-item revision
40018
C:>svn info -r COMMITTED --show-item revision
40013
And if you want the log information, note that asking for HEAD will give you nothing (unless HEAD == COMMITTED). Asking for COMMITTED will show exactly what you want:
C:>svn log -r HEAD
------------------------------------------------------------------------
C:>svn log -r COMMITTED
------------------------------------------------------------------------
r40013 | mike | 2022-06-15 08:06:48 -0700 (Wed, 15 Jun 2022) | 17 lines
-- remainder of log message elided --
------------------------------------------------------------------------
svnversion. Do asvn updateaftersvn commitandsvnversionis your friend