changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: add back vc.lisp

changeset 398: 1e08f8462554
parent 397: a79d494b0e9c
child 399: 7963217e1d39
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 02 Jun 2024 21:23:07 -0400
files: lisp/lib/vc/vc.lisp
description: add back vc.lisp
     1.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2+++ b/lisp/lib/vc/vc.lisp	Sun Jun 02 21:23:07 2024 -0400
     1.3@@ -0,0 +1,45 @@
     1.4+;;; vc/vc.lisp --- VC API
     1.5+
     1.6+;; High-level API for working with VC objects.
     1.7+
     1.8+;;; Code:
     1.9+(in-package :vc)
    1.10+(defparameter *default-vc-kind* :hg)
    1.11+(defvar *repo-roots* nil)
    1.12+(defvar *repo-registry* (make-hash-table :test 'equal))
    1.13+
    1.14+(defun register-repo (repo)
    1.15+  "Register a repo, collecting information from the filesystem and
    1.16+creating a repo object which is stored in *REPO-REGISTRY*."
    1.17+  (setf (gethash (vc/proto::vc-repo-path repo) *repo-registry*) repo))
    1.18+
    1.19+(defun find-repo (name)
    1.20+  "Find a repo in *REPO-REGISTRY*."
    1.21+  (gethash name *repo-registry*))
    1.22+
    1.23+(defun make-hg-repo (path &key init update register)
    1.24+  (let ((repo (make-instance 'hg-repo :path path)))
    1.25+    (when register (register-repo repo))
    1.26+    (when init (vc-init repo))
    1.27+    (when update
    1.28+      (setf (vc/hg::vc-requires repo) (mapcar (lambda (s) (trim s)) (sb-unicode:lines (vc/proto::vc-run repo "debugrequires")))))
    1.29+    repo))
    1.30+
    1.31+(defun make-git-repo (path &key init register)
    1.32+  (let ((repo (make-instance 'git-repo :path path)))
    1.33+    (when register (register-repo repo))
    1.34+    (when init (vc-init repo))
    1.35+    repo))
    1.36+
    1.37+(defun make-repo (path &key (type *default-vc-kind*) init register)
    1.38+  (case type
    1.39+    (:hg (make-hg-repo path :init init :register register))
    1.40+    (:git (make-git-repo path :init init :register register))
    1.41+    (t (error "invalid repo type: ~A" type))))
    1.42+
    1.43+;; (defmacro with-hg ((&rest vc-opts) &body body))
    1.44+
    1.45+;; (defmacro with-git ((&rest vc-opts) &body body))
    1.46+
    1.47+;; (defmacro with-repos ((&rest repo-defs) &body body))
    1.48+