Generate history of changes on a file in svn

有些话、适合烂在心里 提交于 2019-11-30 14:00:28

问题


Is it possible to generate a file, which includes summary(what, when, by whom ) of all the changes made on a certain file? Used to have such option in VSS(I think it was called "History"), and it was great for going back and tracking who made a certain change and when.

BTW, I'm using tortoisesvn

Thank you in advance


回答1:


Right click on file in explorer, then "TortoiseSVN", "Show log".

Uncheck "Hide unrelated changed paths" Uncheck "Stop on copy/rename" Check "Include merged revisions" Click "Show All"

Now, in the top pane you a list of revisions with username, date and log. Click on a revision you're interested in and you can see the full log in the second pane. The third pane shows you every file that was changed in the chosen revision. Double-click on your file in this pane and you can see the changes made in that file.

As remarked previously, Tortoise has a "Blame" functionality which is often very insightful but it can only show the most recent edit on each line of source. And if someone has deleted lines, you don't see their change at all.

Edit:

If you're willing to go to the command-line tool and bash, this question has been answered before: How can I view all historical changes to a file in SVN

On a Windows PC, the best way to get bash and command-line SVN is by installing Cygwin.




回答2:


Here's a batch file translation of bendin's bash script in How can I view all historical changes to a file in SVN:

@echo off

set file=%1

if [%file%] == [] (
  echo Usage: "%0 <file>"
  exit /b
)

rem first revision as full text
for /F "tokens=1 delims=-r " %%R in ('"svn log -q %file%"') do (
  svn log -r %%R %file%
  svn cat -r %%R %file%
  goto :diffs
)

:diffs

rem remaining revisions as differences to previous revision
for /F "skip=2 tokens=1 delims=-r " %%R in ('"svn log -q %file%"') do (
  echo.
  svn log -r %%R %file%
  svn diff -c %%R %file%
)

Note that this batch file requires a command line SVN client (not TortoiseSVN) to be in your path. I personally use SilkSVN, but there are several.




回答3:


As @pajton mentioned, you could use svn log <filename>. The documentation provides the details/limitations.




回答4:


You might find svn blame <filename> to be more useful because it will tell you who/what/when for a specific revision of a file.




回答5:


I would just like to add that recent version of tortoise also include command line tools, you just need to select them on installation



来源:https://stackoverflow.com/questions/5622367/generate-history-of-changes-on-a-file-in-svn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!