Mercurial: get the latest head revision of a branch from a remote repo

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

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

The people running the script may have their own production change commands, rather than relying on the remote repo, and my server receives the code directly from the remote repo with read-only access. This is why I need to get the latest set of changes from a remote repo, but commit the tag locally.

I tried tricks like:

hg identify -i $(hg paths default)

  • This is great, but gives only tip rev, cannot define a branch

hg heads production

  • This is great again, it returns the last branch of the branch, but only from the local repo ..

Hope there is something else that I am missing and there is a way to get this revision ID of the remote branch.

+4
source share
2 answers

I think you are looking for:

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

This is using the #revision , which is described in hg help urls .

+3
source

As a result of the experiments, I was able to configure the answer above and make it one exec process instead of two (i.e. it skips hg paths default ) if this is important for you:

 hg identify --id --rev production default 

If you want a local revision for a specific branch (and not the current branch), use the following command:

 hg identify --id --rev production 

Where production is the desired branch.

+5
source

Source: https://habr.com/ru/post/1483479/


All Articles