How to quickly click with Mercurial

After changing my local repo, I hg commit -m <message> using hg commit -m <message> , then click on my server with hg push , and then on my server I update the working directory with hg update .

Is there a better way to do this?

+8
mercurial
source share
3 answers

The first two steps you described:

 hg commit -m <message> hg push 

required in accordance with the fact that commits are kept completely separate from the server in Mercurial (and most other DVCS). You can write a binding after commit to push after each commit, but this is not recommended as it prevents you from fixing simple errors during commit and before clicking.

Since you are trying to upgrade on a "server", I assume that you are running a version of the code in your repository on the server. I guess this is because, as a rule, the server will simply act as the main repository for you and your developers to access (as well as for backups, etc.) and does not need an explicit hg update .

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

hg pull <path to development repo> -u

which will pull from your local repo and then automatically update. Depending on your server configuration, it may be difficult to get the path to your local repo.

+8
source share

For the first part of the question (i.e., automatically press when you commit), you can use the trick described in this answer: mercurial automatic push on every commit .

If you want to automatically update the working directory, you can do this with a hook. Add this to the hgrc of your repository ( .hg/hgrc in your server directory):

 [hooks] changegroup = hg update >&2 

This will automatically update the working directory every time a push is made to this server. This hook is described in Mercurial Questions .

If you use these 2 solutions, the next time you make hg commit -m "message" , the commit will be automatically redirected to the remote server and the working directory on the server will be updated.

+6
source share

There is an extension called autosync that may seem useful to you:

This extension provides the autosync command, which automatically and continuously commits changes to the working copy, extracts (pulls, merges, commits) changes from another repository and redirects local changes back to another repository. Think of configuration files or to-do lists as examples for synchronizing things. At a higher level, the autosync command not only synchronizes repositories, but also working copies. The central repository (usually without a working copy) should be used as a synchronization center:

+2
source share

All Articles