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?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With