How can you “get back to this revision” with a specific revision number from the command line?

I am currently creating a script in which I am familiar with Tortoise SVN and related command line functions.

I have a valid script update to find that the Revision builds correctly with a series of tests. After the script writes this variable (for a specific version number), I update the HEAD version (so that I can commit after this process, which I am having problems with).

My question is: How to return to a specific version number from the command line?

I know that you can update svn -r, but how can you do this with a return so that it changes my working copy to an altered state; can it be done later? I only ask because the return does not accept the -r argument; if I'm not mistaken.

I found out how Revisions / Updates works with this question: returning with tortoise SVN But I could not find solid answers to this. Any help would be appreciated.

+4
source share
2 answers

It is important to interpret the terminology correctly, because “return” means something very specific in Subversion, whereas in English it can have several meanings based on context.

  • Subversion "revert" discards any local, uncommitted changes and returns the item back to its last known repository state. This is not what you are looking for.
  • "Returning" via svn update -r actually just updates the file to a specific (previous) version. You are “reverting” to the old revision, but you are not changing anything (and if you try to edit and then commit, you will get a reject because you are not editing the latest version). Again, this is not what you are looking for.
  • The return, as you seem to describe, 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 element (s) as a new HEAD . In Subversion, this is called reverse merging. This is described in the Subversion manual - you give svn merge range of revision numbers in the reverse order (from newest to oldest), and then commit the resulting working copy.
+13
source

in many cases svn merge is preferred

however, when I ran into a similar problem, I found that checking for an earlier (stable) version was more appropriate, as it does not change my local changes, and I can later update it to the current version

+1
source

Source: https://habr.com/ru/post/1481390/


All Articles