views:

608

answers:

7
+2  Q: 

VSS to Subversion

I'm researching a potential move from SourceSafe to Subversion and we are struggling with the edit/merge/commit vs. checkout/update/checkin paradigm. The primary concern is how do you know which files are checked out with Subversion (and to whom)?

Is there a Subversion equivalent to "Status Search" in VSS? Or is it not possible because of the lack of "reserved checkout"?

Also, if we do try and implement "reserved checkouts" with Subversion via "locks", is there a GUI (TortoiseSVN, VirtualSVN, etc.) that supports "lock on checkout"?

Thanks.

Update: Example, before we do a build/release we want to be absolutely sure that all files are checked-in. Developers forget. So we DO need to know which files are checked-out. Is this possible with Subversion? Is is possible to view a list of checked-out (or locked) files? Browsing the entire code-base in Explorer is not feasible, is there some report-style list or search functionality?

+1  A: 

I'd really recommend moving to Subversion (or, frankly, even pen and paper) over VSS. To more precisely address your question; using Subversion, you shouldn't need to know who's got a file checked out as severely as you would with VSS; Subversion (and reasonable source control systems) don't have the hissy fit with merging changes that VSS does.

McWafflestix
+2  A: 

TortoiseSVN will tell you if files are locked, a lock icon will appear over the files when you view them in explorer or the repo browser.

However, the standard operating method of SVN is not lock/update/unlock like in VSS. "Checkout" in SVN is similar to "get latest version" of VSS.

Personally, I would avoid the lock/update/unlock workflow. The merging algorithms in SVN are much better than vss. Lock/update/unlock is fundamentally opposed to concurrent development.

whatsisname
Agreed. I know where you're coming from with the desire for exclusive checkouts but once you get going with svn you won't need it or miss it. (and you can use locks until your comfortable).
Michael Haren
+7  A: 

