[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

svn diff - revert - patch does not restore wc state

From: Timur Khanipov <khanipov_at_gmail.com>
Date: Fri, 7 Sep 2018 13:18:08 +0300

Hi, folks.

I have successfully used Subversion for many years and in general I am
happy with it, so I have always defended this VCS when my friends or
colleagues argued in favor of git and other things. But today I stepped
into a very unpleasant situation which I would like to clarify.
I have made a large change to my working copy. I would love to have created
a branch and made a series of little neat commits instead but I could not
due to a specific 'trunk based development' policy of my new employer.
Neither could I commit to trunk because my new colleagues would not approve
the code review unless it contains all the necessary stuff -- unit tests,
etc. So I had around 10 files pending modified and around 10 files which
were copied/removed/moved. Pretty uncomfortable situation, if you ask me --
again, I would really, really love to have it all sequentially commited in
a feature branch.

Then I needed to revert all the changes in the working copy to check if one
test which failed with my changes, worked. I used the following sequence of
commands:
$ svn diff > my.patch
$ svn revert -R .
$ # ... check the test ...
$ svn patch my.patch

Afther applying the `svn patch` command I got a bunch of tree conflict
situations and rejected hunks of modifications. I am now preparing myself
to deal with this somehow (probably by manually copying/moving the files
first and then re-applying the patch) but first I decided to check what
happened. It seems like `svn diff` cannot produce a patch which would
preserve copy/move information. I tested this hypothesis in a separate repo
and it proved true. During my tests I discovered the `svn shelve` command
which is supposed to do precisely what I needed and its description states
"The kinds of change you can shelve are those supported by 'svn diff' and
'svn patch'. The following are currently NOT supported: mergeinfo changes,
copies, moves, mkdir, rmdir, 'binary' content, uncommittable states", so
indeed Subversion could not do what I wanted it to do.

Not only the described behavior contradicts the principle of least
astonishment, there is no way (by supplying specific flags to `svn
diff/patch`) of making Subversion save the full change and restore it. This
is at least disappointing.
Are there any plans to tackle this issue?

Regards,
Timur Khanipov

P.S. I am using Subversion version 1.10.0, r1827917.
Received on 2018-09-07 12:18:30 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.