Michael Flanakin's Web Log

Comments and complaints on software and technology in general

  Home  |   Contact  |   Syndication    |   Login
  159 Posts | 18 Stories | 88 Comments | 530 Trackbacks

News

This weblog is no longer being maintained. For the latest, check out www.michaelflanakin.com!

Article Categories

Archives

Post Categories

Image Galleries

Miscellaneous

Welcome to my adventures in Subversion. This is part one of a pretty good-sized project that will integrate a lot of open source tools. Right now, there are about 10 tools that will be integrated together to support software development efforts. A few of the tools are Subversion, DotNetNuke, and Community Server (Forums and Blogs). There will also be Windows and web-based access to Subversion and tracker and wiki utilities. This is only the beginning. Should be a pretty eventful project, I think. Hopefully, I can get things up and running smoothly. Anyway, here is what I went thru to set things up. This is mainly just intended to be for documentation purposes, but hopefully someone else can benefit from it.

Setup

First off, I started with the Windows installer version of Subversion 1.1.1 (file list). I was going to use the Solaris version, but it hasn't been updated since June (1.0.5). After I downloaded the installer program, the installation was self-explanatory, as most Windows installers are. Thanks Jostein Andersen.

Repository Creation

First, let me say that there's a quicker way to set things up than to use the command line. I downloaded and installed TortoiseSVN after installing Subversion, but I didn't really play with it, yet. After looking at it, I found out that I should've just stuck with it, instead of the command line. But, for those who are having command-line issues, here ya go... 

I was looking through the quick start instructions and the first thing I ran into was this:

$ svnadmin create /path/to/repos
$ ls /path/to/repos
conf/  dav/  db/  format  hooks/  locks/  README.txt

Recognizing that the path was a UNIX file path, I replaced it with a test path: c:\svn\path\to\repos. This didn't work, tho. I got the following error.

svn: Repository creation failed
svn: Could not create top-level directory
svn: Can't create directory 'C:\svn\path\to\repos': The system cannot find the path specified.

I thought that maybe Subversion had something special setup and knew where to create the repository. So, I tried it exactly as the docs specified it, but to no avail. I tried several variations before looking it up online. It turns out that the repository being added must have all parent directories in place. So, for my example, I had to have the path, c:\svn\path\to already setup. Once I added this, I was good to go. I ran the following with no problems after creating the c:\svn directory.

svnadmin create c:\svn\test_repository

Now, this is about when I tried TortoiseSVN, so I'm going to recap what's necessary for that client. First, create the c:\svn\test_repository directory. Second, right-click on that directory and select TortoiseSVN > Create Repository Here. That's it. You should get a message confirming that the repository was setup correctly.

Next, you will need to create a working directory. Since a lot of my old stuff is in PVCS, I'm just going to use the c:\work directory that I already have setup. So, within the c:\work\test_repository, I created branch, tags, and trunk directories for branched files (see branching and merging), labeled, or “tagged,” revisions, and the actual working directory of the checked-in files, respectively. Put the files you will be checking in and out in the trunk directory. For my purposes, I created Documentation and Source directories to start off with. Using TortoiseSVN, I imported the files (right click and select TortoiseSVN > Import...). Pretty easy. Just know that when you specify your repository location, you have to precede the local file path with file:///, so my test URL would be file:///c:/work/test_repository.

After importing your files, you'll need to delete everything within the working directory (it's all in source control, now). Once you do this, simply check-out the files from Subversion (right click on directory and select Checkout...). Now, everything should be setup for you to modify files as needed. If/when you need to connect to the repository browser, simply right click anywhere (preferably from the appropriate working directory) and select TortoiseSVN > Repo-Browser.

Subversion Oddities: Revisions

The first thing that I found odd about Subversion was that revision numbers are applied to entire hierarchies. So, given the following structure:

Documentation/
    Project Mgmt/
        Project Plan.xls
    Requirements/
        Requirements.doc
        Vision.doc

Assuming that everything was imported at one time, everything would be given the revision number 1. Let's say that the Requirements.doc file was modified. Once committed, the revision number for the Requirements directory and all of its contents would be set to revision 2. Now, let's say that the Project Plan.xls file is updated. The Project Mgmt directory and its contained files would be set to revision 3; however, the Requirements directory would still be set to revision 2. The odd thing is that in revision 1, 2, and 3 of the repository, the Vision.doc file is the same.

