如何在svn日志中显示特定用户的提交?
如何在svn中显示特定用户的提交?我没有找到 svn log 的任何开关。
How to display a specific user's commits in svn? I didn't find any switches for that for svn log.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
svn 没有为此提供内置选项。它确实有一个 svn log --xml 选项,允许您自己解析输出并获取有趣的部分。
您可以编写一个脚本来解析它,例如,在 Python 2.6 中:
如果将上述内容保存为 svnLogStripByAuthor.py,则可以将其调用为:
svn doesn't come with built-in options for this. It does have an
svn log --xml
option, to allow you to parse the output yourself, and get the interesting parts.You can write a script to parse it, for example, in Python 2.6:
If you save the above as svnLogStripByAuthor.py, you could call it as:
由于每个人似乎都倾向于 Linux(等):以下是 Windows 的等效版本:
Since everyone seems to be leaning toward linux (et al): Here is the Windows equivalent:
大部分工作。
或者更准确地说:
works for the most part.
Or to be more accurate:
虽然 yvoyer 的解决方案工作正常,但这里是一个利用 SVN 的 XML 输出,并使用
xmlstarlet
解析它的解决方案。从这里您可以进入更高级的 XML 查询。
While yvoyer's solution works fine, here is one making use of SVN's XML output, parsing it with
xmlstarlet
.From here you could go into more advanced XML queries.
这是我使用 xslt 的解决方案。但不幸的是,xsltproc 不是流处理器,因此您必须给 log 一个限制。用法示例:
svnLogFilter.xslt
svnLogText.xslt
Here’s my solution using xslt. Unfortunately, though, xsltproc is not a streaming processor, so you have to give log a limit. Example usage:
svnLogFilter.xslt
svnLogText.xslt
从 Subversion 1.8 开始,您可以使用
--search
和--search-and
命令行选项,带有svn log
命令。所以它应该像运行 svn log --search JohnDoe 一样简单。
Beginning with Subversion 1.8, you can use
--search
and--search-and
command-line options withsvn log
command.So it should be as simple as running
svn log --search JohnDoe
.您可以使用 Perl 按用户名过滤日志并维护提交消息。只需设置 $/ 变量即可决定 Perl 中“行”的构成。如果您将其设置为 SVN 日志条目的分隔符,Perl 将一次读取一条记录,然后您应该能够匹配整条记录中的用户名。见下文:
You can use Perl to filter the log by username and maintain the commit messages. Just set the $/ variable which decides what constitutes a "line" in Perl. If you set this to the separator of the entries of the SVN log, Perl will read one record at a time and then you should be able to match the the username in the entire record. See below:
获取差异以及签入。
将修订号放入文件中:
现在通读文件并查看版本号。为每个修订版执行 diff:
To GET diffs along with the checkin.
Get the revision numbers into a file:
Now read through the file & executing diff for each revision:
我用Python编写了一个脚本:
并使用:
I had write a script by Python:
and use:
您可以使用它:
它将显示指定用户(USERNAME)所做的每一次提交。
更新
按照@bahrep的建议,subversion 1.8 带有一个
--search
选项。You could use this:
It will show you every commit made by the specified user (USERNAME).
UPDATE
As suggested by @bahrep, subversion 1.8 comes with a
--search
option.对于 Subversion 1.8 或更高版本:
除了作者匹配之外,这还会出现在提交消息中包含该用户名的 SVN 提交,如果您的用户名不是常用单词,则不会发生这种情况。
-l 50
将搜索限制为最新 50 个条目。http://svnbook.red-bean.com /en/1.8/svn.ref.svn.html#svn.ref.svn.sw.search
With Subversion 1.8 or later:
Besides author matches, this will also turn up SVN commits that contain that username in the commit message, which shouldn't happen if your username is not a common word.
The
-l 50
will limit the search to the latest 50 entries.http://svnbook.red-bean.com/en/1.8/svn.ref.svn.html#svn.ref.svn.sw.search