-;; Check for (X)Emacs version.
-(let ((x (if (or (>= emacs-major-version 22)
- (and (featurep 'xemacs)
- (= emacs-major-version 21)
- (>= emacs-minor-version 4)))
- "ok"
- (format "Tramp 2.2.11-pre is not fit for %s"
- (when (string-match "^.*$" (emacs-version))
- (match-string 0 (emacs-version)))))))
+(defun tramp-repository-get-version ()
+ "Try to return as a string the repository revision of the Tramp sources."
+ (let ((dir (locate-dominating-file (locate-library "tramp") ".git")))
+ (when dir
+ (with-temp-buffer
+ (let ((default-directory (file-name-as-directory dir)))
+ (and (zerop
+ (ignore-errors
+ (call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
+ (not (zerop (buffer-size)))
+ (replace-regexp-in-string "\n" "" (buffer-string))))))))
+
+;; Check for Emacs version.
+(let ((x (if (>= emacs-major-version 23)
+ "ok"
+ (format "Tramp 2.3.0-pre is not fit for %s"
+ (when (string-match "^.*$" (emacs-version))
+ (match-string 0 (emacs-version)))))))