Checkin Without Merge in Visual Sourcesafe - visual-sourcesafe

I've got a file managed by Visual Sourcesafe 2005 which I have edited. I'd like to check in the file exactly as-is on my box, but VSS always merges it with the file in the repository, breaking my code.
I don't know what I expected to happen...
Is there any way to check the file in without merge shy of deleting the existing file from the repo and adding my copy back in?
I've looked for command line options to no avail.

You could just do "Undo check out" for all files, keeping their local versions on your machine; then again check out this files without getting latest versions from Visual SourceSafe; then check in all of them. In this case history is preserved. You just overwrite latest versions of files without any merge. Seems for me it's what you wanted.
I had the same problem and sorted it out in that way.

I'm putting this answer here, but still really hoping that a better one comes up.
I figured that I can go into the VSS GUI and rename the file to ".old", then add my local file into the repo. It's extremely hacky, but allows me to keep the file history.

Such issue might happen when the file was checked out by multple people and there was a newer version checked in by others after your checkout. (See Four scenarios that merge may be performed #2 of the article for more details.)
I don't see a option in SourceSafe CheckIn command to control that either. If you don't want merge happen, you may exclusively check out the file before editing.

Related

Remove unchanged (content same) from pending files list in Visual Studio?

This is not a duplicate of an existing and answered question, like this one.
It is well known that VS pending files list shows all checked-out files, some of them might have no edits at all. And the recommended solution to remove those files without an edit is to run a TFS Power Tools command, as answered here.
However, this doesn't apply to the files that were changed (by a mistake, or on a purpose), but the change was manually reverted. In other words, if the content of two files is binary (or literally) the same, the "Undo Unchanged" command might still think the file has changed and does not remove it from the list.
Is there any way to force TFS PT to perform content-based comparison for pending files vs. latest server version?
Use local workspaces instead of server workspaces (on VS/TFS 2012 or later). With local workspaces, the only things that show up in the "Pending Changes" window are actual modified files.

Subversion in multiuser environment with XCode 4.0

I have been using XCode with subversion for some time now, no problem was caused when I was using it as a single developer (I was using 2 commands only, commit and add).
But now I have to share the code with another developer (who has never used any kind of version control) and integrating/merging the code has become a nightmare. No problem occur when we are integrating/merging .h/.m files but as soon as it comes to ".nib", "xcodeproj" and ".xcdatamodeld" files, we really don't know what to do.
Whenever we try to merge "xcodeproj", project was getting corrupt and merging ".xcdatamodeld" was kind of impossible for us.
So I was wondering if someone can share his/her experience on how to effectively use subversion/git/mercurial with XCode 4.0 in multiuser environment? or share a link, which can explain how to use subversion effectively in multiuser environment.
Thanks.
Are you doing this using Subversion? For 90% to 99% of the files in your repository, the standard Subversion workflow of checkout, edit, commit works well. However, for some types of files such as JPEGS and GIFS simply don't merge well. In this case, you'll have to do it the way we use to in the old SCCS and RCS days: Before you can edit and commit a file, you must lock it.
Locking a file prevents others from editing the same file and committing changes while you're doing your work on the file. It's crude, but it works. In Subversion, you can always lock any file you're editing, but if the file has the property svn:needs-lock on it, it will be checked out as read-only. You have to lock the file before editing it to make it writable, and you're not allowed to commit the file unless it is locked.
So, for those files, set the svn:needs-lock property on it.
You can automatically set this property on all newly added files (depending upon suffix) via setting the auto-properties in your Subversion client configuration.
And, if you really, really want to make sure that all .nibs and xcodeproj and all of the other flies of these types have svn:needs-lock set on them, you can use my pre-commit hook which will prevent these files from being committed unless this property is set.
There is no failsafe way to merge these kinds of files that I am aware of. So you will have to
try to ensure that only one person is changing these files at a time. That won't work always, so just log what you changed in the file with the commit message. Then if there is a conflict, you can manually resolve it by taking the version that changed more of the file and redo manually what the other person did.
That's normally not a big deal, like adding a new source file to an .xcodeproject, or changing the alignment of an element in a .nib. It's becoming a problem if your project is huge or your nib is containing the whole interface. For it to work well (which in practice it does), you need to split up your projects into sub-projects if they grow too huge.
I had the same problem with 2 other developers Xcode with git. Unfortunately, Xcode project files are an XML file, tracks file included in the project as well as setting. I'm not certain, but I think .nib files are also XML files as well. Someone can correct me on that.
Git did a great job at merging the Xcode project file, and never really had any problems with our *.nib files either. The only time we did have a problem is when we both added/removed files with the same names, or someone did a lot of heavy removing and adding of a lot of files.
The only way we solved this was to have each other push ann pull as soon as we added/removed files. So that way the person had the latest files, and didn't add them in their own repository then pull the latest commit which had the same file in it. Or they work adding changes to a file that was removed or renamed.
That is the best solution we found, as soon as we added or removed a file have everyone else in the team pull. Not a great solution btw. However, you should be committing often anyways.

Working with Subversion the same as with Visual Source Safe in Visual Studio

At work I just started using Subversion with AnkhSVN instead of Visual Source Safe. I managed to integrate it well enough but it doesn't seem the same.
Using VSS the following would happen:
A user check out a file by right clicking and selecting "check out" or by editing it. If another user tried to modify the same file he would get an error. No 2 users could edit the same file at the same time. No fancy merging. No conflicts and no conflict resolutions.
I understand the the philosophy behind Subversion is different but is there any way that this behavior described above could be duplicated with Subversion?
There is an option in AnkhSVN called "Automatically lock files on change..." but even if I activate this option when I edit a file it never gets automatically locked.
Even if this option worked the other users wouldn't see the lock until they commited the file. They wouldn't get an error when they tried to edit it like they would in Visual Source Safe.
So basically: can Visual Source Safe's behavior be duplicated using Subversion and AnkhSVN?
The point of using subversion over source safe is that you don't have exclusive lock and many people can work on the same file.
You are loosing quite a lot of the benefits of SVN if you start using it with exclusive locks on files.
The idea is that you fix conflicts during merges of code.
See this SO question and answers for a bit of a discussion on the issues (Revision control locking: Is the jury still out?).
The Agent SVN is a MS-SCCI plugin (just like VSS) for Subversion so it integrates with Visual Studio just like VSS.
It also has a Lock on check out option and with that feature on it does feel a lot like VSS.
You need to set svn:needs-lock subversion properties on the files that you want to explicitly lock. It's really only recommended for files that cannot be easily merged, like (most) binary files and not on text/code files. Usually text/code files merge great automatically, and when they don't conflicts are usually easy to solve.
AnkhSVN will ask you to take lock the file (same as checkout in VSS) when you attempt to edit it when the svn:needs-lock property is set. If you enable the "Automatically lock files" feature, the lock dialog is suppressed, and you will take a lock on the file without a dialog showing up.
Svnbook explains the differences between a lock-modify-unlock and copy-modify-merge, and the svn:needs-lock behavior is also described

Disabling automatic checkout in AnkhSVN

I'm using Visual Studio 2k8 with AnkhSVN.
When I start to modify file, it's automatically checkouted. How can I disable it? I don't want to accidentally modify my files.
Your files will not be modified in your Subversion repository until you check them back in. And even when they are checked back in, you can still roll them back to any previous point.
So, no need to worry about doing something accidentally...that's the whole point of version control!
What you call "check-out" just means the file has been marked as modified locally on your machine (without the SVN server knowing anything about it). This is different than say, ClearCase, where the file is actually checked out on the server. So as Michael suggests, you don't really have to worry about it, you can always revert it locally. And if you just use Undo in VisualStudio, the file will again be marked as not modified.
What some of the other answers have hinted at: You don't "checkout" files with SVN. It sounds like you're coming from a ClearCase/SourceSafe mentality. SVN works on a different versioning model. When you "checkout" a working copy, you're pulling down the latest version of the files from the repository. You are free to modify any of them. Once you are done with your edits, you push, "commit" them back to the server.
I could ramble on and on, but instead of botching it, I'll just point you to the de-facto-standard SVN Manual - here's the first chapter which explains the versioning model that SVN uses.
Open the AnkhSVN Conviguration dialog (Tools->AnkhSVN->Configuration…) and set DisableSolutionReload to True.
There is also an option to do the opposite—to prevent it from automatically adding new files to SVN—that you can disable (setting AutoAddNewFiles to False).

How to I tell VisualSVN to do a replace instead of a merge?

We're finding ourselves unable to open our project in Visual Studio because SVN is adding lines like
"<<<<<<< .mine"
to our .csproj files.
This is apparently something SVN inserts when it has trouble merging files, but we're not interested in merging things as two people can never have the same file checked out.
How do we set Visual SVN to Replace instead of Merge?
Thanks for any help.
It's doing that because SVN tries to preserve whatever changes you've made to your local working copy. Thats a pretty important aspect to the SVN method of version control so I don't know, and doubt, if its possible to do that. I do know you can tell svn to ignore files, but their changes then won't be committed to the repository, nor updated from the repository.
If its a problem, delete the csproj file, then when you update it will redownload the proper version. Do that whenever theres a problem. If it happens quite a bit, then one of the developers is messing with the file.
Past projects I've worked on had a dozen engineers working on the same projects, and we never had constant merge problems with the .csproj files.
What do you mean by "two people can never have the same file checked out"? I think you are misunderstanding how Subversion works - checkout is not an exclusive lock on a file.
Visual SVN uses Tortoise on the backend I believe. when you are in a conflicted situation (i.e. SVN cannot merge the two versions cleanly) you should have the option you should get a pop up where you have the option to either "Use Local" or "Use Repository". If you choose "Resolve Later" you'll get what you are describing.

Resources