흠. 재미있는 질문. 최신 버전에서 볼 파일에만 관심이 있다면
, 당신이 뭔가를 할 수 있습니다 :
$ svn --recursive list
는 그 (당신에게 적어도 사람 서브 버전에있는 모든 파일의 목록을 줄 것이다 현재 지점과 트렁크의 HEAD에 있음)
거기에서 각 파일에 대한 Subversion log
명령으로이 파일을 파이프하여 해당 파일의 수명 시간에 해당 파일을 수정 한 사용자를 확인할 수 있습니다.
$ svn -R $URL | while read file
do
echo "FILE = $file"
svn log $URL/$file
done
이제 약간의 문제가 발생합니다 (최소한 쉘에서는이를 수행함). svn log
명령의 출력을 구문 분석해야합니다. 즉, STDIN에서 다시 읽는 것입니다. 그 해결하기 위해서는, 해당 출력을 위해 다른 장치 번호를 열고있는 동안 그에서 읽을해야 할 것이다 ...
이
좋아, 펄에서이 작업을 수행 할 수 ...
# Bunch of Pragmas that don't mean much
use strict;
use warnings;
use feature qw(say);
# Defining some constants for svn command and url
use constant {
URL => "svn://localhost",
SVN => "svn",
};
my $cmd;
# This creates the svn list command to list all files
# I'm opening this command as if it's a file
$cmd = SVN . " list -R " . URL;
open (FILE_LIST, "$cmd|")
or die "Can't open command '$cmd' for reading\n";
# Looping through the output of the "svn list -R URL"
# and setting "$file" to the name of the file
while (my $file = <FILE_LIST>) {
chomp $file;
# Now opening the "svn log URL/$file" command as a file
$cmd = SVN . " log " . URL . "/$file";
open(FILE_LOG, "$cmd|")
or die "Can't open command '$cmd' for reading\n";
my $initialChanger = undef;
my $changer;
# Looping through the output of the "svn log" command
while (my $log = <FILE_LOG>) {
chomp $log;
# Skipping all lines that don't start with a revision number.
# I don't care about the commit log, I want the name of the
# user who is in the next section over between two pipes
next unless ($log =~ /^\s*r\d+\s+\|\s*([^|]+)/);
# The previous RegEx actually caught the name of the changer
# in the parentheses, and now just setting the changer
$changer = $1;
# If there is no initialChanger, I set the changer to be initial
$initialChanger = $changer if (not defined $initialChanger);
# And if the changer isn't the same as the initial, I know at least
# two people edited this file. Get the next file
if ($initialChanger ne $changer)
{
close FILE_LOG;
next;
}
}
# Finished with file log, if we're down here, there was only
# one person who edited the file.
close FILE_LOG;
say qq(Sole Changer of "$file" is "$changer");
}
빠르고 지저분하고 잘 테스트되지 않았습니다. 내 저장소에서 테스트했지만 저장소에서 유일한 변경자입니다. 당신이 Perl을 요구하지 않았다는 것을 알고 있지만, 최선을 다해 제가 한 일을 설명하려고 노력했습니다. 그것은 사용법을 알고있는 도구입니다. 망치가 있으면 모든 것이 못처럼 보입니다. 그것이 오래된 추악한 오래된 망치 일지라도 당신은 가지고있는 일이 있습니다.
내가 이것을 시도해 보자. Perl 사용은 문제가되지 않습니다. –
감사합니다. 이것은 완벽하게 작동했습니다. 방금 파일 목록을 얻기 위해 출력 텍스트를 변경했습니다. 내가 원했던 것. –