svn: forget about deleted files
I did the following in an svn working copy I had:
sheep@sheepbox# gvim Dual_On_Off_Model.h
sheep@sheepbox# gvim Dual_开发者_如何学GoOn_Off_Model.cpp
(... made the files, saved them ...)
sheep@sheepbox# svn add Dual_On_Off_Model.*
sheep@sheepbox# svn st
M Multiple_On_Off_Model.h
A Dual_On_Off_Model.h
A Dual_On_Off_Model.cpp
sheep@sheepbox# rm Dual_On_Off_Model.* <- Stupid on my part, but discovered
<- I didn't need the class
So later:
sheep@sheepbox# svn st
M Multiple_On_Off_Model.h
! Dual_On_Off_Model.h
! Dual_On_Off_Model.cpp
sheep@sheepbox# svn commit
svn: Commit failed (details follow):
svn: '/home/sheep/src/secret_project_x/trunk/superduperd/Dual_On_Off_Model.h' is
scheduled for addition, but is missing
Basically, I deleted the files from my working copy without using svn rm, and now svn is mad because it can't find the files.
Since I don't need Dual_On_Off_Model.* and they have now gone to the big HDD in the sky, is there a way I can use a Jedi mind trick on the working copy to have it stop yelling at me?
Just re-add the files (or empty files with those names) then delete them, using svn rm.
EDITED BETWEEN:
use:
svn revert -R .
it reverts to the svn revision you have as local copy.
svn revert *
fails because *
expands to every file in the directory, and you need to revert a file that's no longer in the directory. Try svn revert Dual_On_Off_Model.h Dual_On_Off_Model.cpp
instead.
To revert absolutely everything, you can use a bit of bash-fu:
svn status | awk '{print $2}' | xargs svn revert
Grab the second word out of each line of svn status
's output (assuming you have no spaces in your filenames...), then pass those as arguments to svn revert
.
I was inspired by Josh Kelley's answer:
svn st | awk '$1 == "!" {print $2}' | xargs svn revert
should fix an entire tree that has this problem.
精彩评论