Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the Mercurial Changeset ID from a revision number?

Tags:

mercurial

If I use hg grep I get a filename and a revision number. How can I transform these bits of information to a changeset identifier that I can use in other commands?

like image 428
Tom Ritter Avatar asked Dec 19 '25 04:12

Tom Ritter


1 Answers

You can use hg id or hg log:

$ hg id -r 100
526722d24ee5
$ hg log -r 100
changeset:   100:526722d24ee5
user:        [email protected]
date:        Fri May 13 17:48:10 2005 -0700
summary:     reorganize code into classes

But please note that you don't have to convert the revision number. All Mercurial commands that take a changeset ID also take a revision number. They're interchangeable, as explained in hg help revisions. This means that you can use a tag, a branch name, a bookmark, a revision number, or a changeset ID everywhere.

It is only if you need to communicate with other people that you really need the changeset IDs. The revision numbers are local and so my revision 100 can be different from your revision 100. So use the changeset ID in emails, bugtrackers, etc.

like image 101
Martin Geisler Avatar answered Dec 21 '25 11:12

Martin Geisler