changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/vc/proto.lisp

changeset 325: 9b573fc6bc40
parent: 616fdccec4a2
child: 45889d307d7f
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 10 May 2024 19:33:40 -0400
permissions: -rw-r--r--
description: vc updates, fixed missing in-package lines, skel errors
1 ;;; lib/vc/proto.lisp --- VC Protocol
2 
3 ;;
4 
5 ;;; Code:
6 (in-package :vc)
7 
8 ;;; Functions
9 (defgeneric vc-init (self)
10  (:documentation "Initialize a vc-repo - calls either 'git init' or 'hg init'"))
11 
12 (defgeneric vc-run (self cmd &rest args)
13  (:documentation "Run a vc CMD with ARGS."))
14 
15 (defgeneric vc-id (self)
16  (:documentation "Get the ID of a vc object."))
17 
18 (defgeneric (setf vc-id) (self id)
19  (:documentation "Set the ID of a vc object."))
20 
21 (defgeneric vc-clone (self remote &key &allow-other-keys))
22 
23 (defgeneric vc-push (self remote &key &allow-other-keys))
24 
25 (defgeneric vc-pull (self remote &key &allow-other-keys))
26 
27 (defgeneric vc-commit (self msg &key &allow-other-keys))
28 
29 (defgeneric vc-add (self &rest files))
30 
31 (defgeneric vc-remove (self &rest files))
32 
33 (defgeneric vc-addremove (self &rest files))
34 
35 (defgeneric vc-branch (self &key cmd branch &allow-other-keys))
36 
37 (defgeneric vc-status (self &key &allow-other-keys))
38 
39 ;; IDEA 2023-12-29: :ediff t
40 (defgeneric vc-diff (a b &key &allow-other-keys))
41 
42 ;;; Objects
43 
44 ;; should be parsed from .hgrc and .gitconfig
45 (defclass vc-config (sxp) ())
46 
47 (defstruct vc-branch name rev)
48 
49 (defstruct vc-commit id message)
50 
51 (defstruct vc-tag name id)
52 
53 (defstruct vc-remote name url)
54 
55 (defstruct vc-rev num id)
56 
57 (defclass vc-repo ()
58  ((path :initform nil :type (or null string pathname) :accessor vc-repo-path
59  :initarg :path
60  :documentation "AKA working-directory or working-copy")
61  (head :initform nil :initarg :head :type (or null vc-rev) :accessor vc-repo-head)
62  (branches :initform (make-array 0 :element-type 'vc-branch :fill-pointer 0) :type (vector vc-branch))
63  (tags :initform (make-array 0 :element-type 'vc-tag :fill-pointer 0) :type (vector vc-tag))
64  (revisions :initform (make-array 0 :element-type 'vc-rev :fill-pointer 0) :type (vector vc-rev))
65  (remotes :initform (make-array 0 :element-type 'vc-remote :fill-pointer 0) :type (vector vc-remote))
66  (config :initform nil :type (or null vc-config)))
67  (:documentation "generic Repository object backed by one of VC-DESIGNATOR."))
68 
69 (defmethod vc-init ((self (eql t)))
70  (make-instance 'vc-repo))