revert to revision in svn

时间:2016-08-31 12:29:55

标签: java eclipse svn

Is there a way to revert to a certain revision while keeping the changes in comments. for example :-

Revision 33:-

public class A{
    private aa;
    private bb;
    private cc;
}

Revision 34:-

public class A{
    private aa;
    private bb;
    private cc;
    private dd;
}

and then there are many other revisions. Now if i revert changes from revision 34, I want the my local copy to look like this:-

Revision 120:-

public class A{
     private aa;
     private bb;
     /* changes from revision 34 reverted by XXXX on YYYY
      * Following changes were reverted:-
      *private cc;
     */
}

Is is possible to do this?

1 个答案:

答案 0 :(得分:0)

This sounds very close to the blame command:

Show author and revision information inline for the specified files [...].

It will show, for every line of the file, the revision it was added/modified and who the author of that revision is. Example:

>svn blame http://svn.apache.org/repos/asf/subversion/trunk/README
 841184    striker
 836593     kfogel                Subversion, a version control system.
 836593     kfogel                =====================================
 836593     kfogel
 841184    striker $LastChangedDate$
 836593     kfogel
 841437    sussman Contents:
 841437    sussman
 841437    sussman      I. A FEW POINTERS
 841437    sussman     II. DOCUMENTATION
 841437    sussman    III. PARTICIPATING IN THE SUBVERSION COMMUNITY
 841437    sussman     IV. QUICKSTART GUIDE
 849422    sussman      V. CONVERTING FROM CVS

If you use TortoiseSVN, you can see the commit message for each line via a tooltip:

tortoiseproc /command:blame /path:http://svn.apache.org/repos/asf/subversion/trunk/README

Screenshot of TortoiseSVN's blame dialog

Note: A limitation of this command is that it will not show you lines that were removed; only lines that are visible in the revision you are blaming will be shown.