- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有时我们会向 SVN 提交一个 C# 项目文件,其中引用了我们忘记添加到 SVN 的文件。是否有任何预提交钩子(Hook)脚本可以解析 .csproj 文件并在它引用未版本控制的文件时拒绝提交?
最佳答案
#!/usr/bin/perl
# Checks for source files which have been added to a csproj in a commit
# but haven't themselves been committed.
use Modern::Perl;
use warnings FATAL => 'syntax';
use File::Basename qw(basename);
use XML::Simple;
die "usage: $0 repo transaction\n" if @ARGV != 2;
my $opt = "-t"; # -r for testing
my ($repos, $txn) = @ARGV;
# If you really, really want to add a file to the proj and
# not commit it, start your commit message with a !
my @info = `svnlook info $opt $txn "$repos"`;
exit 0 if ($info[3] =~ /\A!/);
my @lines = `svnlook changed $opt $txn "$repos"`;
my @projects = grep { /\AU/ }
grep { /[.]csproj\z/ }
map { chomp; $_ } @lines;
my @filelist = `svnlook tree $opt $txn "$repos" --full-paths`;
my %present;
foreach (@filelist) {
chomp;
$present{$_} = 1;
}
foreach (@projects) {
m"\AU.\s\s([\w/.]+/)([\w]+\.csproj)\z" or die "bad line $_";
my ($path, $proj) = ($1, $2);
my $projfile = `svnlook cat $opt $txn "$repos" $path/$proj`;
my $xml = XMLin($projfile);
# Tested with VS 2012 project files
my @includes = @{$xml->{ItemGroup}->[1]->{Compile}};
# All the source files in the csproj
my @filenames = map {$_->{Include}} @includes;
foreach (@filenames) {
# ignore "../etc", not below the project file in the tree
next if /\A[.][.]/;
# if you have files that are in the proj but shouldn't be committed
# eg some generated files, add checks for them here
# next if /MyGeneratedFile.cs\z/;
my $file = $path . $_;
# The csproj file speaks windows paths, but svn will output unix ones
$file =~ tr|\\|/|;
if (!defined $present{$file}) {
die "The file $file is included in the project $path\\$proj, but is not present in the tree, did you forget to commit it?";
}
}
}
关于visual-studio - SVN 预提交 Hook 以确保 .csproj 中引用的所有文件都是版本化的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7797942/
在做了一些重构之后,在 Eclipse 中,Subversion 在提交时开始提示。我不知道如何解决它。我已经设法删除(并提交了删除 GPFragmentRef.java 。 >niclas@nl:~
我想找出我与前一段时间合并的内容(我只是忘记了),而我的印象是“ svn propget svn:mergeinfo”将打印此类信息。 我正在与进行合并的计算机不同的计算机上运行此计算机。 有任何想法
我要求我的一个开发人员为每个开发人员提供一个不同的主干副本,以便在/branches 中工作(以他们自己的名义)。 该开发人员在颠覆方面没有经验(我也没有),所以我试图通过将主干复制到每个分支文件夹并
我已经使用 git-svn 从工作中克隆了一个 SVN 存储库。在初始克隆期间,我提供了一个 SVN 作者文件。当我进行初始克隆时,git 将 authorsfile 设置为绝对路径。但是,我在工作机
我试图了解常规 svn://和 svn+ssh://访问在颠覆存储库安全性方面的差异。 我已经在自定义端口和 IP 地址中设置了我的 subversion 存储库,并在防火墙上打开了相同的端口,并将存
好吧,我知道这是一个贫民窟设置,但至于为什么,它只是“那些东西”中的另一个。 这是设置。 在 subversion 中,我在一个 repo 中有两个项目: svn/path/projectA svn/
我们目前遇到包含空白的目录问题,这些目录是 svn auth 文件中规则的一部分。所以我们想要基于路径的授权,并且有一个包含以下内容的文件: [/] * = rw [/junk of me] * =
我目前在一台服务器上使用一个 svn 存储库,但为了使其更安全。我在另一台服务器上设置了另一个 svn 存储库,如何使用主服务器上 svn 中的信息镜像辅助服务器上的 svn? 最佳答案 您可以使用
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 4 年前。 Improve this qu
最近我对本地 svn 配置文件进行了一系列更改。我主要纠正了大约 15 种不同文件类型的 svn:mime-type 属性。现在我需要根据这个新配置重置所有以前 checkin 的文件。 SVN 似乎
我最近获得了一个新职位,发现他们没有版本控制。 我将大部分时间花在 Visual Studio 上,过去我使用过(由以前的公司预装)AnkhSVN 和 Visual SVN,他们都使用 Visual
有没有办法恢复svn repo的结帐? 我不小心检查了用户文件夹中的大量代码库,手动删除所有内容真的很痛苦,有没有办法删除工作副本? 有没有类似 svn autoclean ? 最佳答案 SVN 并不
我们想将我们的代码从本地 SVN 服务器移动到托管解决方案,我们应该如何将代码复制并重新导入到托管 SVN 服务器。主要问题是我们不想在重新导入时指向旧的 svn 数据文件。 最佳答案 我认为 svn
我创建了一个分支,然后对需要合并到分支中的主干进行了更改。 TortoiseSVN 有一个非常方便的合并分支->主干实用程序,但是要这样做,我是否必须手动合并特定的修订范围? 最佳答案 使用 SVN
是否有一种简单的方法可以将目录从一个存储库复制到另一个存储库并复制所有历史记录? 最佳答案 最简单的方法是使用: svnadmin dump path/to/repos > repos.out 这将为
我在 Linux 机器上有 3 个 svn 存储库 Main Project -trunk -branches -tags Project A -trunk -branches
我需要使用 SVN 的一些功能,如分支、历史记录、还原、修订我的本地代码副本,但我只想在某个时候提交到服务器存储库,当我完成本地开发时。有可能吗?谢谢。 最佳答案 这就是 Subversion 的模型
我已经用 svn merge -r COMMITTED:PREV 恢复了我最后一次意外的 SVN 提交。 看起来文件现在没问题了,但我仍然在 svn 日志中看到那个意外提交. 还好吗?我可以从历史记录
我正在寻找一种自动将工作副本中的所有未版本控制文件“svn add”到我的 SVN 存储库的好方法。 我有一个实时服务器,可以创建一些应该受源代码控制的文件。我想要一个简短的脚本,我可以运行它来自动添
我有一个 SVN 项目的只读访问权限。我检查了该项目,现在我想处理本地副本(并希望一路对其进行版本控制,但我不能在同一个 SVN 中,因为我没有访问权限,而是我刚刚创建了一个分支)所以,我创建了一个新
我是一名优秀的程序员,十分优秀!