aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 :-(."
191 (while (not (or root 191 (while (not (or root
192 (equal file (setq file (file-name-directory file))) 192 (equal file (setq file (file-name-directory file)))
193 (null file))) 193 (null file)))
194 (if (file-directory-p (expand-file-name "{arch}" file)) 194 ;; Check the =tagging-method, in case someone naively manually
195 ;; creates a {arch} directory somewhere.
196 (if (file-exists-p (expand-file-name "{arch}/=tagging-method" file))
195 (setq root file) 197 (setq root file)
196 (setq file (directory-file-name file)))) 198 (setq file (directory-file-name file))))
197 root)))) 199 root))))
198 200
199(defun vc-arch-register (file &optional rev comment) 201(defun vc-arch-register (file &optional rev comment)
200 (if rev (error "Explicit initial revision not supported for Arch.")) 202 (if rev (error "Explicit initial revision not supported for Arch"))
201 (let ((tagmet (vc-arch-tagging-method file))) 203 (let ((tagmet (vc-arch-tagging-method file)))
202 (if (and (memq tagmet '(tagline implicit)) comment-start) 204 (if (and (memq tagmet '(tagline implicit)) comment-start)
203 (with-current-buffer (find-file-noselect file) 205 (with-current-buffer (find-file-noselect file)
204 (vc-arch-add-tagline)) 206 (if (buffer-modified-p)
207 (error "Save %s first" (buffer-name)))
208 (vc-arch-add-tagline)
209 (save-buffer))
205 (vc-arch-command nil 0 file "add")))) 210 (vc-arch-command nil 0 file "add"))))
206 211
207(defun vc-arch-registered (file) 212(defun vc-arch-registered (file)
@@ -272,7 +277,7 @@ Return non-nil if FILE is unchanged."
272 (match-string 1))) 277 (match-string 1)))
273 'up-to-date 278 'up-to-date
274 'edited))))))))) 279 'edited)))))))))
275 280
276(defun vc-arch-workfile-version (file) 281(defun vc-arch-workfile-version (file)
277 (let* ((root (expand-file-name "{arch}" (vc-arch-root file))) 282 (let* ((root (expand-file-name "{arch}" (vc-arch-root file)))
278 (defbranch (vc-arch-default-version file))) 283 (defbranch (vc-arch-default-version file)))
@@ -328,14 +333,13 @@ Return non-nil if FILE is unchanged."
328 (looking-at "Conflicts occured, diff3 conflict markers left in file\\."))))) 333 (looking-at "Conflicts occured, diff3 conflict markers left in file\\.")))))
329 334
330(defun vc-arch-delete-rej-if-obsolete () 335(defun vc-arch-delete-rej-if-obsolete ()
331 "For use in `write-file-functions'." 336 "For use in `after-save-hook'."
332 (let ((rej (concat buffer-file-name ".rej"))) 337 (save-excursion
333 (when (and buffer-file-name (vc-arch-diff3-rej-p rej)) 338 (let ((rej (concat buffer-file-name ".rej")))
334 (if (not (re-search-forward "^>>>>>>> " nil t)) 339 (when (and buffer-file-name (vc-arch-diff3-rej-p rej))
335 ;; The .rej file is obsolete. 340 (if (not (re-search-forward "^<<<<<<< " nil t))
336 (condition-case nil (delete-file rej) (error nil))))) 341 ;; The .rej file is obsolete.
337 ;; This did not save the buffer. 342 (condition-case nil (delete-file rej) (error nil)))))))
338 nil)
339 343
340(defun vc-arch-find-file-hook () 344(defun vc-arch-find-file-hook ()
341 (let ((rej (concat buffer-file-name ".rej"))) 345 (let ((rej (concat buffer-file-name ".rej")))
@@ -343,11 +347,11 @@ Return non-nil if FILE is unchanged."
343 (if (vc-arch-diff3-rej-p rej) 347 (if (vc-arch-diff3-rej-p rej)
344 (save-excursion 348 (save-excursion
345 (goto-char (point-min)) 349 (goto-char (point-min))
346 (if (not (re-search-forward "^>>>>>>> " nil t)) 350 (if (not (re-search-forward "^<<<<<<< " nil t))
347 ;; The .rej file is obsolete. 351 ;; The .rej file is obsolete.
348 (condition-case nil (delete-file rej) (error nil)) 352 (condition-case nil (delete-file rej) (error nil))
349 (smerge-mode 1) 353 (smerge-mode 1)
350 (add-hook 'write-file-functions 354 (add-hook 'after-save-hook
351 'vc-arch-delete-rej-if-obsolete nil t) 355 'vc-arch-delete-rej-if-obsolete nil t)
352 (message "There are unresolved conflicts in this file"))) 356 (message "There are unresolved conflicts in this file")))
353 (message "There are unresolved conflicts in %s" 357 (message "There are unresolved conflicts in %s"
@@ -403,10 +407,14 @@ Return non-nil if FILE is unchanged."
403(defun vc-arch-rename-file (old new) 407(defun vc-arch-rename-file (old new)
404 (vc-arch-command nil 0 new "mv" (file-relative-name old))) 408 (vc-arch-command nil 0 new "mv" (file-relative-name old)))
405 409
410(defalias 'vc-arch-responsible-p 'vc-arch-root)
411
406(defun vc-arch-command (buffer okstatus file &rest flags) 412(defun vc-arch-command (buffer okstatus file &rest flags)
407 "A wrapper around `vc-do-command' for use in vc-arch.el." 413 "A wrapper around `vc-do-command' for use in vc-arch.el."
408 (apply 'vc-do-command buffer okstatus vc-arch-command file flags)) 414 (apply 'vc-do-command buffer okstatus vc-arch-command file flags))
409 415
416(defun vc-arch-init-version () nil)
417
410(provide 'vc-arch) 418(provide 'vc-arch)
411 419
412;;; arch-tag: a35c7c1c-5237-429d-88ef-3d718fd2e704 420;;; arch-tag: a35c7c1c-5237-429d-88ef-3d718fd2e704