• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SVN: add of not immediate child

 
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 121
12
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 121
12
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 121
12
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic