DVCS with a Windows central repository - windows

We are currently using VSS for version control. Quite few of our developers are interested in a distributed model (And want to get rid of VSS). Our network is full of Windows machines and while our IT department has experience maintaining Linux machines they would prefer not to.
What DVCS systems can host their central repository on Windows while providing..
Push access to the repository.
Basic authentication. Mostly just a way to allow or deny access to the whole repository. No need for fine grained access.
Server process so users don't need write right to the repository reducing the risk of accidentally messing with it.
On the client side a GUI such as Tortoise would be more or less a requirement (Sorry, Windows shell sucks. :|). Ease of installation would be a huge plus as our IT department is already quite low on resources. And using windows credentials for authentication would be an advantage but not a requirement as long as the client is able to store the credentials.
I have had a (really) quick look at Git, Mercurial and Bazaar.
Git seemed to use ssh or simple WebDAV for repository access, requiring write permission for the users.
Mercurial had a built in http server, but this seemed to be only for pull purposes. Update: Mercurial supports push as well.
Bazaar Seemed to use sftp for repository access, again requiring a write permission for the users.
Are there windows server processes for any DVCS systems and has anyone managed to set one up in a Windows land?
And apologies if this is a duplicate question. I couldn't find one.
Update
Got Mercurial working for push purposes! Detailed list what was required can be found as an answer below.

Mercurial's almost certainly your easiest option on Windows.
If you didn't care about authentication, you actually can trivially allow hg serve to permit push. To do so, you merely need to add the following to the .hg/hgrc file in the repository you wish to serve:
[web]
allow_push = *
push_ssl = false
The first line says that anyone may push to this repository. The second tells Mercurial to allow pushing without SSL, since hg serve does not currently natively support HTTPS. At this point, users can push to your repository without having an account anywhere. If you're simply a small shop, that's probably fine--especially since you can use Mercurial's ability to sign changesets to guarantee a much higher level of verifiability than HTTP Basic will provide, anyway.
For a larger, shop, though, you'd be totally right in wanting at least a simple barrier for committing. To do that, you need to make two changes. First, you'll need to put Mercurial behind a web server with either reverse proxy support or CGI support. Thankfully, recent versions of IIS support both. You can consult the CGI directions in the Mercurial Redbook for Mercurial-specific steps, and Microsoft's guide to setting up CGI applications in IIS 6 for help on the IIS side.
Next, you'll need to set up some basic authentication. IIS provides HTTP Basic out-of-the-box, which, as a bonus, can authenticate directly against your domain, keeping administrative overhead to a minimum.
Finally, you'll want to change the allow_push line to support only specific users by specifying a comma-delimited list of user names. For example:
allow_push = benjamin, ted, the_cow
That's it. Mercurial will now allow push from users who can authenticate via HTTP Basic authentication, and allow pull from everyone else.

