0

I am working on svn repo, which has many checkins.

I want to exclude one checkin and build code.

If it is latest checkin revision then can take just one previous to it and build. But need to exclude one checkin older one.

Note: We can revert that code and make checkin. I don't want to do in this way. Instead exclude that checkin.

At last I need single svn command which can do this task for me.

Could please help here?

Thanks.

1
  • I think in svn you cannot rewrite history the same way you can do in git. You could create a separate branch from the commit previous to the one you want to remove and then cherry-pick the ones that follow the one you want to remove... that should give you something like what you are asking but it's a different branch altogether. Commented Apr 26, 2023 at 11:11

1 Answer 1

2

What you are asking for is not possible with a single subversion command.

To undo a specific commit, perform a reverse-merge like this: svn merge -c -BROKEN_REVISION. A merge, however, can only be done on a working copy. This is because a merge might create a conflict and conflict resolution has to be done locally.

Also see the answers to How do I revert an SVN commit?

To have a single command that undoes a commit, you can write a script roughly like this:

# Skip this if you already have a working copy svn checkout ${REPO_URL}/${BRANCH} ${WC_PATH} # Undo the offending commit svn merge --change -${BROKEN_REVISION} ${WC_PATH} # Try to commit the changes # In case of a conflict, this will fail; resolve and commit the change # If you plan to build locally, you can skip this line altogether svn commit --message "Undo ${BROKEN_REVISION}" ${WC_PATH} 

This, of course, will download a working copy from the subversion server, undo the commit locally and attempt to upload the changes, creating a new revision in the process.

Note that it's a fundamental premise of subversion that any change to the repository will create a new revision. So no matter how and where you change things, the revision will be incremented. The only way around this would be to manipulate your repository using the svnadmin command. See Delete all traces of a SVN commit

Sign up to request clarification or add additional context in comments.

2 Comments

I feel that one important note is needed: only an admin with full access to the server computer (and its storage) can manipulate revision history. Regular users who access the repository over HTTP(S) or svn:// don't have such access and cannot manipulate revision history.
The OP is only asking how he can build a program, where he is skipping one revision's changes; he is not asking how to check this back in. As such this example is the answer - use svn merge --change -${BROKEN_REVISION} . to remove that change, and see if stuff works. Often it won't because later changes are dependent on this change; but some times it may work just fine, and allow him to answer the question, "Hmm would the HEAD revision work if that one change from last month was not included...?"

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.