4

I am currently making a script in which I have been coming familiar with Tortoise SVN and it's corresponding command line functions.

I have the script properly updating to find which "Revision" properly builds with a series of test. After the script records that variable (of the version number to be specific), I update to the HEAD revision (So that I am able to a commit after this process I am having trouble with).

My question: How do I revert to a specific revision number from the command line?

I know that you can svn update -r , but how can you do it with a revert so that way it changes my working copy to the modified state; later that can be committed? I only ask because revert doesn't accept the -r argument; unless I am making a mistake.

I found out how Revisions/Updates it works from this question: reverting with tortoise SVN But I couldn't find any solid answers on this. Any help would be appreciated.

Community
  • 1
  • 1
Chris
  • 59
  • 2
  • 6

2 Answers2

14

It's important to get the terminology correct, because "revert" means something very specific in Subversion, whereas in English it can have multiple meanings based on context.

  • A Subversion "revert" is undoing any local, uncommitted changes and resetting the item back to its last known repository state. This is not what you're looking for.
  • "Reverting" via svn update -r is actually just updating the file to a specific (past) revision. You're "reverting" to an old revision, but you aren't really changing anything (and if you attempt to edit, then commit, you'll get rejected because you aren't editing the latest revision). Again, this is not what you're looking for.
  • A revert as you seem to be describing it would be better described as a "rollback" - you want to undo any changes made between the current revision and some revision in the past, and then commit the state of the item(s) as the new HEAD. In Subversion, this is referred to as a reverse merge. This is described in the Subversion manual - you supply svn merge with a range of revision numbers, in reverse order (newest to oldest), then commit the resulting working copy.
alroc
  • 27,574
  • 6
  • 51
  • 97
  • This works, thank you! I was using the term "Revert" because that's the term they used in the GUI. Whenever I did a revert to a revision it would modify it so it can be re-committed. But after reading this section I understand why it's called a reverse merge. I wasn't looking for this term because I haven't used it. Rookie's mistake. Cheers! :) – Chris May 17 '13 at 14:01
  • Awareness win: "It's important to get the terminology correct, because "revert" means something very specific in Subversion, whereas in English it can have multiple meanings based on context." – ahnbizcad Aug 03 '15 at 20:25
1

in many cases svn merge is preferable

however when I occured a similar problem, I found that a checkout to an earlier (stable) revision was more suitable, because it doesn't change my local changes and I can later still update to the current version

Hachi
  • 3,237
  • 1
  • 21
  • 29