Changeset 7271


Ignore:
Timestamp:
Sep 23, 2007, 4:43:30 AM (12 years ago)
Author:
gb
Message:

LOCAL-SVN-REVISION tries to determine the (local) svn revision, by
looking for a .svnrev file (used in the svn->cvs synching process)
or by parsing "svn info" output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/misc.lisp

    r5920 r7271  
    696696
    697697(%fhave 'df #'disassemble)
     698
     699(defun local-svn-revision ()
     700  (or
     701   ;; svn2cvs uses a .svnrev file to sync CVS and SVN; if present,
     702   ;; it contains the svn revision in decimal.
     703   (with-open-file (f "ccl:\\.svnrev" :direction :input :if-does-not-exist nil)
     704     (when f (read f)))
     705   (with-output-to-string (s)
     706    (multiple-value-bind (status exit-code)
     707        (external-process-status
     708         (run-program "svn"  (list "info" (native-translated-namestring "ccl:")):output s))
     709      (when (and (eq :exited status) (zerop exit-code))
     710        (with-input-from-string (output (get-output-stream-string s))
     711          (do* ((line (read-line output nil nil)
     712                      (read-line output nil nil))
     713                (revstring "Revision:")
     714                (revstringlen (length revstring)))
     715               ((null line))
     716            (when (string= line revstring :end1 revstringlen)
     717              (return-from local-svn-revision
     718                (values (parse-integer line :start revstringlen)))))))))))
Note: See TracChangeset for help on using the changeset viewer.