[Starteam-el-users] Some fixes/additions
Status: Beta
Brought to you by:
m0smith
|
From: Inger, M. <in...@Sy...> - 2002-12-13 16:01:55
|
I've made a few fixes to the starteam.el library to account for the
configuration
of starteam that i have here. They may be useful for everyone though, so
please
evaluate and whoever maintains the code, if you think they're useful, please
put them
in.. The 2 problems are as follows:
1) The directory "src" at the root level of the project view has a working
folder
of "WEB-INF/src", so if i check out "src/file.java" it ends up at
"WEB-INF/src/file.java".
When alist is: ((E:/Project Project/View))
I try to list "Project/View/WEB-INF/src", and the module
interperates this
as me wanting to list "WEB-INF/src", which of course doesn't exist
When alist is: ((E:/Project/WEB-INF Project/View))
I can successfully list "Project/View/WEB-INF/src", however, it now
has decided
(due to the params "-rp E:/Project/WEB-INF") that the directory will
be stored at
"E:/Project/WEB-INF/WEB-INF/src" it simply appends the working
folder for the
"src" folder to the working folder for the project. Hence, the
double WEB-INF.
The following changes will files that problem:
a) The structure of the list is a little different. (If anyone knows
how to get this into
a real alist, let me know, my Lisp Skills are a bit rusty)
((E:/Project/WEB-INF/src E:/Project Project/View)
(E:/Project E:/Project Project/View))
The second item in the list is what should be used as the working
folder for
the project, when the file matches the pattern in the first item
in the list.
b) The following function changes are necessary to accout for this
(I've removed
the comments for ease of reading
(defun starteam-get-starteam-path-from-local-path (local-dir)
(let ((still-looking t)
(path nil))
(mapcar (function (lambda (x)
(if (and still-looking
(string-match (nth 0 x) local-dir))
(setq still-looking nil
path (concat (nth 2 x)
(substring local-dir
(match-end 0))))
nil)))
starteam-to-directory-alist)
(if (not path)
(error "Could match local path %s to path in any known Starteam
view" local-dir)
path)
))
(defun starteam-get-working-dir-from-local-path (local-dir)
(let* ((working-dir nil)
(still-looking t))
(mapcar (lambda (x)
(if (and still-looking
(string-match (nth 0 x) local-dir))
(setq still-looking nil
working-dir (nth 1 x))
nil))
starteam-to-directory-alist)
(if (not working-dir)
(error "Could match local path %s to path in any known Starteam
view" local-dir)
working-dir)
))
2) There was no way to recursively create the directory structure unless you
checked out
all the files. So, I build the following method to do this:
(defun starteam-build-directory-structure (indir)
(interactive "DDirectory Name:")
(let*
((dir (expand-file-name indir))
(path (starteam-get-starteam-path-from-local-path dir))
(output-buffer)
(command "local-mkdir")
)
(message "Building recursive directory structure for %s..." dir)
(save-excursion
(setq output-buffer
(starteam-execute command
"LOCAL MKDIR"
path ""
"-is" "-rp"
(starteam-get-working-dir-from-local-path dir)))
)
(switch-to-buffer output-buffer)
)
)
Which requires the following method to be changed to allow for any empty
file
specification:
(defun starteam-execute (command operation-string path &optional file &rest
args)
(if starteam-debug
(message "Starteam %s operation: [ %s %s %s ]"
operation-string
(concat starteam-executable " " command " -x -p \""
(starteam-get-login-info) "/" path "\"" )
(starteam-stringlist-to-single-string args) file)
nil)
(let ((bname (concat
"*Starteam [" command "] "
path
"*")))
(save-excursion
(get-buffer-create bname)
(set-buffer bname)
(toggle-read-only -1)
(erase-buffer)
)
;(message "starteam executing [%s %s %s]" (concat starteam-executable "
" command " -x -p \"" (starteam-get-login-info) "/" path "\"" )
(starteam-stringlist-to-single-string args) file)
(if args
;(apply 'call-process "C:\\winnt\\system32\\cmd.exe" nil bname nil
"/C" "echo" "ECHOING: "
(apply 'call-process starteam-executable nil bname nil
command
"-nologo" ; don't print executable version
"-x" ; non-interactive
"-p"
(concat (starteam-get-login-info) "/" path)
(append (starteam-remove-bad-starteam-args args)
(if (and file (> (length file) 0))
(list file)
(list)
))
)
;(apply 'call-process "C:\\winnt\\system32\\cmd.exe" nil bname nil
"/C" "echo" "BOO"
(apply 'call-process starteam-executable nil bname nil
command
"-nologo"
"-x"
"-p"
(concat (starteam-get-login-info) "/" path)
(if file (list file) nil)
)
)
(save-excursion
(set-buffer bname)
(goto-char (point-min))
)
bname))
------------------------
Matthew Inger
in...@sy...
Software Developer
Synygy, Inc
610-664-7433 x7770
|