;;; vc-arch.el --- VC backend for the Arch version-control system
-;; Copyright (C) 1995,98,99,2000,01,02,03,2004 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Free Software Foundation, Inc.
;; Author: FSF (see vc.el for full credits)
;; Maintainer: Stefan Monnier <monnier@gnu.org>
(put 'Arch 'vc-functions nil)
;;;###autoload (defun vc-arch-registered (file)
-;;;###autoload (let ((dir file))
-;;;###autoload (while (and (stringp dir)
-;;;###autoload (not (equal
-;;;###autoload dir (setq dir (file-name-directory dir))))
-;;;###autoload dir)
-;;;###autoload (setq dir (if (file-directory-p
-;;;###autoload (expand-file-name "{arch}" dir))
-;;;###autoload t (directory-file-name dir))))
-;;;###autoload (if (eq dir t)
-;;;###autoload (progn
-;;;###autoload (load "vc-arch")
-;;;###autoload (vc-arch-registered file)))))
+;;;###autoload (if (vc-find-root file "{arch}/=tagging-method")
+;;;###autoload (progn
+;;;###autoload (load "vc-arch")
+;;;###autoload (vc-arch-registered file))))
(defun vc-arch-add-tagline ()
"Add an `arch-tag' to the end of the current file."
(defun vc-arch-root (file)
"Return the root directory of a Arch project, if any."
(or (vc-file-getprop file 'arch-root)
- (vc-file-setprop
- file 'arch-root
- (let ((root nil))
- (while (not (or root
- (equal file (setq file (file-name-directory file)))
- (null 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))))
+ (vc-file-setprop
+ ;; Check the =tagging-method, in case someone naively manually
+ ;; creates a {arch} directory somewhere.
+ file 'arch-root (vc-find-root file "{arch}/=tagging-method"))))
(defun vc-arch-register (file &optional rev comment)
(if rev (error "Explicit initial revision not supported for Arch"))
(with-current-buffer (find-file-noselect sigfile)
(goto-char (point-min))
(while (and (search-forward id nil 'move)
- (progn (goto-char (- (match-beginning 0) 2))
- ;; Ignore E_ entries used for foo.id files.
- (or (not (bolp)) (looking-at "E_")))))
+ (save-excursion
+ (goto-char (- (match-beginning 0) 2))
+ ;; For `names', the lines start with `?./foo/bar'.
+ ;; For others there's 2 chars before the ./foo/bar.
+ (or (not (or (bolp) (looking-at "\n?")))
+ ;; Ignore E_ entries used for foo.id files.
+ (looking-at "E_")))))
(if (eobp)
;; ID not found.
(if (equal (file-name-nondirectory sigfile)
;; Buh? Unexpected format.
'edited
(let ((ats (file-attributes file)))
- (if (and (= (nth 7 ats) (string-to-number (match-string 2)))
+ (if (and (eq (nth 7 ats) (string-to-number (match-string 2)))
(equal (format-time-string "%s" (nth 5 ats))
(match-string 1)))
'up-to-date
(setq logdir (expand-file-name version logdir))
(setq logdir (expand-file-name archive logdir))
(setq logdir (expand-file-name "patch-log" logdir))
- ;; Revision names go: base-0, patch-N, version-0, versionfix-N.
- (dolist (file (directory-files logdir))
+ (dolist (file (if (file-directory-p logdir) (directory-files logdir)))
+ ;; Revision names go: base-0, patch-N, version-0, versionfix-M.
(when (and (eq (aref file 0) ?v) (not sealed))
(setq sealed t rev-nb 0))
(if (and (string-match "-\\([0-9]+\\)\\'" file)
(or (not sealed) (eq (aref file 0) ?v))
(>= tmp rev-nb))
(setq rev-nb tmp rev file)))
- (concat defbranch "--" rev)))))
+ ;; Use "none-000" if the tree hasn't yet been committed on the
+ ;; default branch. We'll then get "Arch:000[branch]" on the mode-line.
+ (concat defbranch "--" (or rev "none-000"))))))
(defcustom vc-arch-mode-line-rewrite
'(("\\`.*--\\(.*--.*\\)--\\(v?\\).*-\\([0-9]+\\)\\'" . "\\2\\3[\\1]"))
"Rewrite rules to shorten Arch's revision names on the mode-line."
- :type '(repeat (cons regexp string)))
+ :type '(repeat (cons regexp string))
+ :group 'vc)
(defun vc-arch-mode-line-string (file)
"Return string for placement in modeline by `vc-mode-line' for FILE."
(vc-arch-command nil 0 file "commit" "-s" summary "-L" comment "--"
(vc-switches 'Arch 'checkin))))
-(defun vc-arch-diff (file &optional oldvers newvers)
+(defun vc-arch-diff (file &optional oldvers newvers buffer)
"Get a difference report using Arch between two versions of FILE."
(if (and newvers
(vc-up-to-date-p file)
(default-directory (vc-arch-root file))
(status
(vc-arch-command
- "*vc-diff*"
+ (or buffer "*vc-diff*")
(if async 'async 1)
nil "file-diffs"
;; Arch does not support the typical flags.
(provide 'vc-arch)
-;;; arch-tag: a35c7c1c-5237-429d-88ef-3d718fd2e704
+;; arch-tag: a35c7c1c-5237-429d-88ef-3d718fd2e704
;;; vc-arch.el ends here