You can show the local revision number of the working copy’s current parent using:
hg identify --num
Note that this outputs a + suffix when there are local changes. Add an -r . option to avoid this.
You can use the -r option to get the local revision number for other revisions too. For example, to retrieve the ID of the last tagged ancestor:
hg id -n -r "ancestors(.) and tag()"