svn undelete and change status on folders and files - linux

i want to undelete these files
[root#localhost sn_dev]# svn log -v --xml | grep 'action="[D]"'
action="D"
action="D">/branches/sn_dev/mob/assets</path>
action="D">/branches/sn_dev/mob/javascripts</path>
action="D">/branches/sn_dev/mob/json</path>
action="D"
i have done
svn revert --recursive mob
svn commit -m "readded files"
however the files still shows deleted status on SVN...
any help?

The svn revert command only undoes local edits (i.e. changes that have not yet been committed). Since you show the files were already committed, you cannot use that command.
You'll need to merge the reverse of the revision in which they were committed. If, for example, the files were deleted in revision 89, you'd do the following:
svn merge -c -89 .
The -c option is shorthand, in this case, for -r 88:89, and the dash before the 89 will reverse the range to give you -r 89:88. This command means, "merge the changes it would take to get revision 89 to revision 88, into my working copy." The period at the end is the working copy, and should be the directory those files will be restored to.

Related

P4V - remove identic files but with different history from changelist

I shelved files from another branch and unshelved them in the current branch. The problem is that now I have around 1500 files in the changelist and I want to remove the files that are identical between the branches. I've tried with Revert Unchanged Files and it reverts 0 files, but when I individually diff them I get the message that they are identical.
So, how can I remove them from the changelist if they are identical to the current version.
I don't think P4V has an equivalent to this, but this is a one-liner at the command line:
p4 diff -sr | p4 -x - revert
In P4V you can "open command prompt" to get a command prompt that already has the P4 client settings configured correctly; then just copy and paste the above.

SVN: undo a merge with local changes

I was on version 100, with local changes.
I did an svn up to reach HEAD (which is revision 200). Then I was ill adviced to revert back to revision 150, with my local changes, in command: svn merge -r HEAD:150 .
Now I actually want to go back to revision 200 with my local changes. svn up doesn't do anything, because I appear to still have file missings. I know because a file A.cpp was in revision 200 but not in my local working copy.
If I do svn status, I see a bizzare "D" in front of A.cpp. they seem to think I want to delete this file I don't even own.
What state am I in now, and how do I fix it?
In brief, your current checked out repo is messed up - it has a combination of your changes as well as a set of uncommitted changes to go back from HEAD -> r150. If you committed at this point, it would have the effect of removing all the changes that happened from 150:HEAD, and then adding in your changes.
If trying to do a re-merge: svn merge -r 150:HEAD . doesn't work (and generally it won't), then I would suggest the following:
assuming you have your current workspace <currws>
checkout a second copy of the workspace, at revision 150: svn co -r 150 <svn url> <newws>. This will give you a directory <newws>
(cd <currws>; tar cf - --exclude .svn .) | (cd <newws>; tar xf -). This will take all the files & directories from <currws> and copy them into <newws>.
Take inventory of the new directory - it should now contain copies of only your changes - some of these may need to be SVN added to the workspace; or if you have deletes, they will need to be re-deleted on the <newws>. You can pre-remove all the files/folders from new-ws prior to the tar, and anything that appears after the tar with a ! indicates a file that you removed with your changes, anything with a ? is a file that needs adding, and the remainder should be M entries.
Bring the new workspace up to HEAD - svn up <newws> should work in this case.
verify that everything's working and that it only contains your changes.
make a patch file, get it code reviewed and then commit it.
I'm pretty sure this will get you back on-track; although I don't have a tree to check against with the spotty network connectivity I have.

Calling svn diff on some revision and previous revision, with no local copy

I have no local copies of any files from the SVN repository. I do have a full path URL to some file in SVN. How can I see the difference between revision 1234 of that file, and it's previous revision, whatever it may be?
svn diff -c 1234 $URL
Assuming you are using a version of Subversion newer than 1.4 when -c was added. Otherwise you need to do:
svn diff -r 1233:1234 $URL
If you want to see a diff including changes across multiple revisions you can just expand the revision numbers you provide to -r.
You can see detailed documentation of the diff subcommand in the SVN Book.

tortoisesvn lost history of file due to delete, then add of same file

I had a developer 'revert' a file by deleting it from the repository and re-adding it. We now have a current file with no history. Is there a way to get back the deleted file. With it having the same name as existing file, how should I proceed? Yes, I have tried to read the docs but can't seem to get the right combination of actions to take.
delete the file in your working copy
in the repository browser, go to the revision where the original file still existed (i.e. before it was replaced)
right-click on that file in that revision in the repository browser, execute "copy to working copy"
specify the path in your working copy as the "copy to"-target
Now you have your file back including the history.
see this thread here...
examining history of deleted file
to resurrect your file you can
svn copy url/of/file#lastrevisionthefileexisted -r lastrevisionthefileexisted path/to/workingcopy/file
On Linux, I solved the problem by following the steps on the command line:
svnadmin create TEST
svn co https://URL/svn/codes/JarLib/
Delete file or directory which is re-added
svn delete https://URL/svn/codes/JarLib/XXXX.jar -m "XXXX.jar history resurrect operation"
svn update
Use 'svn copy' command to get deleted file/directory with HISTORY. Revision number must be deleted file's/directory's last revision number!!!
svn copy https://URL/svn/codes/JarLib/XXXX.jar#22467 -r 22467 XXX.jar
Operation below will add XXXX.jar to your Working Copy then commit the changes.
svn commit -m "deleted file/directory is resurrected"
To control:
Go to SVN Server and use svnlook command like:
svnlook history /svn/repos/codes /JarLib/XXXX.jar --show-ids

How do I revert back to a previous SVN commit?

Suppose I'm at revision 50.
But, I want to revert back to revision 45, and commit back as the stable version.
How do I do that, in the most simple way?
What if I want to do that with one file?
What if I want to do that with the entire repository?
I'm not sure what you mean by "commit back as the stable version", but depending on what you're trying to accomplish I recommend:
svn update -r45
This will rebase your working copy at revision 45.
or:
svn merge -c -50,-49,-48,-47,-46
This will update (by reverse-merging) your working copy by removing all the changes between 45 and 50. Now if you make changes and commit, it will be like you have removed 46-50 from the repository and made the HEAD revision (51?) to be r45 + your change.
Reverse merge those revisions that you want to undo. This can be done on one or multiple files. By reverse merging, your working copy gets changed to the state without that revision, which you then can commit.
You can simply do an update to revision using
svn up -r 45
But this will not let you commit the changes as SVN needs you to update your working copy to HEAD before you can commit. What you can do instead is
svn merge -r HEAD:45 yourFile
svn ci yourFile -m "Reverting back to rev 45"
I think one simple way should be this:
checkout revision 45 to a temporary directory
copy one or alle files to your working directory
commit

Resources