SVN command to delete all locally missing files

后端 未结 12 2374
说谎
说谎 2020-12-12 09:13

In SVN is there a command I can use to delete all locally missing files in a directory?

Or failing that, some way of listing only those files that are missing (or, i

12条回答
  •  自闭症患者
    2020-12-12 09:42

    When dealing with a lot of files, it can happen that the argument input to xargs is getting too long. I went for a more naive implementation which works in that case, too.

    This is for Linux:

    #! /bin/bash
    # 1. get all statii in the working copy
    # 2. filter out only missing files
    # 3. cut off the status indicator (!) and only return filepaths
    MISSING_PATHS=$(svn status $1 | grep -E '^!' | awk '{print $2}')
    # iterate over filepaths
    for MISSING_PATH in $MISSING_PATHS; do
        echo $MISSING_PATH
        svn rm --force "$MISSING_PATH"
    done
    

提交回复
热议问题