Add all unversioned files to Subversion using one Linux command

前端 未结 11 1729
滥情空心
滥情空心 2020-12-23 09:24

Sometimes I include many files in different directories in my project. For now I am adding all files one by one to my project before commit. Is there any Linux terminal comm

11条回答
  •  無奈伤痛
    2020-12-23 09:45

    None of you guys are fully correct I spend a whole night to fix it and it's running properly in my jenkins:

    svn status | grep -v "^.[ \t]*\..*" | grep "^?[ \t]*..*" | awk '{print $2}' | sed 's/\\/\//g' | sed 's/\(.*\)\r/"\1"/g' | xargs svn add --parents
    svn commit
    
    1. status
    2. remove .svn
    3. find ? at the line begining to determine whether it is unversioned (modify it to | grep "^?[ \t]*.*cpp" | will only add cpp)
    4. remove ? (one of the above thread memtion the problem of awk, you may try to use tr or sed instead)
    5. replace splash to linux splash(optional, cygwin need)
    6. enclose line with quote
    7. call xargs(you should add --parent to make sure mid level sub folders are also added if you try to filter cpp or certain file pattern)

提交回复
热议问题