summaryrefslogtreecommitdiff
path: root/lisp/vc-arch.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2004-04-12 04:23:38 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2004-04-12 04:23:38 +0000
commit7bbdf1cb6e9d781df9d8aaf2fd44128d2da28016 (patch)
tree40c37cb87929cd83a1259fc2b23d0688d0947e86 /lisp/vc-arch.el
parent4a8da016cac6ccf23b2f846bc1e212443b7888a0 (diff)
downloademacs-7bbdf1cb6e9d781df9d8aaf2fd44128d2da28016.tar.gz
(vc-arch-root): Be a bit more careful.
(vc-arch-register): Save the buffer if we modified it. (vc-arch-delete-rej-if-obsolete): Save excursion. (vc-arch-find-file-hook): Use the simpler after-save-hook. (vc-arch-responsible-p, vc-arch-init-version): New functions.
Diffstat (limited to 'lisp/vc-arch.el')
-rw-r--r--lisp/vc-arch.el36
1 files changed, 22 insertions, 14 deletions
diff --git a/lisp/vc-arch.el b/lisp/vc-arch.el
index 32c5f5459ad..c8efca02832 100644
--- a/lisp/vc-arch.el
+++ b/lisp/vc-arch.el
@@ -191,17 +191,22 @@ Only the value `maybe' can be trusted :-(."
(while (not (or root
(equal file (setq file (file-name-directory file)))
(null file)))
- (if (file-directory-p (expand-file-name "{arch}" file))
+ ;; Check the =tagging-method, in case someone naively manually
+ ;; creates a {arch} directory somewhere.
+ (if (file-exists-p (expand-file-name "{arch}/=tagging-method" file))
(setq root file)
(setq file (directory-file-name file))))
root))))
(defun vc-arch-register (file &optional rev comment)
- (if rev (error "Explicit initial revision not supported for Arch."))
+ (if rev (error "Explicit initial revision not supported for Arch"))
(let ((tagmet (vc-arch-tagging-method file)))
(if (and (memq tagmet '(tagline implicit)) comment-start)
(with-current-buffer (find-file-noselect file)
- (vc-arch-add-tagline))
+ (if (buffer-modified-p)
+ (error "Save %s first" (buffer-name)))
+ (vc-arch-add-tagline)
+ (save-buffer))
(vc-arch-command nil 0 file "add"))))
(defun vc-arch-registered (file)
@@ -272,7 +277,7 @@ Return non-nil if FILE is unchanged."
(match-string 1)))
'up-to-date
'edited)))))))))
-
+
(defun vc-arch-workfile-version (file)
(let* ((root (expand-file-name "{arch}" (vc-arch-root file)))
(defbranch (vc-arch-default-version file)))
@@ -328,14 +333,13 @@ Return non-nil if FILE is unchanged."
(looking-at "Conflicts occured, diff3 conflict markers left in file\\.")))))
(defun vc-arch-delete-rej-if-obsolete ()
- "For use in `write-file-functions'."
- (let ((rej (concat buffer-file-name ".rej")))
- (when (and buffer-file-name (vc-arch-diff3-rej-p rej))
- (if (not (re-search-forward "^>>>>>>> " nil t))
- ;; The .rej file is obsolete.
- (condition-case nil (delete-file rej) (error nil)))))
- ;; This did not save the buffer.
- nil)
+ "For use in `after-save-hook'."
+ (save-excursion
+ (let ((rej (concat buffer-file-name ".rej")))
+ (when (and buffer-file-name (vc-arch-diff3-rej-p rej))
+ (if (not (re-search-forward "^<<<<<<< " nil t))
+ ;; The .rej file is obsolete.
+ (condition-case nil (delete-file rej) (error nil)))))))
(defun vc-arch-find-file-hook ()
(let ((rej (concat buffer-file-name ".rej")))
@@ -343,11 +347,11 @@ Return non-nil if FILE is unchanged."
(if (vc-arch-diff3-rej-p rej)
(save-excursion
(goto-char (point-min))
- (if (not (re-search-forward "^>>>>>>> " nil t))
+ (if (not (re-search-forward "^<<<<<<< " nil t))
;; The .rej file is obsolete.
(condition-case nil (delete-file rej) (error nil))
(smerge-mode 1)
- (add-hook 'write-file-functions
+ (add-hook 'after-save-hook
'vc-arch-delete-rej-if-obsolete nil t)
(message "There are unresolved conflicts in this file")))
(message "There are unresolved conflicts in %s"
@@ -403,10 +407,14 @@ Return non-nil if FILE is unchanged."
(defun vc-arch-rename-file (old new)
(vc-arch-command nil 0 new "mv" (file-relative-name old)))
+(defalias 'vc-arch-responsible-p 'vc-arch-root)
+
(defun vc-arch-command (buffer okstatus file &rest flags)
"A wrapper around `vc-do-command' for use in vc-arch.el."
(apply 'vc-do-command buffer okstatus vc-arch-command file flags))
+(defun vc-arch-init-version () nil)
+
(provide 'vc-arch)
;;; arch-tag: a35c7c1c-5237-429d-88ef-3d718fd2e704