Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a quick push with Mercurial

Tags:

mercurial

After a change in my local repo, I commit with hg commit -m <message>, then I push to my server with hg push, then in my server I update working dir with hg update.

Is there a better way to do this?

like image 234
Fred Collins Avatar asked May 26 '11 01:05

Fred Collins


People also ask

How do you pull in Mercurial?

Pull changes from the Mercurial upstream (Pull)From the main menu, choose Hg | Mercurial | Pull. Specify the required URL address of the source remote repository.

What does hg pull do?

hg pull copies changes from a remote repository to a local repository. hg clone copies a remote repository to create a local repository with a remote called default automatically set up.


1 Answers

The first two steps you have described:

hg commit -m <message>
hg push

are required as per the fact that commits are kept completely separate from the server in Mercurial (and most other DVCS as well). You could write a post-commit hook to perform the push after each commit, but this is not advised because it prevents you from correcting simple mistakes during the commit and before the push.

Because you're trying to perform an update on 'the server' I'm assuming you are executing a version of the code in your repository on the server. I'm assuming this because typically the server would simply act as a master repository for you and your developers to access (and also to be subject to backups, etc..), and would not need the explicit hg update.

Assuming you are executing code on the server, you can try and replace the push and the update with this command:

hg pull <path to development repo> -u

which will perform a pull from your local repo and then an automatic update. Depending on your server configuration, it might be difficult to get the path to your local repo.

like image 69
dls Avatar answered Jan 03 '23 18:01

dls