Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial: get latest head revision of branch from remote repo

Tags:

mercurial

I am looking for simple solution for my deployment bash script.

Each run of this script should add tag to the latest revision on production branch, but of the remote repo.

People running the script might have own production changesets, not pushed to the remote repo, and my server is getting code directly from the remote repo with read-only access. This is why I need to get latest changeset from remote repo, but commit tag locally.

I tried tricks like:

hg identify -i $(hg paths default)

  • it's great, but gives only tip rev, cannot define branch

hg heads production

  • it's great again, returns latest branch head, but only from local repo..

Hope there is something else that I'm missing and there is a way to get that remote branch head revision id..

like image 836
s3m3n Avatar asked May 29 '13 23:05

s3m3n


2 Answers

Through experimentation, I was able to tweak the answer above and make it one process exec rather than two (i.e, it skips hg paths default), if that's important to you:

hg identify --id --rev production default

If you want the local revision for a specific branch (rather than current branch), then use:

hg identify --id --rev production

Where production is the branch you want.

like image 72
Dmitri Shuralyov Avatar answered Nov 03 '22 05:11

Dmitri Shuralyov


I think what you're looking for is:

hg identify --id $(hg paths default)#production

That's using the #revision specifier, which is described in hg help urls.

like image 32
Ry4an Brase Avatar answered Nov 03 '22 04:11

Ry4an Brase