Function: vc-arch-trim-one-revlib

vc-arch-trim-one-revlib is an interactive and byte-compiled function defined in vc-arch.el.gz.

Signature

(vc-arch-trim-one-revlib DIR)

Documentation

Delete half of the revisions in the revision library.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/vc-arch.el.gz
(defun vc-arch-trim-one-revlib (dir)
  "Delete half of the revisions in the revision library."
  (interactive "Ddirectory: ")
  (let ((garbage (directory-files dir 'full "\\`,," 'nosort)))
    (when garbage
      (funcall (vc-arch-trim-make-sentinel garbage) nil nil)))
  (let ((revs
         (sort (delq nil
                     (mapcar
                      (lambda (f)
                        (when (string-match "-\\([0-9]+\\)\\'" f)
                          (cons (string-to-number (match-string 1 f)) f)))
                      (directory-files dir nil nil 'nosort)))
               #'car-less-than-car))
        (subdirs nil))
    (when (cddr revs)
      (dotimes (_i (/ (length revs) 2))
        (let ((minrev (vc-arch-trim-find-least-useful-rev revs)))
          (setq revs (delq minrev revs))
          (push minrev subdirs)))
      (funcall (vc-arch-trim-make-sentinel
                (mapcar (lambda (x) (expand-file-name (cdr x) dir)) subdirs))
               nil nil))))