Thursday, April 2, 2009

Committing and Updating

I have been using SVN for a few months now. I set up a private repository on a network drive and have been maintianing 3 different working copies from it.

I have figured out recently that i can check in (commit) multiple directories at once. This was important because i frequently have files across numerous directories that i want to check in or commit. I was doing these one directory at a time so the version number was too frequent.

We are planning to create a new shared "with security" repository for our main application. We will be dicussing best practices and commit policies. Being sure that when we commit to the *production repository, that we have tested and mature code. We need not be treating the production repository as a holding tank for development code. This is the way we used to use our old repository, we checked in early and often. While these is much merit to this process, it did contribute to a messy repository.

I will continue to use the repository that i created as a developer repository, but we need to create a shared developer repository, like the one that we have been using for many years. Our old repository had the ability to check in files, as opposed to directories or the entire repository. This worked well when multiple developers had there hands in the same areas.

I have a little problem synching up my working copies. some how two folders in my working copies go confused and was pointing to a different location. This was a problem for a couple reasons. 1st - when i would do an update, i would see files being removed and others being added when they should not have been. The source locations for the working copies go switched around. My working copy of /resources/... was pointing to /assessments/ in the collection.

It was screwing up both sub applications resources and assessments.

Resource was committing into /assessments, which made assessments fail and caused resources to not update.....To be more specific, it was not the entire working copy that was pointing to the wrong folder, but 2 of the 5 sub folders.

Once i saw the problem, i was able to use the tortise SVN switch command to change where my working copy was syched up to in the repository.

Lesson learned - be very careful about where the working copy is syched. This may have happened when i deleted and recreated the resources folder in the repository.

It seems now the correct way to accomplish this is to use SVN Export command. Create the directory first, then do an export from the repository and it will synch it up.

Tuesday, March 3, 2009

repository working copy

3/3/09 - pretty big things today. Today I,

build a couple repositories, 3 i think using the svnadmin.....command to build that - then moving into the source directory to populate the repository. I did this a from about 3 different locations to help grok the concept of populating the repository.

Then I deleted what i had added to the repository from my hd - thats because i needed to make a working copy and synch it up to the repository. I did this on a couple directories, and saw the familiar SVN tortose visual of the green check, once the workking copy was created - synched up to the repository.

Then i got a little braver and created another repository - only this time the entire collection of files that are currently part of the project. Then i deleted all the source code from my localhost and copied it again from the repository - then entire project. Then i realized they way i had copied from the repository was creating a directory structure literally from the stucture of the repository - including the trunk. So, i then removed all the files from my working copy, essentially starting over with my working copy, not the repostory.

I was doing the synching - copy from repository from the command line, which is ok, but then i remembered i have SVN Tortoise installed and started using it to create my working copy from the repository - i started with a single directory, then removed it and tried the to do a group of directories, was not successful, but was able to choose each directory/folder, 1 at a time and get them into the source root properly, the way i needed to get my localhost up!

The only thing i was not able to do, so far, was copy individual files from the repository root to my working copy root?? I ended up just copying them from the old repository. So, currenlty the couple of files are not synched up with the repository - i can see this visually, by the green check not next to each file.

I also manipulated a couple files in my working copy and checked them visually via Tortoise and saw what i expected, the files and the folder the files contained in with a Red explanation point, indicating that the content had changed and were not in synch with the repository.

So - overall - very exciting and getting close to moving out onto a network drive and creation the permanent repository that will be sharable to other developers. I guess i acting as the admin of the repository as well as the policeman to what goes into the initial build of the repository.

Steps to SVN usage:

1 - download svn admin (if creating repository and administering)
2 - download and install client, like Tortoise (integrates with Windows explorer)
3 - decide on intital directory structure - create the folders (directories)
4 - create repository in the path created in step 3 - using svnadmin create
5 - populate the repository using svn import (go to the source folder and populate)
6 - create a working directory of the repository (svn co file....) or better yet, use Tortoise
7 - start using and away you go.

Wednesday, February 25, 2009

SVN 101

im going to blog my specific experiences here in this SVN specific blog.

I downloaded a version of SVN called Collabnet - after installing it - i have a program group called CollaNet Subversion Server (1.5).

Im reading throught he svn-book (pdf) avail upon install, pretty good. 385 pages

Im down with the concepts of the repository, working copy, commiting (checking in), updating(checking out), conflict resolution, automatic mergs etc. Ive been using another repository for years, that has a nice GUI.

My first official command, after testing a few of the help commands, using the command prompt, was to CREATE THE REPOSITORY. This is the central location that i would create a working copy from. I used the SVN admn command, from the command prompt.
svnadmin create /SVN/repositories/DM

I needed to first create that directory at this path, it did not do that for me. The command line simply retured the prompt after doing its work - no message about fails or anything else! I like it already.

I browsed to the path and opended the DM folder, and wala - there are 4 new folders in it
conf
db
hooks
locks
and a couple files, including a readme.txt that i opened and read that states

"This is a Subversion repository; use the svnadmin tool to examine it. do not add, delete, or modify here unless you know how to avoid corrupting the repository."

funny...ill read the manual, dont worry. I can say that what i think i have to do next is to copy the intial directors into the repository using the svn commands. Thats how we will *populate the repository - not just by copy and paste, drag and drop. Im sure the svn admin needs to create some additional info that will happen when we use the svn add "somepath" command.

Ok - since i had success creating my initial repos on my c drive - i went ahead and created a new repos on my shared network drive. Makes sense, so i can get to it from a couple different places, plus the network drive is backed up. Piece of cake, no problems. Once i ensured my mapping was active to my network drive, and it could find the letter i was using, boom. There it is. I will work now toward populating the repository with my DM collection that is in the process of being whittled...

The actual command is import - svn import...

Here is the actual command, after about 30 minutes of farting around with this....

I imported first to my local repository, on a smaller scale - to get the hang of it...sure - rather than trying to create a big honkin collection.

i created a repository first at svn/repositories/dm

then i change to the folder where i wanted to import from wwwroot/listeners

then i issed this command, compete with the -m "message" and with trunk at the end

svn import -m "importing" file:///svn/repositories/dm/trunk

then i saw the 9 files from that directory added to the repository. with the reassuring text upon completion of Committed revision 1.