This isn't a hard concept to comprehend, it's just different from a lot of other SCM suites. Most SCM systems (that I've seen) have a per-file versioning system. In my mind, the per-file solution works a lot better. That way, I know exactly how many times a particular file has been updated and I can predict the revision number of say, 3 changes ago. This way, it's a lot harder to know. If you want to do a diff, you'll first have to figure out what the last updated revision number was, and then accomplish the diff w/ a different tool (still a part of Subversion, just a different command). Maybe this isn't that big of a deal, it just seems to be odd to me. Perhaps it'll be something I get used to fairly quickly. Nevertheless, I'd like to see some sort of combination of the repository and file versioning systems. This isn't all-too thought out, but perhaps using major.minor.revision would be a good way to do it. These would correspond to repository, directory, and file revisions, respectively. So, based on my previous scenario, the versions would look like this:

Documentation/
    Project Mgmt/
        Project Plan.xls (3.2.2)
    Requirements/
        Requirements.doc (3.2.2)
        Vision.doc (3.2.1)

Another thought would be to reverse those numbers. That might be a little odd to see, but it would put emphasis on teh file version instead of the repository version. For instance, since the Vision.doc file never changed, its version number would be 1.2.3, representing the first cut of the file, second of the directory, and third of the repository. I kind of like this better, but it depends on whether you want to have a repository- or file-based versioning system. Perhaps the option would be nice.

Subversion Oddities: Checkout and Lock

I guess CVS and a number of other tools do this, too, but the idea of “checking out” a file doesn't implicitly lock the file. This seems kind of odd to me. I'd like to know, with the option to override, that a file is being worked on by someone else. This is for obvious reasons. I don't like the idea that I have to explicitly lock the file when checking it out to edit it. So, essentially, think of “checkout” as “get latest”.

Subversion Oddities: Tagging vs. Labeling

I don't really know too much about labeling, but from what I understand, you attach a name, or label (duh), to a particular set of files, or a revision within Subversion, and this can mark your major releases. For instance, you might have v3.1 Stable and v3.2.1003.1042 Nightly labels for stable and nightly builds. This would allow you to checkout all files with a particular label and build it as that particular release. In Subversion, you would think that this would be fairly easy. All you need is a property file specifying a label name and the repository revision number, right? Wrong. You have to make a copy of the revision and place it in the tags directory. Granted, this isn't that big of a deal because it doesn't make a physical copy of the files, just a logical one. I just think that it is overly complicated for what you're wanting to do.

Work in Progress

This post is kind of a work in progress. I'm still learning about Subversion, so as things come up, I'll have to update the post. I haven't setup the server portion (svnserve), but will have to do that soon - well, either that or Apache. I'm waiting on a server to load that on, first. For now, I guess I'll move on to my next task: finding tracker open source software (hopefully in .NET).

Suggestions

  1. I hate the versioning system. When I'm working with a single file, it'd be nice to know how many times that one file has been changed, not how many times anything in the directory hierarchy has been changed. That's so aggravating. If I want to do a diff or something, I have to know the revision number of the last time it was changed. That drives me crazy.

FYI

There is a PVCS-to-Subversion tool available here. This was created by Thomas Wolkenstein. Thanks Thomas!!! If anyone uses it, please let him know if you have problems with anything.

posted on Tuesday, November 16, 2004 9:55 AM

Feedback

# re: Subversion 1/5/2005 9:29 PM si
Hi, i've been using for over a year now, and researched, implented and trained our team for its use.

Some points about your post:

- I find the repository wide `revision numbers` concept to be one of Subversions greatest benefits over CVS (or similar). You may not think so now, but when you have to tag a release or revert back to a previous revision after wandering down the wrong path, to be able to easily find in your logs the exact point this occurred (a snapshot) is very useful.

It also means you can build the revision number into your applications version, once again a very handy thing.

- IMHO Your gripe (in "suggestions") is totally unfounded, get to grips with (hint: do "show logs" in your WC and right click in your revision history, remember to commit often, that's the point after all! We integrate Beyond Compare into TortoiseSVN (when I'm using Windows, in Linux I use the Eclipse Subclipse plugin)

- Try svnserve to start with, it's easier to get going than the apache mod, read the docs in TortoiseSVN about setting it up (I hope you like the svnserve docs, I wrote them:)

- Locking is coming to Subversion, from memory it's a v2 thang.

- Tagging, this is simply awesome (and easy to do) in Subversion, if I tag a release and then have to test something, it's trivial to checkout a working copy of that release. Remember tagging and branching are pretty much the same thing in Subversion (well, they are the same, both cheap copies)....it's just that tags should be read-only and branches read-write.

Hope that helps, if you have any questions the mailing lists are really good.

# re: Subversion 5/18/2005 2:59 AM Sujith
I setup Subversion repositary using svn-1.1.4 , svnservice and . But in tortoisesvn 'repobrowser' i got the error message can't open config file passwd.txt eventhough it is there in the conf directory. Can anyone help me?

thanks in advance

# re: Subversion 5/18/2005 7:09 AM Michael Flanakin
My first guess is to reinstall . Not sure what the problem is, tho. Maybe it has something to do with a permissions problem. Did it ever work? What version of TortoiseSVN do you have? Make sure you have the version built for Svn 1.1.4, which I believe is TortoiseSVN 1.1.4 (it might be 1.1.5, tho).

# re: Subversion 9/21/2005 3:47 PM Sima
Hello, can anyone please tell me how I can lock files when I check them out using Subversion and .

Thanks

# re: Subversion 9/21/2005 3:49 PM Sima
sorry, in the message above, I missed:

# re: Subversion 9/21/2005 3:50 PM Sima
"tortoiseSVN"

# re: Subversion 9/22/2005 4:48 AM Michael Flanakin
Using TSVN: right-click a file/dir > TortoiseSVN > Get Lock...

That should do ya! Just use Release Lock to release it.

# re: Subversion 12/16/2005 12:32 PM Sima
Is there any way to share files in Subversion like VSS?

# re: Subversion 12/19/2005 4:36 AM Michael Flanakin
I haven't used VSS for a long time. What do you mean by "share files like VSS"?

# re: Subversion 12/19/2005 3:36 PM Sima
Thanks for reply. I got my answer. share files in Subversion is done by externals definitions (svn:externals)

# re: Subversion 1/25/2006 1:23 PM VK
Sima, could you please explain the answer ("is done by externals definitions (svn:externals") to your question ("Is there any way to share files in Subversion like VSS?").

I too would like to share files in Subversion like in VSS.

Thanks.


# re: Subversion 2/8/2006 2:06 PM Kay Tie
I think I get it. Haven't tried it yet, but the idea is that you specify a set of external repository URLs (which can point to the same repository, of course) and where they map to the local workspace. This is specified in an "externals" property associated with the project.

When you do a checkout you get the latest versions of the externals (i.e. shared stuff).

It doesn't quite work like VSS. You can't share files, only directories. So you can't put a shared file (e.g. "shared.h" for target-specific defs) into your folder. Instead, you have to have a folder called "shared" that includes the header file (and your trunk code would include "../shared/shared.h"). Not perfect, but better than nothing (and better than CVS).

Disclaimer: I've not tried this out yet so my understanding may be completely wrong.

K.


# re: Subversion 3/18/2006 10:08 AM VSS is still better
I am working in a team with about 10 people and on different locations.
VSS is still the best choice after making experiences with Subversion.
In VSS you check out a file and get write-permission, if you check-in, the file has only read permissision. This very pessimstic view on a repository is still the best kind of working and you just need 3 commands. "check out", "check-in" and "get latest version".
We tried it really, but didn't receive that easy to understand behaviour. If it is possible with subversion, so I'd like to excuse for my critics, and I'd like to get a howto for it.

/regards, chris

# re: Subversion 3/18/2006 11:44 AM Michael Flanakin
All you need is to lock your files when you work on them. Personally, I like Svn's non-locking approach, but if you need it, it's there. After completely understanding the benefits of the Svn approach, I think you and your team would learn to love it. Sometimes it takes getting used to, but it helps to have an educated, experienced evangelist around.

Hopefully, the locking will give you what you need.

# re: Subversion 3/24/2006 1:59 AM Steve Aze
Sharing files is a problem - about the only task where you could argue that VSS is better than SVN.

Another way to do it in SVN instead of using svn:externals would be something like this:

Have a 'snippets' project in your repository, with say a 'foo' item in it (snippets/trunk/foo). You need 'foo' in myproject, so make a copy of foo into your project like you would make a branch if adding a feature (myproject/trunk/foo). Now work away on your project, with 'foo' included. If you've made any changes to foo, then when you're happy with them, merge myproject/trunk/foo back into snippets/trunk/foo (in the standard way that you would merge a branch into a trunk - see SVN or Tortoise notes - remembering the 'From' and 'To' work back to front compared to how you might expect).

This way of working means that your tags for any project still pull out the version of foo as it stood at that time, not as it may have been modified to later, which is a good thing.

The down side of it not automatically updating your project is that you'll have to remember to manually merge snippets/trunk/foo into myproject/trunk/foo when you want to update to the latest snippets/trunk/foo in your project. But you could argue that this is a good thing, because at least you see that something in your project has changed, unlike the VSS model where you may checkout your files one day and have one your files changed without you noticing it because of something someone did in another project.

# re: Subversion 3/24/2006 7:46 AM Michael Flanakin
I must not be following you with the sharing files issue you're talking about. I don't see the problem. If you're referring to a shelving feature that VSS uses, you can do this just like creating branches. Just create a "shelves" directory at the root of the repository and shelve your code there. What you're discussing isn't shelving, but it is a way of sharing files prior to committing them.

# re: Subversion 9/7/2006 3:51 PM Shane P
Michael - you really should update this blog, or delete it - it contains much misleading and incorrect information.

Your whole "cant find out how many times a file has been altered" argument is bogus. you can right click on any level of the hierarchy and "show log" at any time.

The only thing i can think of is you like to see how often each file is altered at a glance at a directory level - because ?? perhaps it makes u feel good??

you wrote "That's so aggravating. If I want to do a diff or something, I have to know the revision number of the last time it was changed"

right click - Show Log - then select the revision (it only shows rev's for this file) and right click again - Diff... not exactly rocket science...

a tip - you can change the external diff program used - i much prefer the visual aid of winmerge over the internal diff viewer.

# re: Subversion 9/8/2006 7:30 AM Michael Flanakin
Shane,
You apparently misunderstood and/or are taking my comment about knowing how many times a file has been changed out of context. I was specifically referring to the revision numbers. Personally, I like file-based revisions vs repository-based revisions. My comment was that I'd like to have an option between the two or a combination of both. Honestly, I think the latter is a compelling thought. I know the Show Log feature is there, but I'd like to get an idea simply by looking at the revision number of the file.

Plain and simple, the only reason I like file-based revision numbers is because it directly reflects the number of times the file has been changed. That's what a revision number is for. Repository revision numbers are great and I like them, but I think they belong at the repository level, not the file level. Again, a combination of the two would be very interesting and I'd love to see that implemented.

Diff'ing is a perfect example of why you want to know the number of times a file has changed. What if I'm already in a screen that I have to select a revision number? Going to the log is a waste of time. If I know I want to go back one revision, I should be able to do that by simply subtracting one from the [file-based] revision number. It'd be so much simpler.

Yes, I know about changing diff utils. I use SmartSynchronize. That's not the problem, tho. Apparently, you just don't understand. I'm going to take a wild guess and say that you're a Linux/UNIX guy. You don't mind complexity whereas I think unneccessary complexity is a waste of my time, which is valuable. That's fine if that's the way you like it, but only a moron would sit here and say that there can't be a better, more productive way.

In short (yeah, right): I had this opinion when I started with Svn and I still have it, now. That's not going to change any time soon, as far as I can see.

# re: Subversion 2/8/2007 9:54 AM Brad B
personally I think SVN kicks ass. If you forget to tag a build you can always come back and do it later, since the revision numbers are global (you get a snapshot). And the log history stuff is great, especially in TortoiseSVN, the log is even searchable! Try that in VSS!

VSS Stinks, and enforces bad habits, like sharing, which is really not a good idea in the long run.

Read up on some books on SCM best practices, etc, and you will find that SVN is a definite improvement over VSS / CVS models.

# re: Subversion 12/5/2007 5:24 AM Nelly
Currently ,I work in PVCS,but our boss wants change to SVN.
My question about repository,how convert them from PVCS's format files to SVN's format files?

# convert from PVCS to SVN 12/7/2007 1:14 PM Nelly
Good evening !

Has anyone been able to successfully convert from PVCS Version Manager to
Subversion? I want to be able to keep my PVCS revision history.
Best regards,
Nelly
sm_nl@hotmail.com



# re: Subversion 6/2/2008 2:25 AM karthick
Hi Guys ...

Can anyone pls help me out with subversion.

Pls

I have a svn server with repository in windows xp prof - sp2.

And this repository is used by Linux machines which use SMART svn client to put the codelines into the SVN server.

Now the development team is going to finish one product.Now they are going to release the product.So they need to do Labeling work.

Im not aware or have knowledge in svn.Can u kindly help me out with the labeling concept.
I just want to know how can we do the lable work and what we have to do.can u pls help me.

Thanks
in advnce

Post Feedback

Title:
Name:
Email: (never displayed)
Url:
Comments: 
Please add 5 and 4 and type the answer here: