views:

236

answers:

7

Is it a best practice to have my local source tree mirror the server source tree? It seems to me that it should, however my department at work does not do it that way and I find it very confusing. If not, what are scenarios where it makes sense to deviate from the server source tree?

EDIT: To clarify what I mean - say the source directory we want to map on the local machine is here on the server:

\\TeamServer\Project\Releases\2008

On our local machine, that directory would be mapped like this:

D:\2008_Releases

instead of:

D:\Project\Releases\2008

+4  A: 

I don't know if it's a best practice but I prefer mirroring the source tree too. It's one less "gotcha" in terms of getting a new developer up and running. Not mirroring the source tree can eventually come back to bite you when it comes to relative paths.

Someone probably made a mistake when they set things up originally and it never got corrected. IMHO it's a minor annoyance; just one of the side effects of not living in a perfect world ;)

Arnshea
A: 

There is one reason not to do this: When you have access to the production machine. In this case, I prefer to have different paths. This makes it more likely that I notice my "rm -rf" is on the wrong box...

Aaron Digulla
+1  A: 

I prefer to have individual project/release pairs in their own directories as close to root as reasonably possible. It's a horrible PITA to go clickety-click on directory tree or having to type the "c:\project\releases\2008" -part for the umpteenth time.

I also think checking out sources to different path tends to flush out bugged assumptions about project locations (we have postbuild events that do some nasty things).

Pasi Savolainen
+2  A: 

If your local tree needs to be at the same path as it is on the server, then you can't have multiple copies checked out. At the last two places I've worked, it was common for me to have several copies of (parts of) the tree checked out at any given time, depending on how many different bugs or features I was working on, and how many branches of the product the bugs or features were in.

Personally, I have no idea where the source trees were stored on the servers, and I didn't need to. I just ran cvs co or svn co to get a copy of the tree in my working directory. As long as I ran make or ant somewhere in the source tree, everything below it would compile.

Rob Kennedy
If you require multiple copies checked out, wouldn't the correct way to do it be to create a branch? I always thought that was what branching was for, so at some point it could be merged back in. If you have several different copies, how do you keep track of what is what?
JimDaniel
If I'm fixing a bug in 2.4, I check out code for the 2.4 tag to fix it there and send the customer a patch. Then merge to 2.x branch tip and 3.x branch tip to fix for future general releases. (We maintain both in parallel.) Can't check out all 3 in the same place. CVS branches don't work that way.
Rob Kennedy
Thanks for the explanation. Sounds like you have a good system in place.
JimDaniel
A: 

i think mirrowing is a good practise and i like to do it so too, however i have an extra temp folder for the case i need to checkout a fresh version for e.g. to test something with the current version or to fix a bug which has a high priority then what im doing atm.

kukudas
Just curious - what are you using for source control? One of my developers was still doing this recently, even though shelving allowed for him to do this without having to manually copy to another folder.
joseph.ferris
we use subversion as source control management and tortoise as client.
kukudas
A: 

The most important thing is to understand why the choice was made and use the team to determine if this is something that you would want to change. Team buying is important for these kind of decisions - and the team is more than just the developers. Source control trees contain things such as documentation, tests, resources, etc., so there is a legitimate chance that the structure was determined by multiple parties to find a common ground.

We use TFS where I work, as well. We do have a common root folder called C:\Source Control that is the main folder that all Team Projects live under. This choice was made because of the extreme dislike, by all parties, that the drive would get cluttered with various folders.

With TFS, you have the option to map multiple workspaces, so what you do on your local machine is not dictated by the structure on the server. My personal preference, and my team's preference, as well, is to use a single workspace mapping to the source control root. Given the shelving functionality in TFS, there is not a concern about having multiple copies checked out, since they can be shelved if something else needs to be worked on.

The build server has the same mapping, as well. This in no way, however, matches the deployment structure. Builds are dropped based upon the criteria of the project. The only time this presents a problem is when absolute paths are used, in configuration files, for example. Since we are not using absolute paths (by definition in our developer guidelines) this is a non-issue.

joseph.ferris
A: 

People have different opinions on how to organize their hard disks, why should you enforce a particular layout?

One should be able to check out multiple working copies of the same project in the repository - impossible if you insist using the same hierarchy.

In one large project I worked on, literally thousands of files assumed that the working copy was in a fixed absolute hard-coded path (\projectname). To work with several branches of the project, we had to resort to using different drive letters (on Windows), meaning that we had to divide our hard disks into many partitons (6 or more were common). This was very inconvenient.

Eventually we had to integrate the project as a sub-project of a larger project. This meant changing all those absolute paths, a tedious and time-consuming task.

Using relative paths gives you much more flexibility; however, if everybody has the project root at the exact same location, you won't notice if someone adds an absolute path somewhere by accident.

oefe
I'm not trying to enforce a layout - I'm in no position to do that anyway. Just trying to find the best possible way for me.
JimDaniel