]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-arch.el
(calc-time, calc-date-notation, math-this-year, math-parse-date)
[gnu-emacs] / lisp / vc-arch.el
index 2cadfdc299f55077d69801816e6d5ecdf1915034..b821928c539ebaef446bd345b0c086ccd3514e15 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-arch.el --- VC backend for the Arch version-control system
 
-;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 ;;           Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 (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."
@@ -186,18 +178,10 @@ Only the value `maybe' can be trusted :-(."
 (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"))
@@ -254,9 +238,13 @@ Return non-nil if FILE is unchanged."
        (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)
@@ -282,7 +270,7 @@ Return non-nil if FILE is unchanged."
 (defun vc-arch-workfile-version (file)
   (let* ((root (expand-file-name "{arch}" (vc-arch-root file)))
         (defbranch (vc-arch-default-version file)))
-    (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*\\)--.*\\)--.*\\)\\'" defbranch))
+    (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*?\\)\\(?:--.*\\)?\\)--.*\\)\\'" defbranch))
       (let* ((archive (match-string 1 defbranch))
             (category (match-string 4 defbranch))
             (branch (match-string 3 defbranch))
@@ -295,8 +283,8 @@ Return non-nil if FILE is unchanged."
        (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)
@@ -389,7 +377,7 @@ Return non-nil if FILE is unchanged."
       (setq newvers nil))
   (if newvers
       (error "Diffing specific revisions not implemented.")
-    (let* ((async (fboundp 'start-process))
+    (let* ((async (and (not vc-disable-async-diff) (fboundp 'start-process)))
           ;; Run the command from the root dir.
           (default-directory (vc-arch-root file))
           (status