kaushal agrawal
kaushal agrawal

Reputation: 380

Combining Subversion History after deleting and adding a file

I am using svn version 1.9.7 and I accidentally did the following:

cp dir1/a.txt dir2/a.txt

svn rm dir1/a.txt

svn add dir2/a.txt

svn commit

While I intended to do this:

svn mv dir1/a.txt dir2/a.txt

svn commit

As a result, I can not see the previous version history of the file a.txt anymore. I can still see the history of a.txt if I browse back to the older version and check the history of dir1/a.txt.

There has been thousands of new changes in the base directory by now. Is there possibly a way to get a consolidated history just for a.txt in the new location? There are counted few changes in a.txt since I moved to the new location. So I wouldn't mind a bit of copy-paste if it gets the job done.

P.S.: I have read a lot of posts regarding similar problem but I couldn't find something which solves my situation. Please help!

Upvotes: 0

Views: 100

Answers (1)

Lazy Badger
Lazy Badger

Reputation: 97355

Two possible ways:

  1. Dirty hack. Create (on small new test repo) two revisions with OS-cp and SVN move, dump these revisions to dump (svnadmin dump), find difference and replay it in commit of new "big" repo for safety (dump the whole repo, dump revision, load big dump into copy, edit small dump, load it)

  2. More tricky but "natural" way. Update WC to revision before "bad move": you'll have old file in old location. Branch WC, properly move file into new location (identical to location in TRUNK), perform cherry-pick merge from TRUNK to BRANCH for revisions, which change file in question OR (if these changesets have more than singe file) just merge subtree - this singe file OR (if you want to have full&clean history) save every change in file after branchpoint to patch|apply patches and commit BRANCH on per-patch basis, return back to TRUNK's HEAD and merge branch back. As result you'll get repaired common history (with some part of it in branch contrary to old "pure trunk")

Upvotes: 1

Related Questions