Browse code
bug: fix filter-tree
Ed L authored on 15/11/2020 09:50:53
Showing 3 changed files
Showing 3 changed files
... | ... |
@@ -61,10 +61,13 @@ |
61 | 61 |
: (#<LOOSE-REF 216c17e of ~/git_repos/cl-git/>) |
62 | 62 |
|
63 | 63 |
*** Show the files in a commit |
64 |
+ - Note taken on [2020-11-15 Sun 01:49] \\ |
|
65 |
+ If the table comes out wrong, =*print-case*= must be =:downcase= |
|
64 | 66 |
|
65 | 67 |
#+BEGIN_SRC lisp :exports both :results table :hlines yes |
66 | 68 |
(git:in-repository "~/quicklisp/local-projects/cl-git") |
67 |
- (list* #("name" "mode" "hash") |
|
69 |
+ (list* #("Name" "Mode" "Hash") |
|
70 |
+ 'hline |
|
68 | 71 |
(git:git (branch "master") |
69 | 72 |
(component :tree :entries) |
70 | 73 |
(map (juxt (component :name) |
... | ... |
@@ -73,11 +76,12 @@ |
73 | 76 |
#+END_SRC |
74 | 77 |
|
75 | 78 |
#+RESULTS: |
76 |
- | name | mode | hash | |
|
79 |
+ | Name | Mode | Hash | |
|
80 |
+ |-----------------+--------+------------------------------------------| |
|
77 | 81 |
| .gitignore | 100644 | 8a9fe9f77149f74fed5c05388be8e5ffd4a31678 | |
78 | 82 |
| .projectile | 100644 | e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 | |
79 | 83 |
| LICENSE | 100644 | 0306819e780fa57dc3bf6b99a0a059670b605ae0 | |
80 |
- | README.org | 100644 | c133adfd06f1bff1140d163147465fd3b996f4e5 | |
|
84 |
+ | README.org | 100644 | 90b98fab8f0ac78924c3ed632e5ea7c677f5b2f3 | |
|
81 | 85 |
| branch.lisp | 100644 | e06b66967fa4fa005ccf00dcbc7d839b22259593 | |
82 | 86 |
| cl-git.asd | 100644 | 265a98fb79595e0067e53d8cf222dec4283f8525 | |
83 | 87 |
| commit.lisp | 100644 | 197e10755343900cfbcb7fc6d863d4b3231e74d4 | |
... | ... |
@@ -94,6 +98,31 @@ |
94 | 98 |
| undelta.lisp | 100644 | ae0a070133d1a14d6e940a0f790f40b37e885b22 | |
95 | 99 |
| util.lisp | 100644 | 66279b2fa08c9d0872e888b85fe14d9950e27326 | |
96 | 100 |
|
101 |
+*** Show the files that match a pattern |
|
102 |
+ - Note taken on [2020-11-15 Sun 01:49] \\ |
|
103 |
+ If the table comes out wrong, =*print-case*= must be =:downcase= |
|
104 |
+ |
|
105 |
+ #+BEGIN_SRC lisp :exports both :results table :hlines yes |
|
106 |
+ (git:with-repository ("~/quicklisp/local-projects/cl-git/") |
|
107 |
+ (list* '("Name" "Mode" "Hash") |
|
108 |
+ 'hline |
|
109 |
+ (git:git (branch "master") |
|
110 |
+ (tree) |
|
111 |
+ (filter-tree "^.....?[.]lisp") |
|
112 |
+ (map (juxt (component :name) |
|
113 |
+ (component :mode) |
|
114 |
+ (component :hash)))))) |
|
115 |
+ #+END_SRC |
|
116 |
+ |
|
117 |
+ #+RESULTS: |
|
118 |
+ | Name | Mode | Hash | |
|
119 |
+ |------------+--------+------------------------------------------| |
|
120 |
+ | delta.lisp | 100644 | 995d5a4fb90f02caeda47c01a2b3427828d2be0e | |
|
121 |
+ | graph.lisp | 100644 | 31576396aff0fff28f69e0ef84571c0dc8cc43ec | |
|
122 |
+ | model.lisp | 100644 | aa372879f4feeb170bc6d06047bf50f55a23042e | |
|
123 |
+ | tree.lisp | 100644 | 06bceb0a932817adedc9192edd6f9d4077277624 | |
|
124 |
+ | util.lisp | 100644 | 66279b2fa08c9d0872e888b85fe14d9950e27326 | |
|
125 |
+ |
|
97 | 126 |
** Partially Implemented: |
98 | 127 |
|
99 | 128 |
*** Delta refs |
... | ... |
@@ -2,34 +2,35 @@ |
2 | 2 |
(in-package :asdf-user) |
3 | 3 |
|
4 | 4 |
(defsystem :cl-git |
5 |
- :description "A pure-Lisp git implementation" |
|
6 |
- :author "Ed L <edward@elangley.org>" |
|
7 |
- :license "MIT" |
|
8 |
- :pathname #-fw.dev nil #+fw.dev #p"PROJECTS:cl-git;" |
|
9 |
- :depends-on (:alexandria |
|
10 |
- :chipz |
|
11 |
- :cl-dot |
|
12 |
- :data-lens |
|
13 |
- :fwoar-lisputils |
|
14 |
- :fwoar-lisputils/bin-parser |
|
15 |
- :ironclad |
|
16 |
- :serapeum |
|
17 |
- :split-sequence |
|
18 |
- :uiop) |
|
19 |
- :components ((:file "package") |
|
20 |
- (:file "util" :depends-on ("package")) |
|
5 |
+ :description "A pure-Lisp git implementation" |
|
6 |
+ :author "Ed L <edward@elangley.org>" |
|
7 |
+ :license "MIT" |
|
8 |
+ :pathname #-fw.dev nil #+fw.dev #p"PROJECTS:cl-git;" |
|
9 |
+ :depends-on (:alexandria |
|
10 |
+ :chipz |
|
11 |
+ :cl-dot |
|
12 |
+ :data-lens |
|
13 |
+ :fwoar-lisputils |
|
14 |
+ :cl-ppcre |
|
15 |
+ :fwoar-lisputils/bin-parser |
|
16 |
+ :ironclad |
|
17 |
+ :serapeum |
|
18 |
+ :split-sequence |
|
19 |
+ :uiop) |
|
20 |
+ :components ((:file "package") |
|
21 |
+ (:file "util" :depends-on ("package")) |
|
21 | 22 |
|
22 |
- ;; data model |
|
23 |
- (:file "model" :depends-on ("package")) |
|
24 |
- (:file "protocol" :depends-on ("package" "model")) |
|
25 |
- (:file "repository" :depends-on ("package" "model")) |
|
26 |
- (:file "tree" :depends-on ("package" "model")) |
|
27 |
- (:file "commit" :depends-on ("package" "model")) |
|
28 |
- (:file "delta" :depends-on ("package" "model")) |
|
23 |
+ ;; data model |
|
24 |
+ (:file "model" :depends-on ("package")) |
|
25 |
+ (:file "protocol" :depends-on ("package" "model")) |
|
26 |
+ (:file "repository" :depends-on ("package" "model")) |
|
27 |
+ (:file "tree" :depends-on ("package" "model")) |
|
28 |
+ (:file "commit" :depends-on ("package" "model")) |
|
29 |
+ (:file "delta" :depends-on ("package" "model")) |
|
29 | 30 |
|
30 |
- (:file "extract" :depends-on ("package" "commit" "tree" "delta")) |
|
31 |
- (:file "branch" :depends-on ("package" "extract")) |
|
32 |
- (:file "git" :depends-on ("package" "util" "model" "branch")) |
|
31 |
+ (:file "extract" :depends-on ("package" "commit" "tree" "delta")) |
|
32 |
+ (:file "branch" :depends-on ("package" "extract")) |
|
33 |
+ (:file "git" :depends-on ("package" "util" "model" "branch")) |
|
33 | 34 |
|
34 |
- ;; stable programmer interface |
|
35 |
- (:file "porcelain" :depends-on ("package" "git" "commit")))) |
|
35 |
+ ;; stable programmer interface |
|
36 |
+ (:file "porcelain" :depends-on ("package" "git" "commit")))) |
... | ... |
@@ -111,9 +111,6 @@ |
111 | 111 |
(defun git:contents (object) |
112 | 112 |
(git:show object)) |
113 | 113 |
|
114 |
-(defstruct (tree-entry (:type vector)) |
|
115 |
- te-name te-mode te-id) |
|
116 |
- |
|
117 | 114 |
(defun git:component (&rest args) |
118 | 115 |
(let ((component-list (butlast args)) |
119 | 116 |
(target (car (last args)))) |
... | ... |
@@ -126,16 +123,12 @@ |
126 | 123 |
(defun git::filter-tree (name-pattern tree) |
127 | 124 |
#+lispworks |
128 | 125 |
(declare (notinline serapeum:string-prefix-p)) |
129 |
- (let* ((lines (fwoar.string-utils:split #\newline tree)) |
|
130 |
- (columns (map 'list |
|
131 |
- (serapeum:op |
|
132 |
- (coerce (fwoar.string-utils:split #\tab _) |
|
133 |
- 'simple-vector)) |
|
134 |
- lines))) |
|
126 |
+ (let* ((tree-entries (component :entries tree)) |
|
127 |
+ (scanner (cl-ppcre:create-scanner name-pattern))) |
|
135 | 128 |
(remove-if-not (serapeum:op |
136 |
- (cl-ppcre:scan name-pattern _ )) |
|
137 |
- columns |
|
138 |
- :key #'tree-entry-te-name))) |
|
129 |
+ (cl-ppcre:scan scanner _)) |
|
130 |
+ tree-entries |
|
131 |
+ :key #'te-name))) |
|
139 | 132 |
|
140 | 133 |
(defun git:branch (&optional (branch :master)) |
141 | 134 |
#+lispworks |