aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes SVN: add of not immediate child Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "SVN: add of not immediate child" Watch "SVN: add of not immediate child" New topic
Author

SVN: add of not immediate child

surlac surlacovich
Ranch Hand

Joined: Mar 12, 2013
Posts: 296

Hello Folks.
I have repository URL like this:

The "project" catalog is under version control and exists on the server.
Locally I create "subproject" catalog in local project catalog. There I create file.txt and trying to add it:

The error is:



How would I make svn add "subproject" catalog first and then file.txt?
P.S. I don't want to run "svn add subproject" because it can contain file2.txt which I don't want to add under SVN.
Maxim Karvonen
Ranch Hand

Joined: Jun 14, 2013
Posts: 94
    
    9
You can import individual file into repository using "svn import" command. Something like that:


However, your local file.txt will be unversioned. SVN requires a working (checked-out) directory to store some metadata. And it requires all the parent directories up to a working directory to be checked out also.

Why do you not want to add subproject folder? Maybe "svn:ignore" with a list of files will be a good solution to your problem. Or you may "svn add -N subproject" and then add an individual file to a repository (all other files will remain unversioned).
surlac surlacovich
Ranch Hand

Joined: Mar 12, 2013
Posts: 296

Maxim Karvonen wrote:
Why do you not want to add subproject folder? Maybe "svn:ignore" with a list of files will be a good solution to your problem. Or you may "svn add -N subproject" and then add an individual file to a repository (all other files will remain unversioned).

I'm trying to switch from IntelliJ IDEA to Eclipse (corporate reasons), and I miss that feature in eclipse. In IDEA one can create the subproject in any depth of project and the IDE will add all subprojects till actual working copy automatically, which is awesome. In Eclipse one need to use "SVN->Share Project Wizard" of subversive plugin, which do the same thing but it basically creates new repo with URL provided.

So I'm trying to figure out if it's possible in IDE-independent way (cmd console).

Thanks Maxim. In case if I will add everything recursively and the ignore the files that I don't need will do the trick, but if I have 100 files and I need to add only 1 under SVN it will make a lot of overhead.

Maxim Karvonen
Ranch Hand

Joined: Jun 14, 2013
Posts: 94
    
    9
So I'm trying to figure out if it's possible in IDE-independent way (cmd console).

An exact equivalent to this will be (depending on type of what you want to add):

It will add all intermediate directories to a working copy.
surlac surlacovich
Ranch Hand

Joined: Mar 12, 2013
Posts: 296

Thank A LOT, Maxim Karvonen!
The second command did the trick,
I created subproject1/subproject2/test.file
Put it under SVN with:

But if I commit from subproject2, the error is:
"subproject1 is not known to exist in the repository and is not part of the commit, yet its child subproject2 is part of the commit"

So I commited from "project" directory, which worked fine!

Could you please tell, what for the first command, It will add the whole directory with all contents and all it's parents? (and the second cmd just adds selected file and it's parent directories)
Maxim Karvonen
Ranch Hand

Joined: Jun 14, 2013
Posts: 94
    
    9
First command will add a directory with all parents (--parents argument) but without any content (--depth empty arguments).

You may look here for an explanation of different --depth values. I didn't test them all, but "--depth empty" works as I described (and according to a description behind the link).

First command is important when you want to add a directory without it's content. If you omit "--depth empty" then all content will be added. And "--depth empty" have no much sense for a single file (may still work, I didn't test it), so I provided two commands to choose.
surlac surlacovich
Ranch Hand

Joined: Mar 12, 2013
Posts: 296

Awesome! Thank you very much, Maxim!
It was all I need. Now I can use svn independently from IDE, which is extremely cool! As far as go into using SVN, more I understand that it's much faster to use it from console.
 
 
subject: SVN: add of not immediate child
 
Similar Threads
is just Subclipse enough? or need install a svn server also?
A set of questions remained after reading SVN book.
The compilation unit is not on the build path..
Maven & Subversion
Import an existing checkout folder as project in eclipse