aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThien-Thi Nguyen2008-02-18 07:46:44 +0000
committerThien-Thi Nguyen2008-02-18 07:46:44 +0000
commit758dc0cc60a495321f03098eb363d81215ab8fbf (patch)
tree465407f256f184c5b5a4f31f6197a2b14579a76a
parent917844623bc50499a6b06c0d5f30d6a21dd1e7a5 (diff)
downloademacs-758dc0cc60a495321f03098eb363d81215ab8fbf.tar.gz
emacs-758dc0cc60a495321f03098eb363d81215ab8fbf.zip
(vc-git-after-dir-status, vc-git-dir-status): New funcs.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/vc-git.el47
2 files changed, 51 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ee3be593fb2..0092c50471f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12008-02-18 Thien-Thi Nguyen <ttn@gnuvola.org>
2
3 * vc-git.el (vc-git-after-dir-status, vc-git-dir-status): New funcs.
4
12008-02-18 Stefan Monnier <monnier@iro.umontreal.ca> 52008-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
2 6
3 * image-mode.el (image-get-display-property): New fun. 7 * image-mode.el (image-get-display-property): New fun.
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 7920fec0289..c8c63a22181 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -207,6 +207,53 @@
207 ;; fall back to the default VC representation 207 ;; fall back to the default VC representation
208 (vc-default-dired-state-info 'Git file)))) 208 (vc-default-dired-state-info 'Git file))))
209 209
210;;; vc-dir-status support (EXPERIMENTAL)
211;;; If vc-directory (which is not half bad under Git, w/ some tweaking)
212;;; is to go away, vc-dir-status must at least support the same operations.
213;;; At the moment, vc-dir-status design is still fluid (a kind way to say
214;;; half-baked, undocumented, and spottily-supported), so the following
215;;; should be considered likewise ripe for sudden unannounced change.
216;;; YHBW, HAND. --ttn
217
218(defun vc-git-after-dir-status (callback buffer)
219 (sort-regexp-fields t "^. \\(.+\\)$" "\\1" (point-min) (point-max))
220 (let ((map '((?H . cached)
221 (?M . unmerged)
222 (?R . removed)
223 (?C . edited)
224 (?K . removed) ; ??? "to be killed"
225 (?? . unregistered)))
226 status filename result)
227 (goto-char (point-min))
228 (while (> (point-max) (point))
229 (setq status (string-to-char (buffer-substring (point) (1+ (point))))
230 status (cdr (assq status map))
231 filename (buffer-substring (+ 2 (point)) (line-end-position)))
232 ;; TODO: Add dynamic selection of which status(es) to display, and
233 ;; bubble that up to vc-dir-status. For now, we consider `cached'
234 ;; to be uninteresting, to mimic vc-directory (somewhat).
235 (unless (eq 'cached status)
236 (push (cons filename status) result))
237 (forward-line 1))
238 (funcall callback result buffer)))
239
240(defun vc-git-dir-status (dir update-function status-buffer)
241 "Return a list of conses (file . state) for DIR."
242 (with-current-buffer
243 (get-buffer-create
244 (expand-file-name " *VC-Git* tmp status" dir))
245 (erase-buffer)
246 (vc-git-command (current-buffer) 'async dir "ls-files" "-t"
247 "-c" ; cached
248 "-d" ; deleted
249 "-k" ; killed
250 "-m" ; modified
251 "-o" ; others
252 "--directory"
253 "--exclude-per-directory=.gitignore")
254 (vc-exec-after
255 `(vc-git-after-dir-status (quote ,update-function) ,status-buffer))))
256
210;;; STATE-CHANGING FUNCTIONS 257;;; STATE-CHANGING FUNCTIONS
211 258
212(defun vc-git-create-repo () 259(defun vc-git-create-repo ()