info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

checking for ssh-agent in pcl-cvs


From: Stephen Leake
Subject: checking for ssh-agent in pcl-cvs
Date: Sun, 14 Apr 2002 18:38:10 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

I use cvs over ssh under ssh-agent for some of my repositories, and I
sometimes try to start cvs-examine without first starting emacs under
ssh-agent, which just hangs forever. This is a patch that checks for
ssh-agent first, if necessary. 

(defun cvs-check-ssh ()
  "Throw an error if we should be running under ssh-agent, but aren't."
  (let ((default-directory directory))
    (if (and
         (string-match ":ext:" (cvs-get-cvsroot))
         (equal "ssh" (getenv "CVS_RSH"))
         (not (getenv "SSH_AGENT_PID")))
          (error "not running under ssh-agent"))))

;; Add cvs-pre-examine-hook, for cvs-check-ssh
(defcustom cvs-pre-examine-hook 'cvs-check-ssh
  "Hook run by cvs-examine, after prompting for directory and flags,
before running cvs update."
  :group 'pcl-cvs
  :type '(hook :options (cvs-check-ssh)))

(defun cvs-examine (directory flags &optional noshow)
  "Run a `cvs -n update' in the specified DIRECTORY.
That is, check what needs to be done, but don't change the disc.
Feed the output to a *cvs* buffer and run `cvs-mode' on it.
With a prefix argument, prompt for a directory and cvs FLAGS to use.
A prefix arg >8 (ex: \\[universal-argument] \\[universal-argument]),
  prevents reuse of an existing *cvs* buffer.
Optional argument NOSHOW if non-nil means not to display the buffer."
  (interactive (list (cvs-query-directory "CVS Examine (directory): ")
                     (cvs-flags-query 'cvs-update-flags "cvs -n update flags")))
  (when (eq flags t)
    (setf flags (cvs-flags-query 'cvs-update-flags nil 'noquery)))
  (run-hooks cvs-pre-examine-hook)
  (cvs-cmd-do "update" directory flags nil
              (> (prefix-numeric-value current-prefix-arg) 8)
              :cvsargs '("-n")
              :noshow noshow
              :dont-change-disc t))


-- 
-- Stephe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]