# HG changeset patch # User Stefan Monnier # Date 1079578086 0 # Node ID 504aef04e4937a48515e0fdf22c0438065df6e61 # Parent c9a4b36c9ee031619cc08ae92544e492b6892681 (vc-arch-workfile-version, vc-arch-mode-line-rewrite): Take sealed revisions into account. (vc-arch-checkin): Extract a summary line from the message. diff -r c9a4b36c9ee0 -r 504aef04e493 lisp/vc-arch.el --- a/lisp/vc-arch.el Thu Mar 18 00:20:44 2004 +0000 +++ b/lisp/vc-arch.el Thu Mar 18 02:48:06 2004 +0000 @@ -40,10 +40,17 @@ ;; Bugs: +;; - Opening a new file prompts "blabla was lost; check out? (yes or no)". +;; - *VC-log*'s initial content lacks the `Summary:' lines. ;; - All files under the tree are considered as "under Arch's control" ;; without regards to =tagging-method and such. ;; - Files are always considered as `edited'. +;; - C-x v l does not work. ;; - C-x v i does not work. +;; - C-x v ~ does not work. +;; - C-x v u does not work. +;; - C-x v s does not work. +;; - C-x v r does not work. ;; - VC-dired does not work. ;; - And more... @@ -141,7 +148,7 @@ (category (match-string 4 defbranch)) (branch (match-string 3 defbranch)) (version (match-string 2 defbranch)) - (rev-nb 0) + (sealed nil) (rev-nb 0) (rev nil) logdir tmp) (setq logdir (expand-file-name category root)) @@ -149,16 +156,20 @@ (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)) + (when (and (eq (aref file 0) ?v) (not sealed)) + (setq sealed t rev-nb 0)) (if (and (string-match "-\\([0-9]+\\)\\'" file) (setq tmp (string-to-number (match-string 1 file))) + (or (not sealed) (eq (aref file 0) ?v)) (>= tmp rev-nb)) (setq rev-nb tmp rev file))) (concat defbranch "--" rev))))) (defcustom vc-arch-mode-line-rewrite - '(("\\`.*--\\(.*--.*\\)--.*-\\([0-9]+\\)\\'" . "\\2[\\1]")) + '(("\\`.*--\\(.*--.*\\)--\\(v?\\).*-\\([0-9]+\\)\\'" . "\\2\\3[\\1]")) "Rewrite rules to shorten Arch's revision names on the mode-line." :type '(repeat (cons regexp string))) @@ -209,8 +220,14 @@ (defun vc-arch-checkin (file rev comment) (if rev (error "Committing to a specific revision is unsupported.")) - (vc-arch-command nil 0 file "commit" "-L" comment "--" - (vc-switches 'Arch 'checkin))) + (let ((summary (file-relative-name file (vc-arch-root file)))) + ;; Extract a summary from the comment. + (when (or (string-match "\\`Summary:[ \t]*\\(.*[^ \t\n]\\)\\([ \t]*\n\\)*" comment) + (string-match "\\`[ \t]*\\(.*[^ \t\n]\\)[ \t]*\\(\n?\\'\\|\n\\([ \t]*\n\\)+\\)" comment)) + (setq summary (match-string 1 comment)) + (setq comment (substring comment (match-end 0)))) + (vc-arch-command nil 0 file "commit" "-s" summary "-L" comment "--" + (vc-switches 'Arch 'checkin)))) (defun vc-arch-diff (file &optional oldvers newvers) "Get a difference report using Arch between two versions of FILE."