SVN checkout ignore folder

前端 未结 10 1804
孤城傲影
孤城傲影 2020-11-30 17:52

Can I ignore a folder on svn checkout? I need to ignore DOCs folder on checkout at my build server.

edit: Ignore externals isn\'t an option. I have

10条回答
  •  臣服心动
    2020-11-30 18:32

    I have recently resolved the same task. The idea is to get the immediate list of folder/files under the repository exclude the entries you need, then check out the remaining folders and update the immediate files if any. Here is the solution:

        # Path to the svn repository to be checked out
    rpath=https://svn-repo.company.com/sw/trunk/ && \
        # This files are to be excluded (folders are ending with '/')
        # this is a regex pattern with OR ('|') between enties to be excluded
    excludep='docs_folder/tests_folder/|huge_folder/|file1|file2' && \
        # Get list of the files/folders right under the repository path
    filtered=`svn ls $rpath | egrep -v $excludep` && \
        # Get list of files out of filtered - they need to be 'uped'
    files=`echo $filtered | sed 's| |\n|g' | egrep '^.*[^/]$'` && \
        # Get list of folders out of filtered - they need to be 'coed'
    folders=`echo $filtered | sed 's| |\n|g' | egrep '^.*[/]$'` && \
        # Initial nonrecursive checkout of repository - just empty
        # to the current (./) working directory
    svn co $rpath ./ --depth empty && \
        # Update the files
    svn up $files &&\
        # Check out the all other folders finally.
    svn co `echo $folders | sed "s|\<|$rpath|g"`
    

    Change to source working directory. Copy the commands. Paste. Change appropriate URL and exclude pattern. Run the command.

    Thanks,

提交回复
热议问题