comparison lisp/vc-arch.el @ 98776:58d0fa1979cb

* vc-arch.el (vc-arch-dir-status): New function. (vc-arch-after-dir-status): New function.
author Magnus Henoch <mange@freemail.hu>
date Thu, 16 Oct 2008 11:48:42 +0000
parents 7df3d9a17631
children 248f432fca05
comparison
equal deleted inserted replaced
98775:91b65d9aa48b 98776:58d0fa1979cb
286 (equal (format-time-string "%s" (nth 5 ats)) 286 (equal (format-time-string "%s" (nth 5 ats))
287 (match-string 1))) 287 (match-string 1)))
288 'up-to-date 288 'up-to-date
289 'edited))))))))) 289 'edited)))))))))
290 290
291 (defun vc-arch-dir-status (dir callback)
292 "Run 'tla inventory' for DIR and pass results to CALLBACK.
293 CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
294 `vc-dir-refresh'."
295 (let ((default-directory dir))
296 (vc-arch-command t 'async nil "changes"))
297 ;; The updating could be done asynchronously.
298 (vc-exec-after
299 `(vc-arch-after-dir-status ',callback)))
300
301 (defun vc-arch-after-dir-status (callback)
302 (let* ((state-map '(("M " . edited)
303 ("Mb" . edited) ;binary
304 ("D " . removed)
305 ("D/" . removed) ;directory
306 ("A " . added)
307 ("A/" . added) ;directory
308 ("=>" . renamed)
309 ("/>" . renamed) ;directory
310 ("lf" . symlink-to-file)
311 ("fl" . file-to-symlink)
312 ("--" . permissions-changed)
313 ("-/" . permissions-changed) ;directory
314 ))
315 (state-map-regexp (regexp-opt (mapcar 'car state-map) t))
316 (entry-regexp (concat "^" state-map-regexp " \\(.*\\)$"))
317 result)
318 (goto-char (point-min))
319 ;;(message "Got %s" (buffer-string))
320 (while (re-search-forward entry-regexp nil t)
321 (let* ((state-string (match-string 1))
322 (state (cdr (assoc state-string state-map)))
323 (filename (match-string 2)))
324 (push (list filename state) result)))
325
326 (funcall callback result nil)))
327
291 (defun vc-arch-working-revision (file) 328 (defun vc-arch-working-revision (file)
292 (let* ((root (expand-file-name "{arch}" (vc-arch-root file))) 329 (let* ((root (expand-file-name "{arch}" (vc-arch-root file)))
293 (defbranch (vc-arch-default-version file))) 330 (defbranch (vc-arch-default-version file)))
294 (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*?\\)\\(?:--.*\\)?\\)--.*\\)\\'" defbranch)) 331 (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*?\\)\\(?:--.*\\)?\\)--.*\\)\\'" defbranch))
295 (let* ((archive (match-string 1 defbranch)) 332 (let* ((archive (match-string 1 defbranch))