SVN Delete with wildcard?

拜拜、爱过 提交于 2019-12-07 12:29:22

问题


I'm migrating a VSS repository to SVN and inadvertently included all of the _vti_cnf, *.scc files in the first check-in. I'd like to remove these from SVN. (Not permanently, of course - just in the HEAD). The application in question is quite large, and finding and deleting these files on a folder-by-folder basis will take forever.

Suggestions? There must be some obvious way to do this, but the proximity of the weekend is interfering with my higher brain functions.


回答1:


Jonas' answer should woirk fine. Maybe you are getting conflicts because you're deleting them on file system level, bypassing Subversion's control?

If you can use TortoiseSVN, the following works for me (=I get the necessary commands in the context menu):

  • Open a search window
  • Search for all the unwanted files
  • Select them in the list
  • Right-click
  • Select "TortoiseSVN" > "Delete"
  • Commit the changes

Done!

Usual disclaimer when giving version control advice, be careful, have backups, I'm not taking any responsibility etc. etc.




回答2:


In a windows command prompt you can perform a recursive file search with 'for' and invoke 'svn delete' for each matching file,

C:\> for /r %i in (abc*def.sql) do svn delete %i

NB: Remember that in a batch file you'll need to replace %i with %%i.

To find out about all the other flags you can use with 'for' (it's the swiss army knife of searching and parsing) use the help command,

C:\> help for



回答3:


If you are running linux or Mac OS, you could go with find, like

$ find . -type d -name "_vti_cnf" -exec svn delete {} \;

I'm no more a SVN user (and never used VSS) though, so you may want to modify the command line and/or try with -print first.




回答4:


Can't you just grep (or some other operation that finds files) the *.scc files in a checked out version, delete them, and then commit?




回答5:


Or use PowerShell:

Foreach ($file in Get-Childitem * -include "*.txt")
{
    svn del $file.name
}

where *.txt is the wildcard and * specifies current directory where to look for the files to be deleted



来源:https://stackoverflow.com/questions/2647337/svn-delete-with-wildcard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!