changeset 698: |
96958d3eb5b0 |
parent: |
35a579313b80
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 ;;; vc/vc.lisp --- VC API 3 ;; High-level API for working with VC objects. 7 (defparameter *default-vc-kind* :hg) 8 (defvar *repo-roots* nil) 9 (defvar *repo-registry* (make-hash-table :test 'equal)) 11 (defun register-repo (repo) 12 "Register a repo, collecting information from the filesystem and 13 creating a repo object which is stored in *REPO-REGISTRY*." 14 (setf (gethash (vc/proto:vc-path repo) *repo-registry*) repo)) 16 (defun find-repo (name) 17 "Find a repo in *REPO-REGISTRY*." 18 (gethash name *repo-registry*)) 20 (defun make-hg-repo (path &key init update register) 21 (let ((repo (make-instance 'hg-repo :path path))) 22 (when init (vc-init repo)) 24 (setf (vc/hg::vc-requires repo) 25 (mapcar (lambda (s) (trim s)) 26 (sb-unicode:lines (vc-run repo "debugrequires"))))) 27 (when register (register-repo repo)) 30 (defun make-git-repo (path &key init register) 31 (let ((repo (make-instance 'git-repo :path path))) 32 (when init (vc-init repo)) 33 (when register (register-repo repo)) 36 (defun make-repo (path &key (type *default-vc-kind*) init register) 38 (:hg (make-hg-repo path :init init :register register)) 39 (:git (make-git-repo path :init init :register register)) 40 (t (error "invalid repo type: ~A" type)))) 42 ;; (defmacro with-hg ((&rest vc-opts) &body body)) 44 ;; (defmacro with-git ((&rest vc-opts) &body body)) 46 ;; (defmacro with-repos ((&rest repo-defs) &body body)) 48 (defun directory-repos (path) 49 (let ((path (probe-file path))) 50 (assert (typep path 'directory-pathname)) 51 (loop for p in (directory (merge-pathnames "*/" path)) 52 collect (make-repo p)))) 54 (defun bundle-repo (path output) 55 (vc-bundle (make-repo path) output)) 57 (defun bundle-repos (path output) 58 (loop for repo in (directory-repos path) 59 do (let ((out (merge-pathnames output (vc-name repo)))) 60 (vc-bundle repo out)))) 62 (defun update-repo (repo &optional push (pull t)) 64 (vc-pull repo (when (stringp pull) pull))) 66 (vc-push repo (when (stringp push) push)))) 68 (defun update-repos (path &key push (pull t)) 69 (loop for repo in (directory-repos path) 70 do (update-repo repo push pull)))