changeset 99498:ea9a7a9912a9

(vc-cvs-parse-root): Handle roots without colon between hostname and path.
author Sam Steingold <sds@gnu.org>
date Wed, 12 Nov 2008 04:47:18 +0000
parents 6f3388683948
children ba33a322491d
files lisp/ChangeLog lisp/vc-cvs.el
diffstat 2 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Nov 11 20:14:38 2008 +0000
+++ b/lisp/ChangeLog	Wed Nov 12 04:47:18 2008 +0000
@@ -1,3 +1,8 @@
+2008-11-12  Sam Steingold  <sds@gnu.org>
+
+	* vc-cvs.el (vc-cvs-parse-root): Handle roots without colon
+	between hostname and path.
+
 2008-11-11  Juri Linkov  <juri@jurta.org>
 
 	* dired-aux.el (dired-isearch-filenames)
--- a/lisp/vc-cvs.el	Tue Nov 11 20:14:38 2008 +0000
+++ b/lisp/vc-cvs.el	Wed Nov 12 04:47:18 2008 +0000
@@ -720,10 +720,16 @@
 		(buffer-substring (point)
 				  (line-end-position))))))))
 
+(defun vc-cvs-parse-uhp (path)
+  "parse user@host/path into (user@host /path)"
+  (if (string-match "\\([^/]+\\)\\(/.*\\)" path)
+      (list (match-string 1 path) (match-string 2 path))
+      (list nil path)))
+
 (defun vc-cvs-parse-root (root)
   "Split CVS ROOT specification string into a list of fields.
 A CVS root specification of the form
-  [:METHOD:][[USER@]HOSTNAME:]/path/to/repository
+  [:METHOD:][[USER@]HOSTNAME]:?/path/to/repository
 is converted to a normalized record with the following structure:
   \(METHOD USER HOSTNAME CVS-ROOT).
 The default METHOD for a CVS root of the form
@@ -745,17 +751,16 @@
             ;; Invalid CVS root
             nil)
            ((= len 1)
-            ;; Simple PATH => method `local'
-            (cons "local"
-                  (cons nil root-list)))
+            (let ((uhp (vc-cvs-parse-uhp (car root-list))))
+              (cons (if (car uhp) "ext" "local") uhp)))
            ((= len 2)
             ;; [USER@]HOST:PATH => method `ext'
             (and (not (equal (car root-list) ""))
                  (cons "ext" root-list)))
            ((= len 3)
-            ;; :METHOD:PATH
+            ;; :METHOD:PATH or :METHOD:USER@HOSTNAME/PATH
             (cons (cadr root-list)
-                  (cons nil (cddr root-list))))
+                  (vc-cvs-parse-uhp (caddr root-list))))
            (t
             ;; :METHOD:[USER@]HOST:PATH
             (cdr root-list)))))