I'm quite new to mercurial so this might sound silly..
I am developing a PHP application locally and pushing changes to remote linux server. I have a hgweb.wsgi script publishing my repository which is accessible via url (hg.example.com/repository). Now I am wond开发者_StackOverflow社区ering what is the best way to automate deployment of the app to see it in action on the same server as repository? Obviously I can't just go to hg.example.com/repository since it just shows the web interface of the repository and not the app..You're mixing up two things which are not necessarily related:
- the path part of the URL of your repository, and
- the path of the actual repository on your server.
To get a better picture, consider we use SSH, not HTTP, for repository access. This means we probably specify the full path to the repo in the server file system within the path, e.g., to sync with my server in a similar setup, I push to ssh://example.com//var/www/wsgi/example.com
(I have a WSGI app, not a PHP one, but that's not important now). The app itself is available at http://example.com/, i.e., site root if /var/www/wsgi/example.com
.
Well now, nothing can prevent me to set up HTTP access to this repo using hgweb on a hg.example.com
subdomain, so the repo push path is http://hg.example.com/example.com
.
Thus:
- I push to
http://hg.example.com/example.com
(repo pulished at this URL) - The repo is located under
/var/www/wsgi/example.com
(server file system path) - This directory is in some way set up to be considered the site root by the web server
- Site root = http://example.com/
P.S. Don't forget about the changegroup hook Ton mentioned.
There are two things you'll need to do:
- Add a webserver that can serve PHP-pages (like apache) and let it serve the repository root (as always make sure it's save)
- Add a hook to the mercurial server for the changegroup hook. This hook can be as simple as: update.changegroup = hg up
That will update the working folder of the repository with the latest version.
精彩评论