Changeset 15439 in project for release/4/qwiki/trunk/qwiki-svn.scm


Ignore:
Timestamp:
08/13/09 18:49:44 (11 years ago)
Author:
sjamaan
Message:

Implement handling of conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/qwiki/trunk/qwiki-svn.scm

    r15437 r15439  
    3939  (qwiki-repos-uri qwiki-repos-username qwiki-repos-password
    4040   get-history call-with-input-revision checkout-sources! update-sources!
    41    store-changes!)
     41   store-changes! undo-changes!)
    4242
    4343(import chicken scheme)
     
    8484
    8585(define (update-sources! source-path)
    86   (svn-update (qwiki-repos-uri) source-path svn-opt-revision-head
    87               (qwiki-repos-username) (qwiki-repos-password)))
     86  (if (and (file-exists? source-path)
     87           (not (directory? source-path)))
     88      (update-sources! (pathname-directory source-path))
     89      (svn-update (qwiki-repos-uri) source-path svn-opt-revision-head
     90                  (qwiki-repos-username) (qwiki-repos-password))))
    8891
    8992(define (store-changes! source-path message username password)
    90   (let* ((user (or username (qwiki-repos-username)))
    91          (pass (or password (qwiki-repos-password)))
    92          (get-info
    93           (lambda (path)
    94             (let ((info '()))
    95               (svn-client-info path
    96                                svn-opt-revision-unspecified
    97                                svn-opt-revision-unspecified
    98                                (lambda (path i) (set! info (cons i info)))
    99                                #f user pass)
    100               (and (not (null? info)) (car info))))))
    101    (let loop ((source-path source-path))
    102      (if (get-info source-path)
    103          (svn-commit source-path user pass message)
    104          (begin
    105            (loop (pathname-directory source-path)) ; Add parent dirs if needed
    106            (svn-add source-path user pass)
    107            (svn-commit source-path user pass message))))))
     93  (or
     94   (let* ((user (or username (qwiki-repos-username)))
     95          (pass (or password (qwiki-repos-password)))
     96          (get-info
     97           (lambda (path)
     98             (let ((info '()))
     99               (svn-client-info path
     100                                svn-opt-revision-unspecified
     101                                svn-opt-revision-unspecified
     102                                (lambda (path i) (set! info (cons i info)))
     103                                #f user pass)
     104               (and (not (null? info)) (car info))))))
     105     (let loop ((source-path source-path))
     106       (if (get-info source-path)
     107           (svn-commit source-path user pass message)
     108           (begin
     109             (loop (pathname-directory source-path)) ; Add parent dirs if needed
     110             (svn-add source-path user pass)
     111             (svn-commit source-path user pass message)))))
     112   (error "Could not store changes")))
     113
     114(define (undo-changes! source-path)
     115  (svn-client-revert (list source-path) #t
     116                     (qwiki-repos-username)
     117                     (qwiki-repos-password)))
    108118
    109119)
Note: See TracChangeset for help on using the changeset viewer.