SVN: how to lock a file so that no one can modifiy it? - locking

We are using TortoiseSVN for a project. One file in this project has a special status. It can be modified locally but the SVN version must not be modified.
So, I have locked the file so that noone, unless me, can modify this file. Now I am searching a way so that even me cannot modify this file. Do you know if it is possible and how?
Thanks for your answer.

Add a serverside pre-commit hook that rejects commits touching that file.
See http://wordaligned.org/articles/a-subversion-pre-commit-hook
There is an example function listing all affected files. To make the script reject the commit, write "You cannot modify THENAMEOFTHEFILE" to STDERR and exit with an error code. For example sys.stderr.write("ProjectThingyFile.txt is read-only.\n"); sys.exit(1)

Does it need to be part of the SVN repository as you can ignore it so it will not be committed and can remain unique per users machine.
Find the file right click on it
goto the tortoiseSVN Menu
Unversion and add to ignore list or add to ignore list
This process will stop any changes to that file being committed from any user
Tortoise SVN Documentation on this
Hope this helps
Jason

You could create a dummy user that no one logs in as and have that user lock the file instead of yourself.

Related

Storyboard got corrupted during a merge

In Xcode we pulled someone else's push and merged with local copy. However now the pulled copy has corrupted storyboard. The worst thing is we accidentally pushed those corrupted file to remote repo. Now is there any way I can solve this issue?
we are using SourceTree as our interface to Git.
One of our member has the last working copy as we haven't pulled any corrupted data from server to his copy.
Any potential solution for this situation? Thanks
Sorry but I'm not enough of a Git expert be be able to give you the exact commands, but there are git commands you can enter to revert a file to a specific revision/commit. If you hunt around the web you should be able to find them and revert the file.
You may have to use command line Git.
This may help Reset or revert a specific file to a specific revision using Git?
and this Rollback file to much earlier version using Git
A pull and merge is commited to the history like any other change so you just need to undo that commit. The git command to delete the last commit and restore your working tree to the previous commit is:
git reset --hard HEAD~1
(from Delete commits from a branch in Git)
This change could then be pushed back up to your server.

How to view changes made to a file (person used vim to make unauthorised changes)

Is there a way that I can review the changes made to a file?
Basically, someone has logged onto my server and made unauthorized changes to a file, this has taken down a whole site. I want to see what the file read before the changes were made. The server is a standard install of centos and apache.
Unfortunately, this file lives outside of the svn (it's a config file).
If the person used copy and cut in vim, and didn‘t clean the registers afterwards, you might find remnants of the changes with :reg in vim.
Which might at least make it easier to identify some parts of the file that were changed.
In vim7.3 there is a setting that allows you to undo changes between sessions. You have to have in your .vimrc the following
set undofile
if you vim did not have this setting there is no hope to recover what the original state of the file before editing it with vim.
If it was set then you can just type u in vim to undo the changes there were made.
The is a vim plugin, gundo, that allows you to have a nice visualization
of the past state of the file (again, you would have to have the option set, and the file were the changes are kept would have to exist).

idea9.0.3 commit

I use idea 9.0.3 and I want to commit few my application's files to SVN.
Please can anyone tell me step by step what I have to do?
you need to add version control to the project, using the 'version control' menu option at the top. I have IDEA 10, so it might be different, but in the menu, there is an 'import into version control' option. So add your SVN repo there.
once you have done that you can right click on any file or directory, go to the 'Subversion' option, and do svn operations on the file.
I use command+k on my mac to automatically start the commit process. The only thing I need to remember is to add files when they are first created, else they don't get committed.
EDIT -- You might have failed to add svn to the project -- did you enter your credentials? I assumed there was already an svn repo for your project. You don't see something like:

How to control file permissions in CVS repository?

Currently some users have their umask set in ways which result in execute permission on regular files, which I'd like to avoid.
Is there a way to force all files checked in to only be read with some exceptions?
What is the recommended way to handle this in CVS?
Cvs command option watch is also preventing file permissions to be restored. If watched, when file is checked out it will be read-only. From cvs man pages:
$ cvs watch --help_options
Usage: cvs watch {on|off|add|remove} [-lR] [-a <action>]... [<path>]...
on/off: turn on/off read-only checkouts of files
So, use cvs watch off filename to remove checkout from repository making it read only every time.
I am not sure if this is the best solution, but I would probably do something with the cvswrappers file in CVSROOT directory of the repo, using commitinfo, commitcheck and commit_prep.pl. If you don't have commit_prep.pl, you can use something like this one:
http://opensource.apple.com/source/cvs/cvs-29/cvs/contrib/commit_prep.pl
There are quite a few examples on the web, so just search for those commit* files if you don't already have those in your repo.
Note that, as this post suggests, the permission is really set only during the first commit of a file, after that, you'd need to "manually" modify the permission on the repository itself.
How do I add execute permission to a file in CVS after it's already been checked in?
In commit_prep.pl, you can clear the exec permission using chmod ugo-x , before the file is committed for the first time.
This solution assumes you are using linux.

Tortoise SVN Repo-Browser

I was wondering if I right click on a file in the SVN repo browser, does it get permanently deleted? can it be recovered?
This question/answer from the SVN FAQ might interest you :
How do I completely remove a file from the repository's history?
There are special cases where you
might want to destroy all evidence of
a file or commit. (Perhaps somebody
accidentally committed a confidential
document.) This isn't so easy, because
Subversion is deliberately designed to
never lose information. Revisions are
immutable trees which build upon one
another. Removing a revision from
history would cause a domino effect,
creating chaos in all subsequent
revisions and possibly invalidating
all working copies.
The project has plans, however, to
someday implement an svnadmin obliterate command which would
accomplish the task of permanently
deleting information. (See issue 516.)
In the meantime, your only recourse is
to svnadmin dump your repository, then
pipe the dumpfile through
svndumpfilter (excluding the bad path)
into an svnadmin load command.
If it's that hard, there are little chances it can be done easily from Tortoise SVN...
(And it's not the goal of Source Control...)
You'll find that you can only delete from the Repo Browser when you are viewing the HEAD revision. This is identical to deleting a file from your working copy and then checking in the delete. In both cases, you'll be able to restore from the previous revision.
Deleting a file via the repo-browser context menu basically creates a new global revision where just that file was deleted, so it appears in the log as such - you can always revert to that revision to get the file back, or you can just pull it directly from the repository into your working copy.
No... Deleting a file (even using the repo browser) only affects working copies. It would be a pretty lousy revision control system if you couldn't recover a file from the past. It is actually pretty difficult to modify files in a committed revision, even if you have root access to the server.
Doesn't right-click just bring up some sort of menu? And with SVN is that you can always revert anyways.
I deleted a top level directory from Repo Browser by accident and the only way to get it back was the following:
Export the top level folder from a previous version history
Make a new folder in the repository to replace the one deleted.
Add the exported files back to the new directory (same name as previous)
Update the working copy, it will delete and then re-add the same files.
Its annoying but at least the working and repo will be back in sync. The "Revert Changes from this Revision" didnt work for undoing repo deletes, it only reverts in working directory not the "Undo" the delete to the repository.