The simplest and clean way to do that (actually svn 1.9, released 2015) is using:
svn info --show -item revision [--no-newline] [SVNURL/SVNPATH]
The output is the number of the last revision (joungest) for the SVNURL,
or the number of the current revision of the working copy of SVNPATH.
The --no-newline
is optional, instructs svn
not to emit a cosmetic newline (\n
) after the value, if you need minimal output (only the revision number).
See: https://subversion.apache.org/docs/release-notes/1.9.html#svn-info-item