comparison lisp/vc-git.el @ 96540:f534da0cc0ea

(vc-git--ls-files-state): Remove unused function.
author Dan Nicolaescu <dann@ics.uci.edu>
date Mon, 07 Jul 2008 16:35:48 +0000
parents d620ef3acfdc
children 44c60e2cb9ef
comparison
equal deleted inserted replaced
96539:d9bc43f652b0 96540:f534da0cc0ea
53 ;; * working-revision (file) OK 53 ;; * working-revision (file) OK
54 ;; - latest-on-branch-p (file) NOT NEEDED 54 ;; - latest-on-branch-p (file) NOT NEEDED
55 ;; * checkout-model (files) OK 55 ;; * checkout-model (files) OK
56 ;; - workfile-unchanged-p (file) OK 56 ;; - workfile-unchanged-p (file) OK
57 ;; - mode-line-string (file) OK 57 ;; - mode-line-string (file) OK
58 ;; - prettify-state-info (file) OK
59 ;; STATE-CHANGING FUNCTIONS 58 ;; STATE-CHANGING FUNCTIONS
60 ;; * create-repo () OK 59 ;; * create-repo () OK
61 ;; * register (files &optional rev comment) OK 60 ;; * register (files &optional rev comment) OK
62 ;; - init-revision (file) NOT NEEDED 61 ;; - init-revision (file) NOT NEEDED
63 ;; - responsible-p (file) OK 62 ;; - responsible-p (file) OK
163 (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--"))) 162 (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--")))
164 (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0" 163 (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
165 diff)) 164 diff))
166 (vc-git--state-code (match-string 1 diff)) 165 (vc-git--state-code (match-string 1 diff))
167 (if (vc-git--empty-db-p) 'added 'up-to-date))))) 166 (if (vc-git--empty-db-p) 'added 'up-to-date)))))
168
169 (defun vc-git--ls-files-state (state &rest args)
170 "Set state to STATE on all files found with git-ls-files ARGS."
171 (with-temp-buffer
172 (apply 'vc-git-command (current-buffer) nil nil "ls-files" "-z" args)
173 (goto-char (point-min))
174 (let ((start (point)))
175 (while (search-forward "\0" nil t)
176 (let ((file (expand-file-name
177 (buffer-substring-no-properties start (1- (point))))))
178 (vc-file-setprop file 'vc-backend (if state 'Git 'none))
179 (vc-file-setprop file 'vc-state state))
180 (setq start (point))))))
181 167
182 (defun vc-git-working-revision (file) 168 (defun vc-git-working-revision (file)
183 "Git-specific version of `vc-working-revision'." 169 "Git-specific version of `vc-working-revision'."
184 (let ((str (with-output-to-string 170 (let ((str (with-output-to-string
185 (with-current-buffer standard-output 171 (with-current-buffer standard-output