1

How can I vacuum/delete all pristine copies of a working copy from command line?

Use case:

  • I have multiple working copies (20+) checked out
    (same case for many developers in our firm)
  • some of those working copies grow large over time
  • When disk space is scarce, I need to clean up every working copy by hand as described in this answer (previously checking, which working copies take up most of the disk space)
  • Bonus: calculate (estimate?) disk space occupied by pristine copies and only call cleanup, if it will result in ... GBs to be freed up.

This is tedious and error-prone, so I'd like to automate these 20+ cleanups into a vacuum_pristine_copies.XXX Script, which can be executed in the hour of deepest need.

enclosed label

  • It is possible to call cleanup from command line (see the docs here).
    However, this lacks a /vacuum-pristine option. (We already use this TortoiseSVN-automation to do batched updates).
  • We're working on Windows machines, but we're not fixed on CMD.
    One possible alternative could be Python27.
4

For TortoiseSVN the option or parameter is /vacuum as mentioned by the developer in an email. As you've pointed out it is currently missing in the documentation.

SVN 1.8 introduced automatic vacuuming of pristines to the cleanup command and 1.9 made it and other features optional. Source: SVN changelog.

3
  • my problem with the TortoiseProc.exe /command:cleanup /vacuum ... is that it opens a dialog for each working directory. I'd prefer the fire-and-forget-script. the svn cleanup somehow doesn't reduce the working directory size (>6GB), while running a TortoiseSVN cleanup does (<4GB). – hardmooth Apr 25 '16 at 12:42
  • @hardmooth As mentioned in the TSVN automation documentation you've linked you should be able to hide the dialog with /noui, /noprogressui and/or /nodlg. Regarding the standard SVN client: What I can gather from the 1.9.4 source code is that you must not supply --remove-unversioned or --remove-ignored. The term vacuum is used not just regarding the "vacuuming of pristines" but also when referring to removal of unversioned or ignored files which IMHO causes some confusion in the code and seemingly the implementation thereof. Also make sure the path you specify is the WC's root. – dotn3b Apr 30 '16 at 11:21
  • First link is broken, perhaps this thread contains the same info. The "no ui" syntax would be something like TortoiseProc.exe /command:cleanup /noui /cleanup /vacuum /externals /refreshshell /noprogressui /path:. (leave path to . for current folder or change as needed of course). One thing to note is that this command isn't blocking, i.e. it just starts the process and returns immediately, so running this in a for-loop inside a batch script might create many background processes. – Groo Dec 20 '17 at 8:56
5

For svn before 1.10, you just type "svn cleanup" without any parameters. Svn will automatically vacuum pristines after finishing cleanup.

For svn 1.10 (maybe or later, I hope), you type the above command along with "--vacuum-pristines" ("svn cleanup --vacuum-pristines"), and svn will do the same for you. But you can add other parameters as well and svn will execute all of them in one command. For example, ("svn cleanup --remove-unversioned --remove-ignored --vacuum-pristines")

Of course, like older versions, type "svn cleanup" without any parameters will vacuum it as well in 1.10.

3
  • svn cleanup --vacuum-pristines yields (SVN 1.9.3) the error svn.exe: invalid option: --vacuum-pristines – hardmooth Apr 26 '18 at 6:58
  • 1
    I told you that --vacuum-pristines only available for svn v1.10 or above, could you check my words more carefully? – hearst Apr 27 '18 at 8:40
  • 1
    Yes, you did! My mistake - I read 1.1.0 instead of 1.10. – hardmooth Apr 27 '18 at 10:33

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.