From 05342dca46131c1726f503def80e45012e5cbc0f Mon Sep 17 00:00:00 2001 From: Sam Steingold Date: Wed, 12 Nov 2008 04:47:18 +0000 Subject: [PATCH] (vc-cvs-parse-root): Handle roots without colon between hostname and path. --- lisp/ChangeLog | 5 +++++ lisp/vc-cvs.el | 17 +++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 935fa82b10d..a9f5e15987a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-11-12 Sam Steingold + + * vc-cvs.el (vc-cvs-parse-root): Handle roots without colon + between hostname and path. + 2008-11-11 Juri Linkov * dired-aux.el (dired-isearch-filenames) diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index cd5c86fe7f2..1e47a6543f2 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el @@ -720,10 +720,16 @@ and that it passes `vc-cvs-global-switches' to it before FLAGS." (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 @@ For an empty string, nil is returned (invalid CVS root)." ;; 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))))) -- 2.39.2