1

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?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
ArslanAnjum
  • 1,674
  • 2
  • 17
  • 31
  • 1
    Possible duplicate of [svn: How to revert somebody else's commit?](http://stackoverflow.com/questions/28266893/svn-how-to-revert-somebody-elses-commit) – alroc Aug 31 '16 at 12:36
  • 1
    Rolling back changes has been covered [many times on SO](https://stackoverflow.com/search?q=svn+reverse+merge) (and I've linked to one of those as a duplicate) but as for inserting comments? That should be in the commit message, not your source code because it's the history of the file, not the code or explanation of how/why the code works in the first place. Subversion has no knowledge of programming languages or comments, so it would not be appropriate to start changing your code (as it might break). – alroc Aug 31 '16 at 12:38
  • I was thinking that this would be nice to have an overlay view to show comment in the code where that particular change was made. – ArslanAnjum Aug 31 '16 at 14:14
  • That's what your SVN history is for. If people need to see the change, they can use `svn diff`. Don't clutter your code with commented-out cruft that's no longer needed. – alroc Aug 31 '16 at 14:54

1 Answers1

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.

Patrick Quirk
  • 23,334
  • 2
  • 57
  • 88