Хммм. Интересный вопрос.
Если вас интересуют только файлы, видимые в последней ревизии, вы можете сделать что-то вроде этого:
$ svn --recursive list
Это даст вам список всех файлов в Subversion (по крайней мере, тех, которые в настоящее время находятся в HEAD ветвей и транков)
Оттуда вы можете передать это в команду Subversion log
для каждого файла, чтобы увидеть, какие пользователи изменили этот файл за время его жизни.
$ svn -R $URL | while read file
do
echo "FILE = $file"
svn log $URL/$file
done
Теперь все будет немного сложнее (по крайней мере, делать это в оболочке). Вам нужно будет проанализировать вывод команды svn log
, что означает, что вы снова читаете из STDIN. Чтобы обойти это, вам нужно будет открыть другой номер устройства для этого выхода и выполнить чтение во время чтения ...
Хорошо, давайте сделаем это на Perl ...
# 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, но я старался изо всех сил объяснить, что я делал. Это инструмент, который я знаю, как использовать. Когда у вас есть молоток, все выглядит как гвоздь. Даже если это большой уродливый старый устаревший молоток, который у вас есть.