After Benjamin pointed out the HTTP serving CGI scripts I decided to try those out and managed to get a repository hosted over HTTP. The Redbook which Benjamin linked was of much help as were two Mercurial wiki articles. One which describes Mercurial publishing in general and another containing step by step instructions for setting up the HgWebDir CGI script.
These instructions weren't completely foolproof though so I had to poke around a bit. Most likely as I'm running 64bit Vista. The instructions below document what I did. Now that I've done it once I'd probably do things in another order so don't consider these step by step instructions.
Mercurial
First I acquired the Mercurial binary from http://mercurial.berkwood.com/ which got installed into d:\dev\Mercurial. I created a repository for testing under d:\dev\testRepo repository using hg init. The d:\dev\Mercurial\library.zip contains Mercurial library files required by the CGI script so they were extracted to d:\dev\Mercurial\library. Something which confused me at first is that when I opened the zip file I received an error message and saw no contents. Just extracting the file to a directory worked though.
For the web script, I downloaded Mercurial source which contained the hgwebdir.cgi which got moved and renamed to d:\dev\Mercurial\webroot\hgwebdir.py. The step by step article contains good instructions for modifying the hgwebdir script for Windows. They also contain instructions for hgweb.config which in my case ended up looking like this:
[paths]
/hg/hgwebdir.py/test = D:\dev\Mercurial\testRepo
Also the repository wanted the following config so I could push there without SSL. Note I am using Basic Authentication to authenticate users currently. I had to create the config in D:\dev\Mercurial\testRepo\.hg\hgrc and add the following lines to it:
[web]
allow_push = *
push_ssl = false
Python
The CGI script is a Python script so it requires Python. It's seems pretty picky on which Python version executes it. One of the articles mentioned that running it requires same version that was used to build the Mercurial. In the end I got it working on Python 2.5 x86 after trying Python 2.6 x64, Python 2.4, Python 2.5 x64.
IIS
Two things I missed and had to install were CGI support and Basic Authentication. Both of these were installed through Control Panel, Programs and Features. Once done with installation I created a virtual directory (Which I later changed to an Application) in IIS pointing to D:\dev\Mercurial\webroot. The virtual directory required an CGI handler for *.py files which could be added from Handler Mappings. The executable was D:\dev\SDKs\Python25_x86\Python.exe %s. Once IIS had permissions to the webroot directory I could navigate to http://localhost/hg/hgwebdir.py/test and see the repository.
So now the read access was working. When I tried pushing to the repository I received weird error messages telling me it wasn't a real repository.
After an hour of debugging I ended up copying the whole D:\dev\Mercurial\library\mercurial tree under webroot so that Python could find D:\dev\Mercurial\webroot\mercurial\hgweb\hgwebdir_mod.pyc. After this Wireshark was reportting Access Denied errors in the stack trace. No idea what the real reason to this was but changing the virtual directory into an Application in IIS and moving it on top of an application pool which ran using Local System account the access denied errors went away.
Also at some point I gave HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters registry key more permissions so IIS could access it. Doubt that it requires these after using Local System account.
Once these were done pushing stuff to the repository using hg push http://localhost/hg/hgwebdir.cgi/test was working!
Problems and solutions
Where to find the library files.
They were in the library.dll under Mercurial installation folder. I just had to extract them even if my unzip program refused to view me its contents.
How to get the Python script to run
Download the correct Python version for x86 architecture as the script uses some x86 libraries. The correct Python version depends on the Mercurial version. For 1.2.1 it was Python 2.5 x86.
Alternatively you could try building Mercurial from sources with whatever Python version you want but in my case this failed when building extensions.
How to set CGI up in IIS
First make sure CGI is installed in IIS. This wasn't assumed to be true in the IIS instructions Benjamin posted.
Create a new Module Mapping for *.py in IIS Handler Mappings. The correct Module is CgiModule and the executable is your Python executable + %s
How to allow the CGI script to write to the repository
Make sure the script has everything it requires. I had to move the library\mercurial\hgweb\hgwebdir_mod.pyc to another place.
Make sure the script has permissions to everywhere it wants. I solved this by Creating a new Application Pool for the CGI script that used Local System account, converting the Virtual Directory to an Application in IIS and selecting the new Application Pool.

