Mercurial > emacs
comparison lisp/vc-arch.el @ 81960:5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
makes only the minimum changes needed to get the old vc.el logic
working with the new back ends.
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Wed, 18 Jul 2007 16:31:56 +0000 |
parents | 0e6cd7deb746 |
children | 066eaef90bfb |
comparison
equal
deleted
inserted
replaced
81959:429f67c3e26d | 81960:5a8f965c55ba |
---|---|
196 (vc-file-setprop | 196 (vc-file-setprop |
197 ;; Check the =tagging-method, in case someone naively manually | 197 ;; Check the =tagging-method, in case someone naively manually |
198 ;; creates a {arch} directory somewhere. | 198 ;; creates a {arch} directory somewhere. |
199 file 'arch-root (vc-find-root file "{arch}/=tagging-method")))) | 199 file 'arch-root (vc-find-root file "{arch}/=tagging-method")))) |
200 | 200 |
201 (defun vc-arch-register (file &optional rev comment) | 201 (defun vc-arch-register (files &optional rev comment) |
202 (if rev (error "Explicit initial revision not supported for Arch")) | 202 (if rev (error "Explicit initial revision not supported for Arch")) |
203 (let ((tagmet (vc-arch-tagging-method file))) | 203 (dolist (file files) |
204 (if (and (memq tagmet '(tagline implicit)) comment-start) | 204 (let ((tagmet (vc-arch-tagging-method file))) |
205 (with-current-buffer (find-file-noselect file) | 205 (if (and (memq tagmet '(tagline implicit)) comment-start) |
206 (if (buffer-modified-p) | 206 (with-current-buffer (find-file-noselect file) |
207 (error "Save %s first" (buffer-name))) | 207 (if (buffer-modified-p) |
208 (vc-arch-add-tagline) | 208 (error "Save %s first" (buffer-name))) |
209 (save-buffer)) | 209 (vc-arch-add-tagline) |
210 (vc-arch-command nil 0 file "add")))) | 210 (save-buffer))))) |
211 (vc-arch-command nil 0 files "add")) | |
211 | 212 |
212 (defun vc-arch-registered (file) | 213 (defun vc-arch-registered (file) |
213 ;; Don't seriously check whether it's source or not. Checking would | 214 ;; Don't seriously check whether it's source or not. Checking would |
214 ;; require running TLA, so it's better to not do it, so it also works if | 215 ;; require running TLA, so it's better to not do it, so it also works if |
215 ;; TLA is not installed. | 216 ;; TLA is not installed. |
369 ;; so we shouldn't ask the user whether she wants to check it out. | 370 ;; so we shouldn't ask the user whether she wants to check it out. |
370 ) | 371 ) |
371 | 372 |
372 (defun vc-arch-checkout-model (file) 'implicit) | 373 (defun vc-arch-checkout-model (file) 'implicit) |
373 | 374 |
374 (defun vc-arch-checkin (file rev comment) | 375 (defun vc-arch-checkin (files rev comment) |
375 (if rev (error "Committing to a specific revision is unsupported")) | 376 (if rev (error "Committing to a specific revision is unsupported")) |
376 (let ((summary (file-relative-name file (vc-arch-root file)))) | 377 ;; FIXME: This implementation probably only works for singleton filesets |
378 (let ((summary (file-relative-name (car file) (vc-arch-root (car files))))) | |
377 ;; Extract a summary from the comment. | 379 ;; Extract a summary from the comment. |
378 (when (or (string-match "\\`Summary:[ \t]*\\(.*[^ \t\n]\\)\\([ \t]*\n\\)*" comment) | 380 (when (or (string-match "\\`Summary:[ \t]*\\(.*[^ \t\n]\\)\\([ \t]*\n\\)*" comment) |
379 (string-match "\\`[ \t]*\\(.*[^ \t\n]\\)[ \t]*\\(\n?\\'\\|\n\\([ \t]*\n\\)+\\)" comment)) | 381 (string-match "\\`[ \t]*\\(.*[^ \t\n]\\)[ \t]*\\(\n?\\'\\|\n\\([ \t]*\n\\)+\\)" comment)) |
380 (setq summary (match-string 1 comment)) | 382 (setq summary (match-string 1 comment)) |
381 (setq comment (substring comment (match-end 0)))) | 383 (setq comment (substring comment (match-end 0)))) |
382 (vc-arch-command nil 0 file "commit" "-s" summary "-L" comment "--" | 384 (vc-arch-command nil 0 files "commit" "-s" summary "-L" comment "--" |
383 (vc-switches 'Arch 'checkin)))) | 385 (vc-switches 'Arch 'checkin)))) |
384 | 386 |
385 (defun vc-arch-diff (file &optional oldvers newvers buffer) | 387 (defun vc-arch-diff (files &optional oldvers newvers buffer) |
386 "Get a difference report using Arch between two versions of FILE." | 388 "Get a difference report using Arch between two versions of FILES." |
389 ;; FIXME: This implementation probably only works for singleton filesets | |
387 (if (and newvers | 390 (if (and newvers |
388 (vc-up-to-date-p file) | 391 (vc-up-to-date-p file) |
389 (equal newvers (vc-workfile-version file))) | 392 (equal newvers (vc-workfile-version (car files)))) |
390 ;; Newvers is the base revision and the current file is unchanged, | 393 ;; Newvers is the base revision and the current file is unchanged, |
391 ;; so we can diff with the current file. | 394 ;; so we can diff with the current file. |
392 (setq newvers nil)) | 395 (setq newvers nil)) |
393 (if newvers | 396 (if newvers |
394 (error "Diffing specific revisions not implemented") | 397 (error "Diffing specific revisions not implemented") |
395 (let* ((async (and (not vc-disable-async-diff) (fboundp 'start-process))) | 398 (let* ((async (and (not vc-disable-async-diff) (fboundp 'start-process))) |
396 ;; Run the command from the root dir. | 399 ;; Run the command from the root dir. |
397 (default-directory (vc-arch-root file)) | 400 (default-directory (vc-arch-root (car files))) |
398 (status | 401 (status |
399 (vc-arch-command | 402 (vc-arch-command |
400 (or buffer "*vc-diff*") | 403 (or buffer "*vc-diff*") |
401 (if async 'async 1) | 404 (if async 'async 1) |
402 nil "file-diffs" | 405 nil "file-diffs" |
403 ;; Arch does not support the typical flags. | 406 ;; Arch does not support the typical flags. |
404 ;; (vc-switches 'Arch 'diff) | 407 ;; (vc-switches 'Arch 'diff) |
405 (file-relative-name file) | 408 (mapcar 'file-relative-name files) |
406 (if (equal oldvers (vc-workfile-version file)) | 409 (if (equal oldvers (vc-workfile-version (car files))) |
407 nil | 410 nil |
408 oldvers)))) | 411 oldvers)))) |
409 (if async 1 status)))) ; async diff, pessimistic assumption. | 412 (if async 1 status)))) ; async diff, pessimistic assumption. |
410 | 413 |
411 (defun vc-arch-delete-file (file) | 414 (defun vc-arch-delete-file (file) |