5

If a Subversion working copy is a partial check-out from a repository, using --depth and/or --set-depth (perhaps with exclude), is there a way to reveal the nodes that are 'missing' (either recursively, or non-recursively)? I don't mean missing in the sense of svn status and ! where a node was checked out but deleted locally without telling SVN. Rather, I mean a node in the repository that was not been checked out from the repository originally, or has been excluded later.

svn info can be used to show the depth of a node.

ls or dir might be compared with svn ls. (ls -r BASE doesn't bahave as I'd expect to get a working copy listing.)

svnversion will indicate that the WC is partial with a 'P'.

(There seems to be no --dry-run option to use in conjunction with --set-depth for svn update. Likewise svn diff -rBASE:HEAD --depth=immediates does not produce the information I seek either.)

Is there some direct method? It would be nice to have a list of 'eligible' nodes available for checkout or update.

Thanks.

Rhubbarb
  • 4,248
  • 6
  • 36
  • 40

5 Answers5

5
svn ls --depth immediates .

will show the child files and folders of the current folder even if they have not been checked out.

Diffing that with the output of ls -1 yields the list of not-checked-out files/folders:

svn ls --depth immediates . > immediates.txt
ls -1 > checkedout.txt
diff immediates.txt checkedout.txt
Wim Coenen
  • 66,094
  • 13
  • 157
  • 251
  • Thanks for the answer. This doesn't give me quite what I want. Firstly, I would like to remain within SVN sub-commands rather than relying on whatever shell happens to be installed, particularly as this might sometimes be Linux and sometimes DOS. Secondly, I'd like to be able to simply exclude those items I already have locally. On the other hand, your SVN command does give me nearly what I want. I have accepted on that basis; I don't think SVN can quite do what I'd like it to. (Yet.) – Rhubbarb Dec 01 '10 at 10:56
1

There's an easy way to do this now, many Subversion releases later. For anybody else who came here looking for a way to find what sparse directories were excluded:

svn info --depth infinity --show-item=depth .

The sparse directories then show up on lines that start with exclude. The original poster clarified in a follow up comment that they ideally wanted to show only excluded items. I know the follow up comment also mentioned also ideally wanting something cross platform, but filtering lines is generally pretty simple in most shells. For instance:

svn info --depth infinity --show-item=depth . | egrep ^exclude

And then to chop of the exclude at the beginning of each line, depending on your environment:

svn info --depth infinity --show-item=depth . | egrep ^exclude | sed -e 's/^exclude *//'

All of those commands should be usable in Linux, macOS, and Windows with WSL. PowerShell has equivalents, which I haven't tried: "https://stackoverflow.com/questions/53867147/grep-and-sed-equivalent-in-powershell"

twm
  • 1,448
  • 11
  • 19
  • Thanks. I am looking for the opposite: list included (rather than excluded) files and directories. The contents of a selected directory should not be listed if they have not been selected themselves (even though they have been checkouted). I am sure this data is stored somewhere because Tortoise SVN shows it when you do in the uppermost directory: `right click > TortoiseSVN > Update to revision ... > Update depth: Choose items` there you can see that the directories (and files) that were selected in checkout are "ticked" (✓ ). – Gabriel Devillers Apr 22 '22 at 15:38
0

May be I misunderstand but

svn update 

has an --set-depth option so you could change an existing working copy to a new level.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • No, I don't want to change the depth, merely to query what additional items are available for checkout compared to what is currently in the working copy. Thanks anyway. – Rhubbarb Dec 01 '10 at 10:49
0

If we had this repository path,

ROOT
  |--trunk
  |   |-- index.php
  |   `-- app
  |--tags
  `--branches

This command would show you which files (or directory) are children of your ROOT node.

svn ls --depth immediates URL/to/ROOT/

Output:

trunk/
tags/
branches/

using the output, you could update each node using

svn update --set-depth=infinity trunk/
yvoyer
  • 7,476
  • 5
  • 33
  • 37
0

This is a very old question, but I was searching for the same thing and this was all I found.

My current solution utilizes find, grep and svn info and is enough for my current usecase. I am posting it here it cases it helps somebody else, feel free to improve on it :)

find . -type d -maxdepth 2 -not -path '*/\.*' -exec svn info {} \; | grep -E "(^Path|^Depth)" 

This will give all directories up to a depth of 2, ignoring hidden directories, and will output the respective path and depth (if set).

Nice to have would be a script that generates an svn-viewspec file for this.

gordonk
  • 435
  • 3
  • 13