简体   繁体   中英

How to fix subversion <<!>> and <<?>> status automatically?

I use svn to sync my text files or any important notes which i place in my mac filesystem to my server. So, when i modify the file i use Sublime to add or delete files which are under svn-control and thus gets unsync with svn commands.

How do i fix it other than running the svn commands? I know i should use svn commands to rename or add or remove the files, but how do i do without using svn command? In Windows, i believe tortise SVN make note of those changes and we just need to commit but is there any software for mac which does the samething?

$ svn status
?       MySql/MySQL_Start_On_Different_OS
!       OS/Software/Nginx_Atmosphere.txt
!       OS/Software/Nginx_Caching.txt
!       OS/Software/Nginx_RpmInstallation.txt
!       OS/Software/Nginx_Windows.txt

Again, i know i can fix the above status by doing svn add or svn remove <filename> . Atleast was there any command or script that convert ! to remove and ? to add ?

To the first part of your question: Since you mention TortoiseSVN, I think you are looking for a graphical user interface to svn that helps you with adding/deleting files. Here is a short overview of available clients for OS X. I have personally used Cornerstone and was content enough with it, although there are certainly cheaper options that sound like they fulfil your requirements just as well.

As to the part where you are looking for a scripting solution: Use

svn st | grep "^?" | awk '{print $2}' | xargs svn add

to add all files marked as unknown by svn (ie ? ). Use

svn st | grep '^!' | awk '{print $2}' | xargs svn rm

to remove all files that were already marked as deleted by hand (eg ! ). Then commit to svn with

svn ci -m "Your commit message goes here."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM