"--rev x" also matches against the short node number

Matt Mackall mpm at selenic.com
Tue May 24 18:09:40 UTC 2011


On Tue, 2011-05-24 at 19:39 +0200, Jan Olsen wrote:
> Hi
> 
> When I make a "hg log --rev *x*", where *x* is a revision number, then I
> would have expected to only give me the log from exactly that revision
> number.
> It does however seem to also match against the short node number. The
> following all give the same result:
> 
> The-Big-Devil:test janpolsen$ *hg --version
> > *Mercurial Distributed SCM (version 1.8.3+20110502)
> 
> 
> 
> > The-Big-Devil:test janpolsen$ *hg log*
> > changeset:   0:72ab0071a9d7
> > tag:         tip

You have exactly one revision..

> > The-Big-Devil:test janpolsen$ *hg log -r7*
> > 'changeset:   0:72ab0071a9d7

..so this answer is an unambiguous match.

> If this behaviour is intentional, is there then a way where I can make sure
> it's only the revision number I look at and not the short node number?

This is rarely an issue in practice, but:

hg log -r 'rev(7)' <- match only revision 7
hg log -r 'id(7)' <- match only the changeset with the unambiguous
prefix 7

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list