Changeset 9684


Ignore:
Timestamp:
Jun 6, 2008, 9:13:15 PM (11 years ago)
Author:
mikel
Message:

added test for changes in the remote repo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/ide-self-update.lisp

    r9682 r9684  
    4040;;; url utils
    4141;;; -----------------------------------------------------------------
     42
     43;;; URL-P thing
     44;;; -----------------------------------------------------------------
     45;;; returns true if THING is a string that appears to contain a URL,
     46;;; NIL otherwise
     47
     48(defmethod url-p (thing)
     49  (declare (ignore thing))
     50  nil)
     51
     52(defmethod url-p ((url string))
     53  (if (find-matching-subsequence "://" url)
     54      t
     55      nil))
    4256
    4357;;; URL-PROTOCOL url
     
    120134  (get-svn-info (namestring p)))
    121135
     136(defmethod svn-repository ((p string))
     137  (let* ((info (get-svn-info p))
     138         (repo-entry (assoc "URL" info :test #'string=)))
     139    (when repo-entry (second repo-entry))))
     140
     141(defmethod svn-repository ((p pathname))
     142  (svn-repository (namestring p)))
     143
    122144(defmethod svn-revision ((p string))
    123145  (let* ((info (get-svn-info p))
     
    134156;;;       in the case that authentication is required. code left here
    135157;;;       for future reference
    136 
    137 ;;; we infer from the information in the URL field of the svn info
    138 ;;; whether we need to authenticate. The assumed criteria in this
    139 ;;; implementation are that we don't need to authenticate if the
    140 ;;; URL is an http:: URL; if it's an svn+ssh URL, then we do need
    141 ;;; to authenticate
    142158
    143159(defparameter *authentication-window-controller* nil)
     
    198214
    199215(defun valid-repository-for-svn-update? (url)
    200   (and (stringp url)
    201        ;; TODO: examine the url to see if it makes sense
    202        ))
     216  (url-p url))
    203217
    204218(defun valid-directory-for-svn-update? (dir)
     
    237251  (run-svn-update-for-directory (gui::find-ccl-directory)))
    238252
     253(defun svn-update-available-p ()
     254  (let ((ccl-dir (gui::find-ccl-directory)))
     255    (if (valid-directory-for-svn-update? ccl-dir)
     256        ;; compare revision number of working copy with repo
     257        (let* ((repo (svn-repository ccl-dir))
     258               (local-revision (read-from-string (svn-revision ccl-dir)))
     259               (repo-revision (read-from-string (svn-revision repo))))
     260          (< local-revision repo-revision))
     261        nil)))
     262
    239263;;; -----------------------------------------------------------------
    240264;;; app delegate extensions to handle self-update UI
Note: See TracChangeset for help on using the changeset viewer.