How to configure mercury to deploy only website folder
I have a website that I want to deploy to a DEV and UAT client environment, the site is part of a mercury repo - it is in the Website folder at the same level as the .hg folder. I know that I can push the entire repository, but is likely to be placed only site folder to the client does not have any other files and folders.
The repo looks like this:
- Project root
- Database (SQL Source Control uses this)
- Documentation (All specifications, PDFs, artwork, etc.).
- Lib (pre-nuget third party dlls)
- packages (Nuget stuff)
- Website (this is the only area I want to expand)
Edit: The client servers are not directly connected to the internet, my access to them is via vpn and then RDP. Currently, in order to deploy any changes, I need to pin the site, put it on a shared ftp server, and then wait up to 3 days for the files to be copied to the servers. The rules are set up so that I can use Mercurial over this connection.
Edit 2 I was able to create a subreport from the Website folder, forgetting the Website folder and all the content, committing a change and then checking in the files by creating a repo and then undoing the .hgsub file. Locally this works for me, I can clone from the site repository without any extra folders. However, I was unable to use this version of the repo, even if I repeat the process on our repo server. When I try to clone the hosted version to my local working copy, I get 404 errors, but I can clone the hosted version on the hosting server.
I would appreciate some step-by-step instructions (dummy guide if you like) on how to achieve my goal; which should only push the site folder to client servers. The main copy of the repo is on our repo server, I have a local clone and you should be able to push versions from my copy.
Edit 3 Turns out the problem I was converting the folder to subreport as described at http://mercurial.aragost.com/kick-start/en/subrepositories/#converting-folder-into-a-subrepository was that the convert command in versions after 2.1. 0 is broken and still broken in 2.3.1. After I figured it out and went back to this version of TortoiseHg I was able to convert the folder to a subrepo, in the root of the repo I have a .hgsub that says Website = Website. I was able to work with this locally, commit the entire repo, subrepo, clone either the full repo or the subrepo (which is what I want) , but I cannot get this to work from our master repo server .
I pinned the whole thing and got to our remote repo server and then configured it so I could clone it. Directly on the server, this works fine (hg clone --verbose - C: \ Repositories \ EM.), However, when I try to clone from the server to the local development machine with (hg clone --verbose - https://myserver.com / hg / EM / .) with the error "HTTP Error: 404 (Not Found)".
requesting all changes adding changesets adding manifests adding file changes added 628 changesets with 6002 changes to 4326 files updating to branch default resolving manifests calling hook preupdate.eol: <function preupdate at 0x00000000035204A8> getting .hgignore getting .hgsub getting .hgsubstate HTTP Error: 404 (Not Found) returned code 255 Fri Apr 20 10:51:23 2012]
I don't know what is the problem, the files are there, so why 404?
source to share
I have a working solution. I created a batch file that creates an outbound repo and starts the embedded server, so I can retrieve it from the client machines. First it cleans up the previous folder, then it clones from my local working copy (there is a parameter to determine which tag it should clone to). Then it creates a map file and converts the website folder to the new Website2 folder to keep the history, then get rid of the original folder and rename the new one. Finally, it spins up the embedded server.
cd c:\inetpub\wwwroot rd /S /Q _ProjectName hg clone -- C:\inetpub\wwwroot\ProjectName#%1 C:\inetpub\wwwroot\_ProjectName cd c:\inetpub\wwwroot\_ProjectName echo include Website > map.txt echo rename Website . >> map.txt hg --config extensions.hgext.convert= convert --filemap map.txt . Website2 cd Website2 hg update cd .. hg remove Website/* hg commit -m "Removed Website" rename Website2 Website hg serve
So it's ugly, but now I just need to call the batch file and pass the tag that I want to build the outgoing website (uat, dev, etc.) and give it a minute to create my site folder, with history, which I can use to pull out or push away. I don't need to call the hg service because I know the names of the client servers, so I can pull the changes out of it by creating aliased remote repositories. But I included this step so that client machines can pull. I haven't fully explored this option, so I'm not sure if it has any particular advantage. This is great for when I'm the only one working on a project, but if any other developer needs to work on this, the Uri for the local project server will obviously be different (http: // SIMON-PC: 8000 / won't be for all),and in this case, the push to the customer may be the best.
But using this approach, I don't need to change my local working repo, and so I don't get any issues with our central repo, 404 errors mentioned in edit3. I keep the entire history of the repo with the conversion process, so the next time I need to submit changes, I don't start from version 1, in other words, it doesn't destroy the website, and although I delete the entire outgoing repo (_ProjectName) every time. when I save history and still be able to pull / push ONLY the site directory because it is created every time as an "offline" repo
source to share
In my opinion, Mercurial should not be used for this purpose. This is especially true if the website is a web application, because you shouldn't have a DLL in Mercurial.
You should have a look at the website deployment tool built into Visual Studio. Check out this page to see if it suits your purpose.
If you cannot install the required services on the destination server, then FTP can be configured instead.
source to share
As others have pointed out, you cannot use push for this. Just do "rsync" from your server to yours. You can even automate this on the hook where you push to a local repository and automatically deploy them to your site. Something like:
[hooks] changegroup.deploy = $HG update ; rsync Website account@theirserver:/path/to/docroot
source to share