After reading Mikko's Answer which almost worked for me, I came up with my own notes for installation. My setup was designed to be a "non protected and open" repository that members of my team could use installed on a Windows 2008 Server.
1. Install Python.
The version of Python I used was Python 2.6.2 and I used the Windows x86 MSI Installer.
Install for all Users.
Install to C:\Mercurial\Python
Use Default Feature Options.
2. Install MinGW.
The version of Minimalist GNU for Windows I used was MinGW 5.1.4
Install the MinGW-5.1.4.exe.
Choose the Download and Install Option.
Choose the Current Package Option to Install.
For the Components to Install Select the "Minimal" option.
Install to C:\Mercurial\MinGW
3. Modify your path.
You need to add in locations to your environmental path at this point.
Add 'C:\Mercurial\Python26;C:\Mercurial\MinGW\bin' to the path (Order Matters.)
4. Install Mercurial.
The version of mercurial that I used was the latest release in the stable branch and I did not use the binaries, but used the source code. I wanted to compile mercurial myself so that it would work with whatever version of Python I had installed so I didn't have to worry about any compatability issues which I found to be the biggest challenge with other install methods. The easist way to get the source is by downloading the "zip" file.
Mercurial Stable Release
Extract Zip File to C:\Mercurial\Source.
Build the Source at command prompt.
python setup.py build --force -c mingw32
python setup.py install --force --skip-build
5. Modify your path.
You need to insert into your environmental path another location for the 'hg' command.
Add 'C:\Mercurial\Python26\Scripts;C:\Mercurial\Python26;C:\Mercurial\MinGW\bin' to the path (Order Matters.)
6. Create your Config file.
You need to have a default user name set if your going to do any commits locally on this server.
Create file '"C:\Documents and Settings{username}.hgrc"'
[ui]
editor = Notepad
username = your_name
6. Test your Install.
Open up a new command window and test with 'hg debuginstall' to validate. You should see something like the following.
Checking encoding (cp1252)...
Checking extensions...
Checking templates...
Checking patch...
Checking commit editor...
Checking username...
No problems detected
7. Setup Web Directory.
Create Directory 'C:\Mercurial\Web'
Copy the hgwebdir.cgi file from the 'C:\Mercurial\Source' to 'C:\Mercurial\Web'
8. Configure IIS7 for Centralized Repository.
I used the DefaultAppPool which is using .Net 2.0, Pipeline=Integrated, Identity = ApplicationPoolIdentity.
Ensure CGI features are available in IIS7.
Control Panel/Programs/Windows Features/IIS/App Development Features/CGI
Add App into IIS on the Website you wish.
Alias=Mercurial -- Physical Path=C:\Mercurial\Web
On the App select HTTP Modules and add a new Module Mapping.
Request Path=*.cgi, Module=CgiModule, Executable=C:\Mercurial\Python26\python.exe %s, Name=Mercurial.
When Prompted to add entry to ISAPI and CGI restrictions list say yes.
9. Test your Web Setup.
You should now be able to browse http://localhost/Mercurial/hgwebdir.cgi and see and empty repository list.
10. Configure IIS7 for Friendly URL
I did not like having the unfriendly URL and this step allows us to remap the URL to something more friendly. Install the URL Rewrite Moduel 1.1 Extension for IIS.
On the Mercurial IIS Application in IIS Manager featurs View select URL Rewrite Component and install a new Rule.
Choose Add Rules, then the Template 'Rule with rewrite map.' Rule Action=Rewrite, Specify Rewrite Map=Mercurial
Add a mapping Entry. OriginalValue='/Mercurial/Repo', New Value='/Mercurial/hgwebdir.cgi'
11. Create Mercurial Repository
You can now create a test repository.
Create a Directory C:\Mercurial\Repository and ensure IUSR account has the permissions to write to the directory. (If on Domain account is more like IUSR_{ComputerName}.
Create file C:\Mercurial\Web\hgweb.config to list the repositories.
[paths]
/ = C:\Mercurial\Repository\**
Add a directory C:\Mercurial\Repository\Test and initialize the repository with 'hg init'
** If you want now to be able to push without ssl create in the .hg directory of the repository a hgrc file the following lines.
[web]
allow_push = *
push_ssl = false
References:
Mercurial Wiki Windows Install
HG Book
Step by Step
Publishing Mercurial Repositories

For a team taking the first step away from VSS I would have suggested using SubVersion for source control and either TortoiseSVN or VisualSVN for the client.
But if the team has made the decision to switch to a DVCS then I'd suggest Mercurial because of it's better support for HTTP and windows on the client via TortoiseHg.

If you're looking for:
Distributed development support
Run Windows servers seamlessly
And a great GUI
You're exactly describing Plastic SCM

Excuse my necroposting and shameless self-promotion, but I've just released an alpha version of HgLab, which is a Mercurial Server for Windows with full pull-push support and Active Directory integration.

SCM-agnostic (to some degree) Windows-solution with Repository-frontent and management today may be SCM-Manager (Git, Mercurial, SVN repo out of a box with a single requirement of JVM)

Related

How to install jenkins under current user (not 'jenkins') on MAC OS X

I have configured MAC OS X environment (SDKs, licenses, etc) under current user for build server and would like to reuse all the settings by a build agent. Jenkins was chosen as a good option but for some reason during installation it created a new user jenkins and launch the app under it, causing the environment setup to be not accessible (no SDKs, no licenses are found anymore).
Is it possible to install jenkins under current user?
Probably it could be installed under jenkins but then launched under current user?
Any other good options for me to consider are appreciated.
Try this: http://www.sailmaker.co.uk/blog/2013/04/02/advanced-jenkins-for-ios-and-mac/#Installing-Jenkins-itself
I’m also going to recommend installing Jenkins via Homebrew, to avoid
some nonsense in Jenkins’ own installer whereby it puts itself in
/Users/Shared/. You really don’t want that.
If you're free to reinstall however you'd like, I'd recommend re-installing as the user you want to use, using whatever type of install you prefer, and then simply copy over the old Jenkins data directory to the new installation's location, and then changing the permissions in that directory.
That is to say, the directory containing the config, plugin and job information (it may be something like /usr/lib/jenkins, but could vary).
Then, chown -R the data directory using the user:group info you want to use so Jenkins has access to the files.
I have used this type of method in the past to transfer all the data from one install to another totally separate install on the same box, and it has worked well (one could use this method to transfer the data to an install on another box, as well).
Note: I would highly recommend making a full backup of the data directory before doing this, in case anything goes awry.

Cross-platform SVN issues, please explain

I am a Mac-based (10.8) web developer, trying to work with other Windows-based developers. They are using SVN, although most of them do not check out files to local repositories. They mostly edit the file on the local server via Explorer, and then use TortoiseSVN shell enhancement to right-click and "commit" what they just edited.
I cannot seem to do this, as my preferred SVN tool Versions (as well as Dreamweaver CS6) require access with the SVN, HTTP, etc. protocols. I get errors trying to use the file system.
So, I am trying the command line, navigating to the file I need to edit, open it, edit, save. I can run svn status on the directory and I see the file status as "M". If I try svn commit -m "updated" myflie.css or similar, I get an error:
svn: Unable to open an ra_local session to URL
svn: Local URL 'file://webstage-01/svn/repository/fc-dev/assets/css' contains unsupported hostname
I looked in the .svn folder "entries" file an see this:
10
dir
20788
file://webstage-01/svn/repository/fc-dev/assets/css
file://webstage-01/svn/repository
2012-06-26T16:08:10.220007Z
20747
JSmith
So it looks like that's where it's getting the path from, which is not a valid MacOS or Unix path.
Suggestions?
It sounds like the local server is already a checked out working directory that everyone is sharing. This is the completely wrong and awful way to do Subversion. In the end, you have no idea who is making the change because they're all using the same client. Plus, there's no guarantee that working clients use the same format of the working directory. If someone has a version 1.6 TortoiseSVN on their system, they could damage that working copy.
The correct way is for everyone to checkout a local copy of what's in that Subversion repository to their local machine (Windows or Mac), and then do their changes there and check it in. You won't have the issue of someone messing up that directory. You know who is making the changes. You won't have an issue of what happens if two people try to make the same changes at the same time. It's the way Subversion is suppose to work.
The Mac has the Subversion command line client. (Assuming you're using Mountain Lion -- the latest release) You need to install XCode (free from the Mac App store), and then in XCode, install the command line tools. Look at the on line Subversion manual and learn how to do the checkout in Subversion, create your own working directory, and check in from that.
There are many options if you want a Mac OS X GUI Subversion client. I highly recommend you look at Pathfinder](http://cocoatech.com/pathfinder/). It has a built in Subversion GUI client, but it also has many Finder enhancements that make it an excellent Finder replacement -- especially for power users. It's $40, but I think it's worth it just for the built in Terminal client.
I don't think you can do that. The svn folders on "local server" were created by a platform-specific tool like TortoiseSVN on Windows. Obviously it will have paths, etc. specific to Windows. You will need to checkout separately and make commits.
Also, BTW, set the EOL property to 'native' so that you do not run into cross-platform EOL issues.

How can I setup a simple Mercurial back-up solution from a workstation to server?

First, a confession. In about 10 years of professional development, I've never used a source control system. There, that feels better. My historical setup (as recommended by management, ha!) has been to create dated folders on a server and copy-and-paste my data into it each evening.
I've known for a long time that a much better, manageable solution would be to use git or Mercurial to manage my source but I've never taken the time to learn any of these new tools because myold system has always worked well enough for my needs as the lone developer for every project I've ever worked on.
I have finally change this setup. I've installed Mercurial on my Mac, which after a bit of reading, I prefer over git. As a GUI front-end, I have installed SourceTree which appears to be easy to use and quite friendly. The problem I am having is that I can't find a very simple, straight-forward walkthrough for setting up a server repository that I use for pushing changes to each evening. I'm sure it's there, I just can't find it.
I've honestly tried to Google this, but there is something about the term "SourceTree". I can't find anything useful because half of the information I find is in regards to using git and it tends to involve pushing a project to a site like github.com, which is not pertinent in my case.
Additionally, I have skimmed the Mercurial documentation and I still may not be entirely clear about the full commit/update/push/pull/branch/merge concept. I just want to get something setup rather fast that will back-up and track the changes of my projects, without having to be a source control guru.
How do I setup a simple repository on a Windows network server, and push and pull changes each evening? My company want me to store my data in a personal folder, on a network share that is backed up to tape and is then stored off site.
I'm sure it has to be simple. I just want to be sure that I'm doing it correctly so that in the case that I need to access a back up, it is there and can be easily pulled... or branched.. or whatever.
Well, it depends on the kind of the server you are going to use.
Let's assume it's not a Windows server (just a guess, as you're a Mac user). Let's also assume that right now you only need it for yourself, not for a bunch of users.
Then the simplest way is to use SSH. Suppose the server is server, and you have an account rlh there. You'll need to have a public/private key pair for a seamless access (no need to enter the password on each pull/push). You'll need to install Mercurial on the server as well, obviously.
On the server, create a repo (in your home dir, for example):
rlh#mac$ ssh server
rlh#server$ mkdir myproject
rlh#server$ cd myproject
rlh#server$ hg init
On your machine, clone the repo:
rlh#mac$ hg clone ssh://rlh#server/myproject myproject
The default target will be set automatically, and you should be able to pull/push with no additional configuration.
Feel free to ask if you have a question regarding this.
When searching for hosting solutions, best not to include the term SourceTree in your query — SourceTree is just a front-end tool that is in principle unrelated to Mercurial hosting. That might explain the lack of useful information.
Here is an overview of ways to set up Mercurial servers:
https://www.mercurial-scm.org/wiki/PublishingRepositories
Personally I’m using plain hgweb and that has served me well.
Also I would recommend to consider using a hosting service such as BitBucket or Google Code. It requires much less effort to set up and maintain. Here is an overview of Mercurial hosting services:
https://www.mercurial-scm.org/wiki/MercurialHosting
Personally I’m also considering moving my self-hosted Mercurial repositories over to BitBucket, because of reduced maintenance overhead, and also it has functionality like bug tracker, wiki etc.

Development on two computers

I would like to have a desktop PC and a laptop available for development. I am using XAMPP on the desktop which I use as my main workstation, however I'd like to just change location and be able to continue working on the laptop. It seems that it is possible to move the /htdocs folder to Dropbox so the XAMPP instances on both devices would use the same shared folder. That would be a part-solution, what about the question of databases, how would I go about that? I'm sure there are others who work in a similar fashion, so I'd like some pointers on how to set this up properly. Thanks
Your best bet is to set up version control. Given that you seem to assume you will basically always be networked, you might like to use github or bitbucket to create your "central" repository, and use your favourite DVCS to push changes between the repositories.
Conceptually the simplest, although perhaps not the best, depending on how you like to develop is to push all changes through the "master", and have both of your computers pull from there. Using mercurial or git, you can also push directly between the repositories on both of your computers.
I use bitbucket because it offers free, private repositories (github is free, but the free version only allows public repositories).
This also gives you the advantage of an offsite backup.
Try using a SVN or CVS solution...
You can use a development environment which is virtulized and have a high availability.
There are some virtualization services like (amazon, Microsoft) which you can utilize (They are paid services) .
If viruilization is not possible, you might want to maintain the scripts for the database in a version control tool . So when you switch commit the database changes in the version control tool , rerun the database scrips on the laptop to upgrade the database with latest information.
Also same thing applies for HTTP files.
If the database creation script is out of question you might want to create a database snapshot with raw datafile , which should be checked in into version control tool before switch and checkout on the other machine . Refer following link on which files you want to check-in into version control tool.
http://dev.mysql.com/doc/refman/5.0/en/replication-howto-rawdata.html
You could include a virtual machine in your Dropbox folder. This way you can encapsulate your development environment in a single file and take it with you wherever you want.
I have done that with an Ubuntu VM and never had a problem.

How can I publish a subversion repository to a local IIS?

At work, we have a windows server 2003 with IIS and Subversion installed. We use it to publish and test locally
our ASP.NET websites. Every programmer has Tortoise installed on his PC and can update/commit content to the server. Hosting the repositories is working fine.
But the files kept in those repositories needs then to be copied to our local IIS (virtual directories).
What is an easy way to publish those subversion repositories to our local IIS?
Edit:
Thanks to puetzk I added a simple bat file that gets executed every time a commit occurs (check the subversion documentation about hooks). My bat file only contains:
echo off
setlocal
:: Localize the working copy where IIS points)
pushd E:\wwwroot\yourapp\trunk
:: Update your working copy
svn update
endlocal
exit
Just keep the web server's file area as a working copy, and perform an svn up in it whenever you want to "publish". Configure it to hide the contents of the .svn folders if they seem untidy to you (I don't specifically know how to do this, but I assume it can be done). They will already have the filesystem hidden bit, which may take care of this.
If you want it really automatic (updates as soon as someone commits), use a post-commit hook script on the SVN server to kick off the first process.
Others in the comments have suggested using export instead of checkout. That can work too, and avoids the .svn clutter, but has two drawbacks. One, it has to redownload the entire contents every time, not just the modified files (since it didn't keep the .svn dir to remember what it has). If you have a lot of files, this will be much slower. Two, update replaces the file atomically (writes the new version in .svn/tmp, then moves it into place). Export writes the file gradually into it's destination as it downloads. That means export could deliver an incomplete file to someone who browsed it at just the wrong time.
SVN doesn't support IIS; you can however run the standalone svnserve server as a windows service.
There's the SVN FAQ entry about it, and this blog post on Vertigo Software blog may be helpful too.
UPDATE:
After your clarification, I see that what you are looking for is a way to automatically update the code on the server after it's checked in. Look into CruiseControl.NET, after looking at the subversion integration tutorial it looks like it should do what you want.
UPDATE 2: This tutorial describes integrating Subversion, CruiseControl.NET and Nant.
maybe SVNIsapi can solve the problem (http://www.svnisapi.com). Cause it only utilizes an IIS installation, therefore you don't need an APACHE server or an SVNSERVER service. Secondly it should be possible to stack the ASP.NET ISAPI plugin onto the processing of SVNISAPI, so that a ASP.NET (.aspx) page will interpreted after read from the repository.
Cheers
Paolo
Use can use the free Visual-SVN Server to quickly install Subversion with Apache front end. It also have a nice MMC snap-in for managing the server and repositories.
You will than be able to access subversion with HTTP or HTTPS, but the port number must be different from the one your local IIS uses (default port for Visual-SVN server is 8080).
If you really need to access the repositories using your local IIS port 80, you can try SVN-IIS which acts as a bridge between your IIS and Apache. I haven't tried this one myself though.

Resources