If there is no branch matching regex then nothing is returned: $ hg log --rev "branch('re:unknown')" ; echo $? 0 However for unknown tag error is reported: $ hg log --rev "tag('re:unknown')" ; echo $? abort: no tags exist that match 'unknown' 255 I would expect that in case no tags are matching revset no revision is reported and no error code is returned.
I would expect the same thing.
Your objection make senses.
Adding Simon, who touched this last.
Here is the current behaviour for various cases: "Classic" lookups: $: hg log -r 'tag("nonexistent")'; echo $? abort: tag 'nonexistent' does not exist 255 $: hg log -r 'branch("nonexistent")'; echo $? abort: unknown revision 'nonexistent'! 255 Explicit "literal" lookups: $: hg log -r 'tag("literal:nonexistent")'; echo $? abort: tag 'nonexistent' does not exist 255 $: hg log -r 'branch("literal:nonexistent")'; echo $? abort: unknown revision 'literal:nonexistent'! 255 Regex lookups: $: hg log -r 'tag("re:nonexistent")'; echo $? abort: no tags exist that match 'nonexistent' 255 $: hg log -r 'branch("re:nonexistent")'; echo $? 0 You are asking that the tag/regex case be changed to be like the branch/regex case. I don't feel strongly either way but it could be argued that making the branch/regex case fail like the others would be more consistent. For completeness, here is the behaviour of other regex-accepting rev sets: $: hg log -r 'bookmark("nonexistent")'; echo $? abort: bookmark 'nonexistent' does not exist 255 $: hg log -r 'bookmark("re:nonexistent")'; echo $? abort: no bookmarks exist that match 'nonexistent' 255 $: hg log -r 'bookmark("literal:nonexistent")'; echo $? abort: bookmark 'literal:nonexistent' does not exist 255 $: hg log -r 'extra("source", "nonexistent")'; echo $? 0 $: hg log -r 'extra("source", "re:nonexistent")'; echo $? 0 $: hg log -r 'user("nonexistent")'; echo $? 0 $: hg log -r 'user("re:nonexistent")'; echo $? 0 $: hg log -r 'grep("really-nonexistent")'; echo $? 0 As a side note, the error message in the branch/literal and bookmark/literal cases probably shouldn't include the "literal:" prefix. I'm happy to have a go at fixing this, as long as someone confirms that this is the behaviour you want: when the tag, branch and bookmark revset expressions are given a pattern that doesn't match anything, they should return the empty set without raising an error.
Fix is in crew: http://hg.intevation.org/mercurial/crew/rev/9e39a717a23e
Fixed by 9e39a717a23e, released in 2.6