Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get revision number without clone/pull

How can I just get the revision number of a mercurial repository, without using "pull", or, if possible, without cloning it from the server? Or if, as I guess, it's impossible, can I get the revision number without "update the files" ? An update like a "hg clone -U" ?

Thanks

like image 570
cooow Avatar asked Jun 22 '26 14:06

cooow


1 Answers

If you have access to the repository over the file system, you can use hg tip or hg log:

hg log -l 1 -R /path/to/repo

Otherwise you can go into any repository (maybe make an empty one for the purpose) and use hg in, telling it to run even though the repositories are unrelated:

hg init tmp
cd tmp
hg in -f -n -l 1 url-of-repo

The -f ("force") makes it work with an unrelated repo; -n means "newest revision first"; -l 1 limits the number of revisions printed to 1. The net effect is to print out the newest revision that's in the repo and not in your local one. Since there are no revisions in your local one, that just gives the newest revision.

like image 178
Peter Westlake Avatar answered Jun 26 '26 09:06

Peter Westlake



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!