3

The command svn list will give me list of all the sub directories in the present directory. However,it is only restricted to directories which are present in current version.

eg. say repository url is :

"http://www.example.com/svncode/mainproduct/trunk" and inside trunk, there are 3 directories

trunk/
     1/
     2/
     3/

If I do svn list it will show me all the directories 1 2 3 . Now somebody else does a commit in trunk, which adds another directory 4 inside trunk. Is there a way to check existence of that directory without first taking an update ? As svn list only provides information till latest svn update , not about changes that happened after that .

Background : I want to retreive the latest directory present inside trunk ( largest number means latest, 4 in this case), and want to checkout only that part of the trunk codebase, not full trunk .

6 Answers 6

6
 svn ls http://www.example.com/svncode/mainproduct/trunk
1
  • seems to be the required thing, will check and revert :) Jan 12, 2012 at 6:54
5

You can ls on server:

svn ls http://server/repo
2

If you are only interested in directories and want to exclude files:

svn list -R http://www.example.com/svncode/mainproduct/trunk| grep -E  '/$'
1

As mentioned in other answers: Use svn list on a repository URL.

Note that if you have trouble remembering/typing the URL you can use the output of svn info to obtain the URL corresponding to the current working directory. In combination:

svn list `svn info | grep URL | cut -b6-`
0

for SVN local use:

svn ls svn://yourlocaladdresssvn
0

If the location within the repositories' paths for the trunk-branches-tags fork is inconsistent, we have to use a filter like @bernard-de-rubinat suggests but alter it like:

svn ls -R https://some.server.com/svn/someRoot | grep '/trunk/$'

This selects only the output of the recursive ls that matches the pattern of being a string ending with .../trunk/.

That will select only directories named trunk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.