From a80a6b030822c104b89d36106b2bbabf74b62c60 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 4 Oct 2008 20:24:24 +0000 Subject: [PATCH] (vc-svn-after-dir-status): Handle `svn status -u' output. (vc-svn-dir-status): Respect vc-stay-local-p. (Bug#1046) --- lisp/ChangeLog | 3 +++ lisp/vc-svn.el | 25 +++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0a0c2df8c86..61004dcc163 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2008-10-04 Glenn Morris + * vc-svn.el (vc-svn-after-dir-status): Handle `svn status -u' output. + (vc-svn-dir-status): Respect vc-stay-local-p. (Bug#1046) + * vc-cvs.el (vc-cvs-dir-status-heuristic): New function. (vc-cvs-dir-status): Respect vc-stay-local-p. (Bug#1046) diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el index 06985611f47..f44b55e2a48 100644 --- a/lisp/vc-svn.el +++ b/lisp/vc-svn.el @@ -1,6 +1,7 @@ ;;; vc-svn.el --- non-resident support for Subversion version-control -;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 +;; Free Software Foundation, Inc. ;; Author: FSF (see vc.el for full credits) ;; Maintainer: Stefan Monnier @@ -146,7 +147,9 @@ If you want to force an empty list of arguments, use t." "SVN-specific state heuristic." (vc-svn-state file 'local)) -(defun vc-svn-after-dir-status (callback) +;; FIXME it would be better not to have the "remote" argument, +;; but to distinguish the two output formats based on content. +(defun vc-svn-after-dir-status (callback &optional remote) (let ((state-map '((?A . added) (?C . conflict) (?D . removed) @@ -156,11 +159,18 @@ If you want to force an empty list of arguments, use t." (?? . unregistered) ;; This is what vc-svn-parse-status does. (?~ . edited))) + (re (if remote "^\\(.\\)..... \\([ *]\\) +[-0-9]+ +\\(.*\\)$" + ;; Subexp 2 is a dummy in this case, so the numbers match. + "^\\(.\\)....\\(.\\) \\(.*\\)$")) result) (goto-char (point-min)) - (while (re-search-forward "^\\(.\\)..... \\(.*\\)$" nil t) + (while (re-search-forward re nil t) (let ((state (cdr (assq (aref (match-string 1) 0) state-map))) - (filename (match-string 2))) + (filename (match-string 3))) + (and remote (string-equal (match-string 2) "*") + ;; FIXME are there other possible combinations? + (cond ((eq state 'edited) (setq state 'needs-merge)) + ((not state) (setq state 'needs-update)))) (when state (setq result (cons (list filename state) result))))) (funcall callback result))) @@ -169,9 +179,12 @@ If you want to force an empty list of arguments, use t." "Run 'svn status' for DIR and update BUFFER via CALLBACK. CALLBACK is called as (CALLBACK RESULT BUFFER), where RESULT is a list of conses (FILE . STATE) for directory DIR." - (vc-svn-command (current-buffer) 'async nil "status") + ;; FIXME should this rather be all the files in dir? + (let ((remote (not (vc-stay-local-p dir)))) + (vc-svn-command (current-buffer) 'async nil "status" + (if remote "-u")) (vc-exec-after - `(vc-svn-after-dir-status (quote ,callback)))) + `(vc-svn-after-dir-status (quote ,callback) ,remote)))) (defun vc-svn-dir-status-files (dir files default-state callback) (apply 'vc-svn-command (current-buffer) 'async nil "status" files) -- 2.11.4.GIT