问题
Up until now, we've all been hosting our mercurial repositories and pulling directly from each other with hg serve. After code is reviewed, QA pushes it to our webdev server, which functions as the staging environment. The (php web) application is tested once again there before it goes to production.
Hg serve is not always reliable (like when the server you want to pull from isnt running!), so we are thinking to switch to code hosting (ie BitBucket). So, we would all have our own accounts there, and the webdev server would have an account as well... But, after QA pushes to the webdev repo, how do the changes make it back to the physical webdev server? Does someone log in to the server to pull them? That doesn't sound right...
The alternative I had is the webdev server repo not being hosted at all, and QA pushing directly to the server with ssh - Is this what people do?
I'm a beginner here, so feel free to correct any wrong assumptions, and I really appreciate your assistance!
回答1:
Your setup sounds fine. To get the code from your host to your server, you can either
Periodically poll the repository. Simply running
hg pull --update
every 10 minutes will work. This is quite cheap since Mercurial will quickly determine when there's nothing new to pull.Trigger a pull from the hosting site. Many sites (including Bitbucket) let's you run some action when a changeset is pushed to the site. Bitbucket calls these actions "services".
They offer integration with many online tools and they also have a generic POST service which you can use. when you enable it, Bitbucket will simply contact a web address of your choice when a changeset is pushed. You should then create a script at that location that will run
hg pull --update
on your server when the script is invoked.
来源:https://stackoverflow.com/questions/8969825/how-does-code-hosting-work-with-a-staging-environment