Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 135083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:43:47+00:00 2026-05-11T06:43:47+00:00

It is good practice to remove old code instead of just commenting it out.

  • 0

It is good practice to remove old code instead of just commenting it out. It is often claimed that the old code parts can always be found again in the old SVN repository revision, if needed.

But practically, it’s not that easy, right? If the old code is in some unknown old SVN revision then it can be quite hard to find.

I’m exactly in that situation right now: There’s a function that I don’t need anymore, and I should throw it out, since it’s in SVN, but I hesitate because I might need it again, and I’m afraid it’s going to be hard to find in the repository.

Of course, one can always make a commit message, saying ‘removed function myFunction’, but sometimes you can’t note every little code removal in the commit message, and it can also be tedious to look through all commit messages to find something again.

An automatic tool would be better, something like

svn find 'void myFunction\(' my-file.cc 

which would tell me the different results from different revisions. Does something like that exist?

EDIT: Do other version control systems have it? Git maybe? (That’d be a reason to switch, I’d say.)

UPDATE: So there’s no real answer except the tiny brittle shell script I found more or less by accident (see my answer below). I think, that’s really a shame for SVN. Finding something in earlier revisions should be one of the central functionalities of version control. Does anyone have more info?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T06:43:48+00:00Added an answer on May 11, 2026 at 6:43 am

    I googled some more and found the following script (see here). I tested it briefly and it seems to be working fine:

    rev_grep.sh ===================== #!/bin/ksh  URL=$1 REGEX=$2  LAST_REV='n/a'  svn log -q $URL | perl -ne 'print '$1\n' if /^r(\d+)/' | while read r do     ##svn cat -r $r $URL | grep '$REGEX' > /dev/null     BUFFER=`svn cat -r $r $URL | grep '$REGEX'`     RET=$?     if [ $RET -eq 0 ]     then         echo 'Match in revision: $r. Removed in $LAST_REV.'         echo $BUFFER          exit 0      elif [ $RET -ne 1 ]     then         ## grep hit an error         exit 2     fi      LAST_REV=$r done exit 1  

    The only problem is that, if your repository requires a password, you’ll have to enter it many times.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it a good practice to comment code that is removed? For example: //
Is it good practice to have a link that just exists for its tooltip?
Is it good practice to check that element exist before remove it or it
Is it good practice to have a class constructor that uses default parameters, or
Is it good practice to have a unit test that specifies how long a
Why is it a good practice to remove PHP files from the htdocs/public directory?
Is it good practice for an object in Objective-C to commit suicide? That is,
I was reading JavaScript: The Good Parts and the author mentions that JavaScript is
I recently saw some Perl code that confused me. I took out all of
What good-practice-indicating idioms do you look for in a sequence of method invocations, as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.