Browse code
chore: cl-git -> co.fwoar.git, update README.org
Edward Langley authored on 21/10/2023 08:49:46
Showing 4 changed files
Showing 4 changed files
... | ... |
@@ -38,52 +38,52 @@ |
38 | 38 |
*** Get the commit id of the master branch for a specific repository: |
39 | 39 |
|
40 | 40 |
#+BEGIN_SRC lisp :exports both :results verbatim |
41 |
- (git:in-repository "~/quicklisp/local-projects/cl-git") |
|
42 |
- (git:branch "master") ;; the argument to branch defaults to "master" |
|
41 |
+ (co.fwoar.git:in-repository ".") |
|
42 |
+ (co.fwoar.git:branch "master") ;; the argument to branch defaults to "master" |
|
43 | 43 |
#+END_SRC |
44 | 44 |
|
45 | 45 |
#+RESULTS: |
46 |
- : #<LOOSE-REF 657ab33 of ~/git_repos/git.fiddlerwoaroof.com/u/edwlan/cl-git/> |
|
46 |
+ : #<LOOSE-REF 63b3f56 of .../u/edwlan/cl-git/> |
|
47 | 47 |
|
48 | 48 |
|
49 | 49 |
*** Show the commit message |
50 | 50 |
|
51 | 51 |
#+BEGIN_SRC lisp :exports both :results verbatim |
52 |
- (git:in-repository "~/quicklisp/local-projects/cl-git") |
|
53 |
- (git:component :message (git:branch "master")) |
|
52 |
+ (co.fwoar.git:in-repository ".") |
|
53 |
+ (co.fwoar.git:component :message (co.fwoar.git:branch "master")) |
|
54 | 54 |
#+END_SRC |
55 | 55 |
|
56 | 56 |
#+RESULTS: |
57 |
- : feat(blobs): introduce BLOB class |
|
57 |
+ : Create CNAME |
|
58 | 58 |
|
59 | 59 |
*** Show the messages of the commit's parent |
60 | 60 |
|
61 | 61 |
#+BEGIN_SRC lisp :exports both :results verbatim |
62 |
- (git:in-repository "~/quicklisp/local-projects/cl-git") |
|
63 |
- (let* ((branch (git:branch "master")) |
|
64 |
- (parents (git:parents branch))) |
|
62 |
+ (co.fwoar.git:in-repository ".") |
|
63 |
+ (let* ((branch (co.fwoar.git:branch "master")) |
|
64 |
+ (parents (co.fwoar.git:parents branch))) |
|
65 | 65 |
(mapcar (lambda (it) |
66 |
- (git:component :message it)) |
|
66 |
+ (co.fwoar.git:component :message it)) |
|
67 | 67 |
parents)) |
68 | 68 |
#+END_SRC |
69 | 69 |
|
70 | 70 |
#+RESULTS: |
71 |
- : ("(bump) |
|
71 |
+ : ("feat(docs): add docs |
|
72 | 72 |
: ") |
73 | 73 |
|
74 | 74 |
*** Show the files in a commit |
75 | 75 |
- Note taken on [2020-11-15 Sun 01:49] \\ |
76 | 76 |
If the table comes out wrong, =*print-case*= must be =:downcase= |
77 | 77 |
|
78 |
- #+BEGIN_SRC lisp :exports both :results table :hlines yes |
|
79 |
- (git:in-repository "~/quicklisp/local-projects/cl-git") |
|
80 |
- (list* #("Name" "Mode" "Hash") |
|
78 |
+ #+BEGIN_SRC lisp :exports both :results table :hlines yes :post proc |
|
79 |
+ (co.fwoar.git:in-repository ".") |
|
80 |
+ (list* '("Name" "Mode" "Hash") |
|
81 | 81 |
'hline |
82 |
- (git:git (branch "master") |
|
83 |
- (component :tree :entries) |
|
84 |
- (map (juxt (component :name) |
|
85 |
- (component :mode) |
|
86 |
- (component :hash))))) |
|
82 |
+ (co.fwoar.git:git (branch "master") |
|
83 |
+ (component :tree :entries) |
|
84 |
+ (map (juxt (component :name) |
|
85 |
+ (component :mode) |
|
86 |
+ (component :hash))))) |
|
87 | 87 |
#+END_SRC |
88 | 88 |
|
89 | 89 |
#+RESULTS: |
... | ... |
@@ -93,12 +93,13 @@ |
93 | 93 |
| .gitignore | 100644 | 8a9fe9f77149f74fed5c05388be8e5ffd4a31678 | |
94 | 94 |
| .projectile | 100644 | e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 | |
95 | 95 |
| LICENSE | 100644 | 0306819e780fa57dc3bf6b99a0a059670b605ae0 | |
96 |
- | README.org | 100644 | 9889a8a1e253a446de953072db8ee9f13e90b716 | |
|
96 |
+ | README.org | 100644 | a9026cbd36491691fb9e05ea4ee066ca0283a6b7 | |
|
97 | 97 |
| branch.lisp | 100644 | 6ee2b1e254e7895d55ecd534b2fa16267ec14389 | |
98 | 98 |
| cl-git.asd | 100644 | 486920e6178e436fa993ce3a2bd23f60827c9fd5 | |
99 | 99 |
| commit.lisp | 100644 | d6a83c1a351eb2c0f5315ceddcde37545b7781d6 | |
100 | 100 |
| delta.lisp | 100644 | 1417d8b8d172824c38d95791c8b884393db273ae | |
101 | 101 |
| docker-run | 40000 | acace4bb63832baa7e69e324e738eda7aae4ac2c | |
102 |
+ | docs | 40000 | 696965c69073891cb101697eb7ec97a1bc8a868b | |
|
102 | 103 |
| extract.lisp | 100644 | 4bfb480eb2993cf516fded3adec49483322fdcf4 | |
103 | 104 |
| git.lisp | 100644 | bad6f54787369609581669de923afaf378ed4002 | |
104 | 105 |
| graph.lisp | 100644 | 31576396aff0fff28f69e0ef84571c0dc8cc43ec | |
... | ... |
@@ -116,14 +117,14 @@ |
116 | 117 |
- Note taken on [2020-11-15 Sun 01:49] \\ |
117 | 118 |
If the table comes out wrong, =*print-case*= must be =:downcase= |
118 | 119 |
|
119 |
- #+BEGIN_SRC lisp :exports both :results table :hlines yes |
|
120 |
- (git:with-repository ("~/quicklisp/local-projects/cl-git/") |
|
121 |
- (let* ((branch (git:branch "master")) |
|
122 |
- (tree (git:tree branch)) |
|
123 |
- (tree-entries (git:filter-tree "^.....?[.]lisp" tree))) |
|
120 |
+ #+BEGIN_SRC lisp :exports both :results table :hlines yes :post proc |
|
121 |
+ (co.fwoar.git:with-repository (".") |
|
122 |
+ (let* ((branch (co.fwoar.git:branch "master")) |
|
123 |
+ (tree (co.fwoar.git:tree branch)) |
|
124 |
+ (tree-entries (co.fwoar.git:filter-tree "^.....?[.]lisp" tree))) |
|
124 | 125 |
(flet ((component (component) |
125 | 126 |
(lambda (it) |
126 |
- (git:component component it)))) |
|
127 |
+ (co.fwoar.git:component component it)))) |
|
127 | 128 |
(list* '("Name" "Mode" "Hash") |
128 | 129 |
'hline |
129 | 130 |
(mapcar (data-lens:juxt (component :name) |
... | ... |
@@ -178,3 +179,12 @@ |
178 | 179 |
|
179 | 180 |
** TODOs |
180 | 181 |
*** TODO start implementing Pharo-like git integration (read-only first, commits later) |
182 |
+ |
|
183 |
+#+name: proc |
|
184 |
+#+begin_src emacs-lisp |
|
185 |
+ (mapcar (lambda (it) |
|
186 |
+ (if (equal it 'HLINE) |
|
187 |
+ 'hline |
|
188 |
+ it)) |
|
189 |
+ ,*this*) |
|
190 |
+#+end_src |
181 | 191 |
similarity index 96% |
182 | 192 |
rename from cl-git.asd |
183 | 193 |
rename to co.fwoar.cl-git.asd |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
;;; -*- Mode:Lisp; Syntax:ANSI-Common-Lisp; Package: ASDF-USER -*- |
2 | 2 |
(in-package :asdf-user) |
3 | 3 |
|
4 |
-(defsystem :cl-git |
|
4 |
+(defsystem :co.fwoar.cl-git |
|
5 | 5 |
:description "A pure-Lisp git implementation" |
6 | 6 |
:author "Ed L <edward@elangley.org>" |
7 | 7 |
:license "MIT" |
... | ... |
@@ -36,7 +36,7 @@ |
36 | 36 |
|
37 | 37 |
;; stable programmer interface |
38 | 38 |
(:file "porcelain" :depends-on ("package" "git" "commit")))) |
39 |
-(defsystem :cl-git/tests |
|
39 |
+(defsystem :co.fwoar.cl-git/tests |
|
40 | 40 |
:description "" |
41 | 41 |
:author "Ed L <edward@elangley.org>" |
42 | 42 |
:license "MIT" |
... | ... |
@@ -10,9 +10,9 @@ |
10 | 10 |
(defpackage :cl-git-user |
11 | 11 |
(:use :cl :fwoar.cl-git)) |
12 | 12 |
|
13 |
-(defpackage :git |
|
13 |
+(defpackage :co.fwoar.git |
|
14 | 14 |
(:use) |
15 | 15 |
(:export #:show #:branch #:branches #:commit-parents #:in-repository |
16 | 16 |
#:with-repository #:current-repository #:show-repository #:git |
17 |
- #:tree #:contents #:component |
|
18 |
- #:rev-list #:repository)) |
|
17 |
+ #:tree #:contents #:component #:rev-list #:repository |
|
18 |
+ #:parents #:filter-tree)) |
... | ... |
@@ -8,33 +8,33 @@ |
8 | 8 |
(defvar *git-encoding* :utf-8 |
9 | 9 |
"The encoding to use when parsing git objects") |
10 | 10 |
|
11 |
-(defun git:in-repository (root) |
|
11 |
+(defun co.fwoar.git:in-repository (root) |
|
12 | 12 |
(setf *git-repository* |
13 | 13 |
(ensure-repository |
14 | 14 |
(truename root)))) |
15 | 15 |
|
16 |
-(defun git:repository () |
|
16 |
+(defun co.fwoar.git:repository () |
|
17 | 17 |
*git-repository*) |
18 | 18 |
|
19 |
-(defmacro git:with-repository ((root) &body body) |
|
19 |
+(defmacro co.fwoar.git:with-repository ((root) &body body) |
|
20 | 20 |
`(let ((*git-repository* (ensure-repository ,root))) |
21 | 21 |
,@body)) |
22 | 22 |
|
23 |
-(defun git:show-repository () |
|
23 |
+(defun co.fwoar.git:show-repository () |
|
24 | 24 |
*git-repository*) |
25 | 25 |
|
26 | 26 |
(defun in-git-package (symbol) |
27 | 27 |
(intern (symbol-name symbol) |
28 |
- :git)) |
|
28 |
+ :co.fwoar.git)) |
|
29 | 29 |
|
30 | 30 |
(defun handle-list (_1) |
31 | 31 |
(case (in-git-package (car _1)) |
32 |
- (git::unwrap `(uiop:nest (car) |
|
33 |
- (mapcar ,@(cdr _1)))) |
|
32 |
+ (co.fwoar.git::unwrap `(uiop:nest (car) |
|
33 |
+ (mapcar ,@(cdr _1)))) |
|
34 | 34 |
(t (cons (in-git-package (car _1)) |
35 | 35 |
(cdr _1))))) |
36 | 36 |
|
37 |
-(defun git::resolve-refish (it) |
|
37 |
+(defun co.fwoar.git::resolve-refish (it) |
|
38 | 38 |
(flet ((hash-p (it) |
39 | 39 |
(and (> (length it) 32) |
40 | 40 |
(every (serapeum:op |
... | ... |
@@ -50,7 +50,7 @@ |
50 | 50 |
nil)) |
51 | 51 |
((hash-p it) (ensure-ref it))))) |
52 | 52 |
|
53 |
-(defmacro git:git (&rest commands) |
|
53 |
+(defmacro co.fwoar.git:git (&rest commands) |
|
54 | 54 |
`(uiop:nest ,@(reverse |
55 | 55 |
(funcall (data-lens:<>1 |
56 | 56 |
(data-lens:over (serapeum:op |
... | ... |
@@ -59,20 +59,20 @@ |
59 | 59 |
(list (handle-list _1))))) |
60 | 60 |
(data-lens:transform-head (serapeum:op |
61 | 61 |
(etypecase _1 |
62 |
- (string `(git::resolve-refish ,_1)) |
|
62 |
+ (string `(co.fwoar.git::resolve-refish ,_1)) |
|
63 | 63 |
(t _1))))) |
64 | 64 |
commands)))) |
65 | 65 |
|
66 |
-(defun git::ensure-ref (it) |
|
66 |
+(defun co.fwoar.git::ensure-ref (it) |
|
67 | 67 |
(ensure-ref it)) |
68 | 68 |
|
69 |
-(defun git::decode (it) |
|
69 |
+(defun co.fwoar.git::decode (it) |
|
70 | 70 |
(babel:octets-to-string it :encoding *git-encoding*)) |
71 | 71 |
|
72 |
-(defun git::<<= (fun &rest args) |
|
72 |
+(defun co.fwoar.git::<<= (fun &rest args) |
|
73 | 73 |
(apply #'mapcan fun args)) |
74 | 74 |
|
75 |
-(defmacro git::map (fun list) |
|
75 |
+(defmacro co.fwoar.git::map (fun list) |
|
76 | 76 |
(alexandria:once-only (list) |
77 | 77 |
(alexandria:with-gensyms (it) |
78 | 78 |
`(mapcar ,(if (consp fun) |
... | ... |
@@ -83,7 +83,7 @@ |
83 | 83 |
`',(in-git-package fun)) |
84 | 84 |
,list)))) |
85 | 85 |
|
86 |
-(defmacro git::juxt (&rest args) |
|
86 |
+(defmacro co.fwoar.git::juxt (&rest args) |
|
87 | 87 |
(let ((funs (butlast args)) |
88 | 88 |
(arg (car (last args)))) |
89 | 89 |
(alexandria:once-only (arg) |
... | ... |
@@ -91,7 +91,7 @@ |
91 | 91 |
`(,@(alexandria:ensure-list f) ,arg)) |
92 | 92 |
funs))))) |
93 | 93 |
|
94 |
-(defmacro git::pipe (&rest funs) |
|
94 |
+(defmacro co.fwoar.git::pipe (&rest funs) |
|
95 | 95 |
(let ((funs (reverse (butlast funs))) |
96 | 96 |
(var (car (last funs)))) |
97 | 97 |
`(uiop:nest ,@(mapcar (lambda (it) |
... | ... |
@@ -101,28 +101,28 @@ |
101 | 101 |
funs) |
102 | 102 |
,var))) |
103 | 103 |
|
104 |
-(defun git::filter (fun &rest args) |
|
104 |
+(defun co.fwoar.git::filter (fun &rest args) |
|
105 | 105 |
(apply #'remove-if-not fun args)) |
106 | 106 |
|
107 |
-(defun git::object (thing) |
|
107 |
+(defun co.fwoar.git::object (thing) |
|
108 | 108 |
(extract-object thing)) |
109 | 109 |
|
110 |
-(defun git:show (object) |
|
110 |
+(defun co.fwoar.git:show (object) |
|
111 | 111 |
(extract-object object)) |
112 | 112 |
|
113 |
-(defun git:contents (object) |
|
114 |
- (git:show object)) |
|
113 |
+(defun co.fwoar.git:contents (object) |
|
114 |
+ (co.fwoar.git:show object)) |
|
115 | 115 |
|
116 |
-(defun git:component (&rest args) |
|
116 |
+(defun co.fwoar.git:component (&rest args) |
|
117 | 117 |
(let ((component-list (butlast args)) |
118 | 118 |
(target (car (last args)))) |
119 | 119 |
(fwoar.cl-git::component component-list target))) |
120 | 120 |
|
121 |
-(defun git:tree (commit-object) |
|
121 |
+(defun co.fwoar.git:tree (commit-object) |
|
122 | 122 |
(component :tree |
123 | 123 |
commit-object)) |
124 | 124 |
|
125 |
-(defun git::filter-tree (name-pattern tree) |
|
125 |
+(defun co.fwoar.git::filter-tree (name-pattern tree) |
|
126 | 126 |
#+lispworks |
127 | 127 |
(declare (notinline serapeum:string-prefix-p)) |
128 | 128 |
(let* ((tree-entries (component :entries tree)) |
... | ... |
@@ -132,7 +132,7 @@ |
132 | 132 |
tree-entries |
133 | 133 |
:key #'te-name))) |
134 | 134 |
|
135 |
-(defun git:branch (&optional (branch :master)) |
|
135 |
+(defun co.fwoar.git:branch (&optional (branch :master)) |
|
136 | 136 |
#+lispworks |
137 | 137 |
(declare (notinline serapeum:assocadr)) |
138 | 138 |
(let ((branches (branches *git-repository*))) |
... | ... |
@@ -143,16 +143,16 @@ |
143 | 143 |
branches |
144 | 144 |
:test 'equal)))) |
145 | 145 |
|
146 |
-(defun git:branches () |
|
146 |
+(defun co.fwoar.git:branches () |
|
147 | 147 |
(branches *git-repository*)) |
148 | 148 |
|
149 |
-(defun git::parents (commit) |
|
149 |
+(defun co.fwoar.git::parents (commit) |
|
150 | 150 |
(mapcar 'ensure-ref |
151 | 151 |
(component :parents commit))) |
152 |
-(defun git:commit-parents (commit) |
|
153 |
- (git::parents commit)) |
|
152 |
+(defun co.fwoar.git:commit-parents (commit) |
|
153 |
+ (co.fwoar.git::parents commit)) |
|
154 | 154 |
|
155 |
-(defun git:rev-list (ref-id &optional (limit nil limit-p)) |
|
155 |
+(defun co.fwoar.git:rev-list (ref-id &optional (limit nil limit-p)) |
|
156 | 156 |
"Return the commits reachable from the ref." |
157 | 157 |
(when limit-p |
158 | 158 |
(rotatef ref-id limit)) |
... | ... |
@@ -163,7 +163,7 @@ |
163 | 163 |
accum |
164 | 164 |
(destructuring-bind (next . rest) queue |
165 | 165 |
(iterate (append rest |
166 |
- (git::parents next)) |
|
166 |
+ (co.fwoar.git::parents next)) |
|
167 | 167 |
(cons next accum) |
168 | 168 |
(1+ count)))))) |
169 | 169 |
(iterate (list (ensure-ref ref-id)) |