If you are using the edit/merge/commit paradigm (which you don't have to w/ Subversion, btw), then there is really no such thing as a person "checking out" a file.

With edit/merge no files are locked, and you are to assume that every file is checked out (unlocked) to every user.

Developers pull down the whole baseline (or at least the portion they want to build), and they just edit whatever they want when the mood strikes them. When they want to check their changes back in, that's where "merge" comes in.

At first blush you, as a VSS user, might think a check-in of a file could "wipe out" changes made to that file since you checked it out. I didn't understand how that could work initially either. The trick here is that SVN can tell when someone else checked in a version of that file since you checked it out, and thus it needs to be merged rather than simply replaced. It is smarter than VSS. :-)

The theory is that it shouldn't happen much, and in the long run you will spend less time dealing with conflicting edits than you would spend trying to deal with files someone else has locked. A quick back-of-the napkin calculation I did once showed that is probably correct where I work, but YMMV.


Update: For your procedure where you try to protect developers from forgetting to check in changes, that probably isn't going to work anymore. You could try to root around in every developer's working directories and look for differences, but I think we both agree that isn't feasible.

It is correct that the locking model provides a way for developers to declare their intention to modify a file to the central repository, and edit/merge does not. Tools built for one approach often just flat out make no sense for the other. This is one of those cases.

My suggestion to you as toolmeister would be to try out a small (or toy) project with SVN to acquaint yourself with the different method of working. Once you understand that, you ought to be able to wrap your head around it.

T.E.D.
As an SVN administrator this is perhaps the biggest hurdle I face. People do not understand that you are committing specific changes, not the contents of an entire file. This leads to someone committing some changes against the wrong issue (we have hard issue tracking rules), then making a whitespace change and committing it to the right issue just to get the issue tagged on the file. This causes merges to pick just the whitespace, and a makes a lot of confused developers. As Mr Babbage said "I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
Mike Miller
Sorry to double post this comment, but I feel it makes sense.I'm not worried about resolving conflicts; I understand that will be rare. I want to be able to see all the files that are currently checked-out and/or locked (and who has them checked-out/locked).
MattH
OK, MattH. Added a couple of paragraphs at the end to respond to your update. Does this make it clearer?
T.E.D.
BTW: Is it just me, or do you actually *need* a computer to interpret the captchas now?
T.E.D.
@T.E.D. - thanks for the update. I have started a "toy" project with SVN. However, I'm still looking for an answer to my question - is there a way (outside of browsing thru every file) which files are locked (and by whom)?
MattH
@MattH: Again, there is no such thing as a "lock" w/ edit/merge. Your question is roughly like a jet pilot sitting down in a helicopter cockpit and starting to ask questions about the thrusters.
T.E.D.
I'm not talking about using "edit/merge/commit". I'm talking about using "lock/edit/unlock". I understand SvN is not built for this, but as part of my research of source control options, using SvN in "lock/edit/unlock" mode IS an option for us.So my main question is not how do I find locks within an "edit/merge/commit" paradigm - I know that doesn't make sense. The question, perhaps I worded it poorly, was if we stick with the "lock/edit/unlock" method, how could I view unlocked files? I've since found the answer. Thank you for your responses.
MattH
Ahh. I didn't get that part. Ideally if you want to stick w/ locked checkouts, you should use a tool designed around that. SVN just tacked on that feature long after release to get its foot in the door with the ultraconservatives. However, it doesn't appear that *anyone* is designing neat new revision control systems around locked checkouts.
T.E.D.
+6  A: 

SVN is optimistic: merge conflicts are rare and easy to resolve. VSS is pessimistic: merge conflicts are so hard to resolve that you avoid them with locking. So in svn, you don't need to know that a file is "checked out". You just check out a version without locking and edit as you like. Conflicts are resolved before commit, and usually svn resolves them automatically for you, unless two or more commits are modifying the same source lines.

Therefore a "status search" is not really needed.

SVN does support the notion of locking, which is useful for those hard-to-merge binary files. Even there the lock is not hard; it's merely a signal to other developers "please do not commit while I'm editing this file." SVN GUIs have the option of locking a file. You can also enforce locking with the special svn:needs-lock property.

See the svnbook for more info on locking: http://svnbook.red-bean.com/en/1.2/svn.advanced.locking.html

laalto
A: 

AnkhSVN supports lock on edit from Visual Studio, but even though I worked on that feature I would really recommend using this only when there is no other option (e.g. specific generated code and binary files). For normal source files in a team where developers are working on different tasks it is almost never necessary to perform exclusive locking.

Good 3-way merge tools like the free SourceGear DiffMerge make it very easy to resolve an occasional conflict once you have one (probably once every few months over the entire team; not more).

Bert Huijben
I'm not worried about resolving conflicts; I understand that will be rare. I want to be able to see all the files that are currently checked-out and/or locked (and who has then checked-out/locked). If there were a "reserve checkout" mechanism and a way to see who has what checked out then I wouldn't be concerned with locks.
MattH
+1  A: 

Matt,

As a former VSS user who has moved to SVN, I can understand your frustration. However, I believe that you have already answered your own question. You've indicated that you are struggling with the shift from the "lock/edit/unlock" mindset to the "update/edit/commit" mindset and this is really the source of your frustration. I know, because I have been there myself.

Fundamentally I think that the problem you are trying to solve is based on the "lock/edit/unlock" mindset... which (as has previously stated by other answers here) is the "restrictive security model", ie we want to protect you from doing something harmful so we will restrict your level of access. The "update/edit/commit" mindset basically takes the approach that 90% of the time the user (in this case the developer) is trustworthy and knows what they are doing and so we will allow you to do what you want and provide you the tools to deal with the small number of times when you get yourself into trouble.

If I may be so bold as to restate the problem you are attempting to solve is:

"Sometimes developers are in a rush to deploy a new change. They might forget to commit a change back to the repository that is critical for the new change to work. This will mean that the Build / Release process will fail due to this missing change. The Build / Release process needs to know if there are any files the Developer intended to change, but whose changes have not yet been saved back to the repository."

The resolution to this problem would then be for the developer to commit the change they've overlooked and re-initiate the build process for a successful outcome.

Can I ask, how many times has this actually happened for you? After doing it once, how many times would a developer do it a second (or subsequent time)? If they were a continual offender, how many times would you as a Team Leader / Manager allow it to happen before that Developer was "encouraged to seek external career opportunities"?

So, basically, my answer is... train your developers to not forget and deal with the occasional instance where they forget.

I assume that by asking the question if it is possible "to view a list of checked-out (or locked) files?" that you are intending to enforce exclusive locking of all files in the repository (otherwise there is no concept of a 'locked' file in SVN)? This then severely limits one of the big advantages of SVN (or any other "update/change/commit" model SCM) over VSS (or any other "lock/edit/unlock" model SCM).

Cheers Richard

plancake
Richard, thanks for the thoughtful response. I agree with you and most of the reponses that using SVN with "lock/edit/unlock" is a little bit like using a hammer to pound in a screw. That will be something for us to consider. I'm never a big fan of the "train your developers to not forget" theory. The fewer "don't forget to do this" things we have the better.
MattH
As I can't add a comment to your answer, I'll post it here:Does the list of "locked" files only apply for those files that you have defined as requiring an exclusive lock? Will that mean that you will require that all files have an exclusive lock?
plancake
A: 

I appreciate all the answers/opinions. However, just to close the loop, if you do choose to go with the lock/edit/unlock paradigm, which is possible with Subversion, you can use TortoiseSvn to view all current locks for all users.

  • Select TortoiseSvn | Check for Modifications, then select "Check Repository".
  • A list of files is displayed.
  • There is a "Lock" column that shows the user who has the file locked.
MattH
I'm arriving late to this question, obviously, but who allows development with such poor ticketing that you don't know if an issue is resolved? It _really_ shouldn't matter if developers have local uncommitted modifications. If they're hanging onto them long enough to forget about you're doing something very wrong elsewhere.
toholio