copy-paste file leads to svn copy

Hi,

When copy-ing & paste-ing a file in the project or grails view, the new file is added to svn as an svn copy, i.e. the new file shares the history with the original. This is often not what you want, e.g. people tend to copy-paste just because as an easy start, not because the files are related.
Is there an option, setting, configuration item to switch this off? I'd like IntelliJ to just "svn add" all new files, no matter where they came from...

Thanks,
Peter.

10 comments
Comment actions Permalink

Hello Peter,

No, there is no setting for that, and we don't plan to add one. IDEA won't
use an 'svn copy' if you create a new file at the new location and then copy
the contents over.

When copy-ing & paste-ing a file in the project or grails view, the
new file is added to svn as an svn copy, i.e. the new file shares the
history with the original. This is often not what you want, e.g.
people tend to copy-paste just because as an easy start, not because
the files are related.

Is there an option, setting, configuration item to switch this off?
I'd like IntelliJ to just "svn add" all new files, no matter where
they came from...


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Too bad....
I know about the work around, but people tend to forget that copy-paste-file has this (in my opinion nasty) side-effect.
Thanks anyway for your reply.

0
Comment actions Permalink

> This is often not what you want

interesting opinion
as for me - I almost always wanna do svn copy when copying files

0
Comment actions Permalink

Peter, Can you share your workaround? I ran into same issue and would like to know the workaround.

Thanks

0
Comment actions Permalink

IDEA won't use an 'svn copy' if you create a new file at the new location and then copy the contents over.

0
Comment actions Permalink

Will 'svn copy' still be used if I refactor -> copy (F5)?

Thanks

0
Comment actions Permalink

Yes. As described above, this behavior is by design and we don't have any plans to change it.

0
Comment actions Permalink

I just got bit by this one today- I almost always start a new file by copy-paste into the new package as a blank start.

For example, a controller implementing a bunch of REST endpoints for a new type.  The quick copy-paste into the new package handles a lot of things for you (like the logging class is the pasted-class and all the many annotations are there -- in this case maybe 5 annotations per method.  Then I prune out or change the methods to the suit the new implementation.

How long has IntelliJ worked this way?  I don't remember this being the behavior in previous versions although I might not remember due to other projects using GIT vs. SVN.

The work around is annoying, however.  I have to create a new file with the new name.  Then copy-paste the contents into the new file. Doesn't seem so bad, but it is clunkier than simply cntl-c on one file and cntl-v into another package and letting IntelliJ doing the package refactoring.  Plus it is something else I have to remember :).

FYI: I found this out in a code review - so what has been happening is the SVN log has been littered with "svn cp" history where 99% of the time the developer meant to simply copy-paste the file as a template and NOT as a true "Hey, I'm refactoring this system and want to save the history of all files moved.".  I conclude from this that the behavior is behaving correctly only for a very, very small number of use cases.

I was told to not use IntelliJ copy-paste for files so I came looking for the setting to turn it off...

 

 

0
Comment actions Permalink

The Subversion integration has behaved this way since version 7 at least. In Git, copy/rename tracking is done by Git itself and there is no separate copy command, so the issue does not apply.

The correct solution for this case is to save the controller as a file template and to create other controllers from that template. You can also define live templates for individual methods in your controller.

0
Comment actions Permalink

This behavior annoying me too, I'd would prefer a 'clean' copy.

0

Please sign in to leave a comment.