如何只检出 svn 存储库中的一部分外部文件? [英] How to checkout just a part of the externals files in a svn repo?

查看:50
本文介绍了如何只检出 svn 存储库中的一部分外部文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 svn 存储库,并且在同一存储库中的某些文件夹中有一些外部文件.当我检出包含外部文件的文件夹时,svn 也在获取外部文件,但我发现对于实际阶段,只需要其中的一些.

I have a svn repo and somewhere there are some externals to some folders in the same repo. when I checkout that folder containing the externals, svn is fetching also the externals, but I figured out that for the actual phase, only some of them are needed.

我知道做一个 svn co urlA myFolder --depth empty 然后一个 svn up fileA fileB 只是那些文件在 myFolder>(我查看了此处以了解--depth 选项).但它似乎对外部不起作用......

I know that doing a svn co urlA myFolder --depth empty and then a svn up fileA fileB just those files are in the myFolder (I've looked here for understanding --depth option). But it seems that it does not work for the externals...

我已经这样做了(假设 urlA 有 2 个文件夹,一个是 fld 和 ext,有外部文件):

I've done this (supposing the urlA has 2 folders, one is fld and ext, that has the externals) :

$ svn co urlA fldA --depth empty
   U   fldA
  Checked out revision 115
$ svn up --set-depth empty fld ext
  Updating 'fld':
  A    fld
  Updated to revision 115.
  Updating 'ext':
  A    External
  Updated to revision 115.
  Summary of updates:
  Updated 'fld' to r115.
  Updated 'ext' to r115.
$ svn up --set-depth immediates fld ext
  Updating 'fld':
  Restored 'fld'
  Restored 'fld/header.h'
  Restored 'fld/source.cpp'
  At revision 115.
  Updating 'ext':
  Restored 'ext'
  At revision 115.
  Summary of updates:
    Updated 'fld' to r115.
    Updated 'ext' to r115.

即使我使用 propget此处,更新不是检出 ext 中的文件和文件夹.更多,我只想在ext中的一些文件.是否可以?有什么我想念的吗?有人可以帮我吗?

even if I use the propget like here, the update is not checkouting the files and folders in the ext. More, I would like to just some files in the ext. Is it possible? Is there something I am missing out? Can someone help me, please?

推荐答案

经过一番研究,我找到了一种让它发挥作用的方法.我制作了一个只检出所需文件的 bash 脚本:

After some research, I figured out a way to make it work. I made a bash script that is checkouting just the needed files :

#!/bin/bash

EXTERNALS=$(svn propget svn:externals .)

FILES=(header1.h source1.cpp header2.h source2.cpp header3.h header4.h source4.cpp)

IS_URL=true
for i in $EXTERNALS ; do
    echo "=========="
    if [ "$IS_URL" = true ] ; then
        URL=$i
        IS_URL=false
    else
        DIR=$i
        IS_URL=true
        svn co $URL $DIR --depth empty
        LIST=$(svn list $DIR)
        l2=" ${FILES[*]} "
        for item in ${LIST[@]}; do
            if [[ $l2 =~ " $item " ]] ; then
                svn up $DIR/$item
            fi
        done
        rm -rf $DIR/.svn
    fi
done

exit 0

这篇关于如何只检出 svn 存储库中的一部分外部文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