SVN: Vacuum/delete pristine copies from command line

14,574

Solution 1

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.

Solution 2

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.

Share:
14,574

Related videos on Youtube

hardmooth
Author by

hardmooth

BY DAY: mathematician and coder. BY NIGHT: juggler, musician, typesetter Focus on smart algorithms, coding style and clean structures (including strict code alignment). experience in C/C++, Python, R, LaTeX, Lilypond, Perl, Bash, Qt, ...

Updated on September 18, 2022

Comments

  • hardmooth
    hardmooth over 1 year

    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.
  • hardmooth
    hardmooth about 8 years
    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).
  • dotn3b
    dotn3b about 8 years
    @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.
  • Norio Akagi
    Norio Akagi over 6 years
    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.
  • hardmooth
    hardmooth about 6 years
    svn cleanup --vacuum-pristines yields (SVN 1.9.3) the error svn.exe: invalid option: --vacuum-pristines
  • hearst
    hearst about 6 years
    I told you that --vacuum-pristines only available for svn v1.10 or above, could you check my words more carefully?
  • hardmooth
    hardmooth about 6 years
    Yes, you did! My mistake - I read 1.1.0 instead of 1.10.