我正在使用SVN提交注释将一些关键字与提交的文件相关联.我现在正在尝试查找所有提交的文件 - 在任何修订版中 - 在评论中都有一个特定的关键字.可能吗 ?
谢谢提前!
编辑更多信息:我可以使用TortoiseSVN(来自我的本地,Windows 7 64位)或命令行(来自我们的集成服务器,linux)
再次编辑:乌龟中的"显示日志"不允许我从任何日期搜索.现在我无法从去年开始搜索...但仅限于2012年2月15日......有什么方法可以解决这个问题吗?
================================================== ===========================
最后的回答:我终于按照我的意愿使它工作了.我想让所有这些日志用于svn导出.最终脚本名为ExportAllRevisionsFromKeyword.sh:
#!/bin/sh
if [ ! $1 ];then echo "No keyword specified. Needs for example a ticket number : PROJECT-XXX. The command will be : ./SearchCommitsFromComment.sh PROJECT-XXX";exit;fi
cd /root/PROJETS/myproject/
SEARCH=$1
echo "Searching revisions committed with keyword "$SEARCH
svn log | awk '{
if ( $1 == "------------------------------------------------------------------------") {
getline
REVISION = $1
}
else {
if (match($0, SEARCH)) {
print "Keyword found in " REVISION ". Export coming..."
system("./var/batchesFolder/svnxport.sh . " substr(REVISION,2) " var/batchesFolder/sorties/svnExports/" SEARCH)
}
}
}' SEARCH="$SEARCH"
Run Code Online (Sandbox Code Playgroud)
如你所见,我正在调用另一个脚本.它的灵感来自Julien Falconet的教程,名为svnxport.sh:
#!/bin/sh
# svnxport.sh
# Export only modified files in SVN
#
# Copyright (C) 2009 by Julien Falconnet
# http://www.falconnet.fr
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.
#
#
#BEWARE : This script does not operate correctly with files whose filename contains spaces
# tests for parameters
if [ ! $1 ];then echo "svnxport : No source specified. Needs : source revision target_directory";exit;fi
if [ ! $2 ];then echo "svnxport : No revision specified. Needs : source revision target_directory";exit;fi
if [ ! $3 ];then echo "svnxport : No target_directory specified. Needs : source revision target_directory";exit;fi
# check if the target_directory allready exists
#if [ -d $3 ];then echo "svnxport : target_directory '$3' allready exists. Remove it or change target_directory parameter.";exit;fi
# we use svn diff to select changed files between $2-1 and $2 revisions and only keep those updated or added.
sourceDir=$1
revision=$2
previous=$(($revision - 1))
targetDir=$3
escapedSourceDir=$1
if [ $escapedSourceDir == '.' ]
then
escapedSourceDir='\\.'
fi
echo "Processing : source($sourceDir), revision($revision), target_directory($targetDir)"
# Then the 'for' separate status from filename (here is the problem with file with blanks)
for myfile in `svn diff -r $previous:$revision --summarize $sourceDir | grep -e '^M ' -e '^A '`
do
if [ "$myfile" = "M" -o "$myfile" = "AM" -o "$myfile" = "A" -o "$myfile" = "." -o -d $myfile ]
then
# we ignore the status, and the directory to update
continue
else
#we focus on true changed files
#first we create needed directories for the current file
#note that we use a relative directory system
outfile=`echo $myfile |sed "s|$escapedSourceDir||g"`
dir="$targetDir/$outfile"
mkdir -p $(dirname $dir)
#then we export the file
svn export --force $myfile $targetDir/$outfile >> /dev/null
echo "export $targetDir/$outfile "
fi
done
# List other files. Changed but not exported. Mainly the deleted ones.
# Usefull to know which files should be removed and follow weird comportment
#echo "Watch for : "
#svn diff -r $previous:$revision --summarize $sourceDir | grep -v -e 'M ' -e 'A ' |sed "s|$sourceDir||g"
echo $'\n'
Run Code Online (Sandbox Code Playgroud)
而现在,唯一要做的就是进入我的版本化网站root,然后打电话
./path/to/scripts/ExportAllRevisionsFromKeyword.sh PROJECT-XXX
它将搜索使用包含"PROJECT-XXX"关键字的注释提交的任何修订,并将该修订版修改的文件的HEAD修订版导出到新文件夹中: path/to/scripts/sorties/svnExports/PROJECT-XXX
我需要说Nishant对他给我的联系非常有帮助.非常感谢 !:)
小智 8
使用Tortoise SVN,您可以轻松找到您的提交:
右键单击=> SVN Checkout =>显示日志
一个新的窗口将打开,你会找到一个文本aera,输入你的关键字和乌龟将自动找到你的提交.
现在,如果你不使用Tortoise,抱歉这个无用的答案.
| 归档时间: |
|
| 查看次数: |
1654 次 |
| 最近记录: |