rich p
rich p

Reputation: 975

SVN Copy into Working Copy, Can't Un-delete a file (before commit)

I somehow accidentally deleted a file when creating a branch, and I can't figure out how to get it back without losing file history.

What I did

I'm using TortoiseSVN (1.8.2). I copied a branch by doing

right-click, drag, release and select "SVN Copy and rename versioned item here"

I thought that I did nothing else (specifically, I have not committed the new branch in my working copy).

Something must have happened though - it could be pilot error, I'm not sure - but bottom line, a file (NewBranch/app/web/classes/config.properties) didn't show up in the list. Somehow I deleted that file.

When I checked for modifications

right-click, TortoiseSVN -> Check for modifications

the files & folders of the branch appeared with status "normal(+)", with two exceptions:

TortoiseSVN showed a red "!" as the status for the parent folder (NewBranch/app/web/classes) and gave the same status for its parent (web) and its parent (app) and the branch root (NewBranch).

Fixing it?

  1. I tried "right-click, Revert" on the file in the "Check for modifications" output window - it gave me an error

    "can't revert without reverting parent".

  2. I tried doing a "Revert" on the parent folder, and its parent, up to the branch root - I don't get an error but the file does not re-appear.

  3. I tried copying the file from the old branch to this folder - it says I'm adding the file!

Arrg.

I'd like to have the file not deleted & preserve its history. I'll copy the file in if I must - but, any ideas?

Upvotes: 1

Views: 119

Answers (1)

Peter Parker
Peter Parker

Reputation: 29715

As long as you did not commit you did not lose much.

As fixing ("reverting") the working copy is causing problems, I would start over with a re-checkout:

Just check out the folder you want to branch and choose TortoiseSVN->branch/tag. choose the branch/ folder and add your branchname. by this it is much easier to create a branch (without creating it in your workingcopy as well).

Upvotes: 1

Related Questions