Moving a file around

In my current project I use subversion, and TortoiseSVN, as a versioning tool. It is not the first time I am using it, but I am not yet an expert SVN user. For instance, last day it was the first time I bumped in a file-moved issue.

A file, let's call it one.txt, was happily sitting in the doc folder for a while, when someone decided it had to move somewhere else, say in a subdirectory named sub.

Moving a file with tortoise is very easy. Right click on it from the explorer, go in the TortoiseSVN submenu, Rename it specifying the new path name, in this case "sub/one.txt", and finally commit the change to subversion. Notice that "sub" should be an already existing directory, both in the working area and in the repository.

A glitch could arise is another user is working on the same file, and try to save it to the old location after it has been moved to the new one.

User 'B' changes one.txt in doc, and then try to commit. To his surprise, he got an error and a suggestion to update his working files. But the update leads to another error: subversion detects a conflict between doc/one.txt in the working area and doc/sub/one.txt in the repository.

At this point, tortoise let us to decide what to do: do we want to override the decision of the first user and move back the file to the original position, or do we accept the move? Both alternatives are supported.

No comments:

Post a Comment