What is intermediate directories in SVN?

落花浮王杯 提交于 2019-12-23 07:36:51

问题


I just started to learn SVN. Please give me your advice to understand the basic theory below.

The svn copy and svn move command have an option called --parents. It says without --parents option, it would not create intermediate directories.

Could anyone tell me what intermediate directories are?


回答1:


Let’s say you just created a new Java project in Subversion. You now have an empty directory, and you want to create a directory for your source files. I like to follow Maven directory structure even if I’m not using Maven. Maven says my source files should be under the src/main/java directory. Since my company is VegiBank.com and this is their foundation project, I want to create the directory src/main/java/com/vegibank/foundation. I could do this:

$ svn mkdir src
$ svn mkdir src/main
$ svn mkdir src/main/java
$ svn mkdir src/main/java/com
$ svn mkdir src/main/java/com/vegibank
$ svn mkdir src/main/java/com/vegibank/foundation

I have to first create the directory in order to create the subdirectory. However, with the --parents option, I can replace all of those with a single command:

$ svn mkdir --parents src/main/java/com/vegibank/foundation

That makes the entire directory tree without me creating each single subdirectory one at a time.




回答2:


See mkdir -p for the functionality svn is mimicking.

svn cp foo bar/baz/foo

If bar or bar/baz do not exist then the copy will fail.

svn cp --parents foo bar/baz/foo

If bar and/or bar/baz do not exist then they'll be created automatically.



来源:https://stackoverflow.com/questions/12906238/what-is-intermediate-directories-in-svn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!