Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353393 - Incorrect behaviour when copying and renaming / deleting the file afterwards (commit fails)
Summary: Incorrect behaviour when copying and renaming / deleting the file afterwards ...
Status: RESOLVED WORKSFORME
Alias: None
Product: Subversive
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Igor Burilo CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-29 06:27 EDT by Dmitry Katsubo CLA
Modified: 2012-04-20 08:48 EDT (History)
1 user (show)

See Also:


Attachments
Test repository with two successfull commits by described scenario (26.41 KB, application/octet-stream)
2011-07-31 03:37 EDT, Alexander Gurov CLA
no flags Details
One more scenarion [I've missed deletion of Two.java first] (30.56 KB, application/octet-stream)
2011-07-31 03:47 EDT, Alexander Gurov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Katsubo CLA 2011-07-29 06:27:31 EDT
Build Identifier: Subversive (0.7.9.I20110207-1700), SVNKit 1.3.5 (2.2.2.I20110124-1700)

I feel like Subversive is messing up things when I copy the file to new location, and then rename / remove the file.

Assuming I have projects:
A
+ src/main/java/org
  + One.java
  + Two.java
and project B:
B
+ src/main/java
both in the same SVN repository.

Reproducible: Always

Steps to Reproduce:
1. Copy the package "org" from A to B using the "Team -> Copy To" facility (copy A/src/main/java/org to B/src/main/java) [OK, both "One.java" and "Two.java" are marked with blue clock marker]
3. Rename (F2) "One.java" -> "OneImpl.java" in project B [OK, Subversive reports:
*** Move
	D C:/workspace/B/src/main/java/org/One.java
]
4. Delete (Del) "Two.java" [OK, Subversive reports:
*** Delete
	D C:/workspace/B/src/main/java/org/Two.java
]

Now commit both A+B. Problem reported:

*** Commit
	A C:/workspace/B/src
	A C:/workspace/B/src/main
	A C:/workspace/B/src/main/java
	A C:/workspace/B/src/main/java/org
	D C:/workspace/B/src/main/java/org/One.java
	A C:/workspace/B/src/main/java/org/OneImpl.java
	D C:/workspace/B/src/main/java/org/Two.java
svn: Commit failed (details follow):
svn: File 'B/trunk/src/main/java/org/Two.java' is out of date
Committed revision -1
*** Warning

'B/trunk/src/main/java/org/Two.java' does not exist in remote repository! Obviously the update of A+B does not help...

So, what I did:
* Edit "B/src/main/java/org/.svn/entries" and remove the section about file "Two.java"
* Refresh "B" project
* Repeat commit -- it succeeds

After the commit, check the history for OneImpl.java. The history is lost (only one revision is there).

Expected:
1) The removed file is properly tracked.
2) The renamed file is properly assigned a parent entry.
Comment 1 Alexander Gurov CLA 2011-07-29 09:56:09 EDT
I don't see where there is a wrong behaviour. SVN client library says: "svn: File 'B/trunk/src/main/java/org/Two.java' is out of date".
"Out of date" literally means that the resource has some incoming changes (even if it is only revision change - for SVN it matters).
So, you got an error because your working copy wasn't up to date and this is how it is supposed to work in SVN.

So, if there is no deeper meaning to the report, I will close the report shortly.
Comment 2 Dmitry Katsubo CLA 2011-07-29 17:15:26 EDT
Alexander, when you say "the resource has some incoming changes" which exactly resource do you mean? Is it "B/trunk/src/main/java/org/Two.java"? Is yes, then perhaps you have missed the point that the path "src/main/java/org" does not exist on SVN server yet (that is visible from Subversive console log, see "Committed revision -1", which is also strange message by it own). Also nobody has committed to projects A+B in a meanwhile. The only possibility is that somebody has committed to other project (not A and not B), changing the revision of the whole SVN repository, but that should not matter, right? (otherwise I can't potentially ever commit in organization with several thousands of employees, actively committing to SVN)

Also note, that I _have_ updated A+B ("Team -> Update") before doing the commit. For me it is obvious, that can't help. Your advise to update the repository does not correlate to the fix: I have fixed the problem by removing the entry from ".svn/entries". Do you assume, that "svn update" can remove this entry (taking into account that "B/trunk/src/main/java/org/" does not exist remotely)?

Also: any comments on lost history for "OneImpl.java"? Sorry, but closing the report will not solve the issue. It's not the first time I catch it and to workaround one really need to hack into SVN internals.
Comment 3 Alexander Gurov CLA 2011-07-31 03:37:14 EDT
Created attachment 200627 [details]
Test repository with two successfull commits by described scenario

You see, I have actually tried what you have described, but with up-to-date projects, of course, and everything were committed perfectly. I even tried two slightly different cases to ensure I've covered all the possible ways of reproducing your problem. And there in attachement we have a repository with two successfull commits: both were made by your scenario.
Please check the repository in attachement (there are 3 projects) and read commit comments - they describes what were done in each case.

P.S.
So, as I've told before, SVN requires up-to-date working copies before performing any refactoring-like activities.
If there was any difference between my and your cases, then please point me were this difference is.
Comment 4 Alexander Gurov CLA 2011-07-31 03:47:07 EDT
Created attachment 200628 [details]
One more scenarion [I've missed deletion of Two.java first]

(In reply to comment #2)
Sorry, you haven't specified in your original description that both of your working copies were up to date. But still, regarding what happened when you tried to commit your changes and what hapened when I did the same - it does not seem so.

And there is another moment:

Steps to Reproduce:
1. Copy the package "org" from A to B using the "Team -> Copy To" facility
(copy A/src/main/java/org to B/src/main/java) [OK, both "One.java" and
"Two.java" are marked with blue clock marker]

First of all I need to know, how to reproduce THIS, because if you really did what you wrote, then "One.java" and "Two.java" should never have had "blue clock marker" after this step.
Comment 5 Dmitry Katsubo CLA 2012-04-20 08:48:06 EDT
Closing the ticket, as it works for Eclipse Indigo / SVNKit 1.3.5 v2.2.2.I20110819-1700.