如何过滤掉“.svn”结帐过程中的文件?

发布于 2024-10-08 13:31:04 字数 79 浏览 3 评论 0原文

Subversion 签出会在“.svn”树下生成大量文件。 有没有办法在结账过程中过滤掉“.svn”文件?

谢谢,

Subversion checkouts produce a large number of files under the '.svn' trees.
Is there any way to filter out '.svn' files during the checkout process?

Thanks,
Sen

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ま柒月 2024-10-15 13:31:04

请参阅svn 导出。应该有帮助。

第一种形式从 URL 指定的存储库导出一个干净的目录树,如果给出了修订版 REV,则在 HEAD 处,否则在 HEAD 处导出到 PATH 中。如果省略 PATH,则 URL 的最后一个部分将用作本地目录名称。

正如 yodaj007 所说,这将从修订版中提取所有文件,并且该目录将不是修订版控制的目录。要获取修订控制目录,您可以使用通常的svn co

See svn export. It should help.

The first form exports a clean directory tree from the repository specified by URL, at revision REV if it is given, otherwise at HEAD, into PATH. If PATH is omitted, the last component of the URL is used for the local directory name.

As yodaj007 says, this will extract all the files from a revision and the directory will not be a revision controlled one. To obtain revision controlled directory, you use the usual svn co.

淡莣 2024-10-15 13:31:04

我知道这是一篇迟到的文章,但如果您不希望将 .svn 文件存储在您的目录中,因为您想将其压缩或将其交给其他没有这些文件的人,请使用此 perl 脚本来删除.svn 文件。请注意,使用此选项后,您将无法使用 svn commit 提交回存储库,因为您删除了 .svn 文件。

#!/usr/bin/perl

use File::Path;
use strict;

# Only run program on valid input MAX/MIN_INPUT = 1
if ( @ARGV == 1 ) {
    my $file = $ARGV[0];
    #Do some regular expression verrification
    &dot_svn_del_func ( $ARGV[0] );
} else {
    die "ERROR: to many arguments passed";
}

sub dot_svn_del_func {
    my $path = shift;
    opendir (DIR, $path) or die "Unable to open $path: $!";
        my @files = grep { !/^\.{1,2}$/ } readdir (DIR);
        closedir (DIR);
        @files = map { $path . '/' . $_ } @files;
        for (@files) {
            if (-d $_) {
            my $svn_found = 0;
            my $path = $_;
            my @path_components = split(/\//,$path);
            my $path_count = 0;
            foreach my $new_path (@path_components) {
                if ( $new_path eq ".svn" ) {
                    rmtree($_,1,1);
                    $svn_found = 1;
                }   
                $path_count++;
            }
            if ( $svn_found == 0 ) {
                #print "Making recursive calls from ".$_."\n";
                        &dot_svn_del_func ( $_ );
            }
        }
   }

}

I know this is a late post, but if you don't want the .svn files stored in your directory because you want to zip it up or hand it off to someone else void of those files, please use this perl script to remove the .svn files. Note by using this you would not be able to use svn commit to commit back to the repository since you delete the .svn files.

#!/usr/bin/perl

use File::Path;
use strict;

# Only run program on valid input MAX/MIN_INPUT = 1
if ( @ARGV == 1 ) {
    my $file = $ARGV[0];
    #Do some regular expression verrification
    &dot_svn_del_func ( $ARGV[0] );
} else {
    die "ERROR: to many arguments passed";
}

sub dot_svn_del_func {
    my $path = shift;
    opendir (DIR, $path) or die "Unable to open $path: $!";
        my @files = grep { !/^\.{1,2}$/ } readdir (DIR);
        closedir (DIR);
        @files = map { $path . '/' . $_ } @files;
        for (@files) {
            if (-d $_) {
            my $svn_found = 0;
            my $path = $_;
            my @path_components = split(/\//,$path);
            my $path_count = 0;
            foreach my $new_path (@path_components) {
                if ( $new_path eq ".svn" ) {
                    rmtree($_,1,1);
                    $svn_found = 1;
                }   
                $path_count++;
            }
            if ( $svn_found == 0 ) {
                #print "Making recursive calls from ".$_."\n";
                        &dot_svn_del_func ( $_ );
            }
        }
   }

}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文