MDTKTFOXC3OSQ3U74IVBBDXQONBVJTKB6EUFW5TQ5HX26Z5EONQQC
(defun vc-pijul--point-status ()
"Return the status for the current line.
It is assumed that the point is at the beginning of a line, and
the line is the output from \"pijul diff\" for some file."
(cond
((= (point) (point-max)) 'up-to-date)
((looking-at-p
(rx-to-string '(seq bol
(or ?A "UD" ?D)
(or 32 ?,))
t))
'added)
((looking-at-p
(rx-to-string '(seq bol
(or "MV" "U")
(or 32 ?,))
t))
'unregistered)
((looking-at-p "^D[ ,]") 'removed)
((looking-at-p
(rx-to-string '(seq bol
(or "SC" "UC" ?M ?R "RZ")
(or 32 ?,))
t))
'edited)))
(defun vc-pijul--dir-status-sentinel (hash update-function)
"Collect the information from the buffer, and update HASH.
Call UPDATE-FUNCTION to notify vc-dir."
(goto-char (point-min))
(while (re-search-forward
(rx-to-string
'(seq bol
(one-or-more
(any (?a . ?z) (?A . ?Z) ?,))
32
(group
(one-or-more not-newline))
#xa)
t)
nil t)
(forward-line -1)
(puthash (match-string-no-properties 1)
(vc-pijul--point-status)
hash)
(forward-line 1))
(let (result)
(maphash
(lambda (k v)
(setq result (cons (list k v) result)))
hash)
(funcall update-function result nil)))
(message "not implemented yet"))
(let ((default-directory dir)
(pijul-hash (make-hash-table :test #'equal)))
(apply #'vc-pijul--async "diff" (current-buffer)
"--untracked"
"--short"
files)
(vc-run-delayed
(vc-pijul--dir-status-sentinel pijul-hash update-function))))
(let ((args
(append
(cond ((integerp limit)
(list "--limit" (format "%d" limit))))
(cons "--" files))))
(let* ((files (mapcar #'expand-file-name files))
(files
(delq
nil
(mapcar (lambda (file)
(cond
((string=
file
(expand-file-name (vc-pijul-root file)))
nil)
(file)))
files)))
(args
(append
(cond ((integerp limit)
(list "--limit" (format "%d" limit))))
(cons "--" files))))