Changeset 15490 in project


Ignore:
Timestamp:
08/15/09 13:02:59 (10 years ago)
Author:
sjamaan
Message:

Handle reverting of directories

Location:
release/4/qwiki/trunk
Files:
2 edited

Legend:

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

    r15439 r15490  
    9090                  (qwiki-repos-username) (qwiki-repos-password))))
    9191
     92(define (get-info path)
     93  (let ((info '()))
     94    (svn-client-info path
     95                     svn-opt-revision-unspecified
     96                     svn-opt-revision-unspecified
     97                     (lambda (path i) (set! info (cons i info)))
     98                     #f (qwiki-repos-username) (qwiki-repos-password))
     99    (and (not (null? info)) (car info))))
     100
    92101(define (store-changes! source-path message username password)
    93102  (or
    94103   (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))))))
     104          (pass (or password (qwiki-repos-password))))
    105105     (let loop ((source-path source-path))
    106106       (if (get-info source-path)
     
    113113
    114114(define (undo-changes! source-path)
    115   (svn-client-revert (list source-path) #t
    116                      (qwiki-repos-username)
    117                      (qwiki-repos-password)))
     115  (if (get-info source-path) ; Existing file?
     116      (begin
     117        (svn-client-revert (list source-path) #t
     118                           (qwiki-repos-username)
     119                           (qwiki-repos-password))
     120        (update-sources! source-path))
     121      (begin (delete-file* source-path)
     122             (let loop ((path (pathname-directory source-path)))
     123               (if (get-info path)
     124                   (update-sources! path)
     125                   (begin
     126                     (delete-directory path)
     127                     (loop (pathname-directory path))))))))
    118128
    119129)
  • release/4/qwiki/trunk/qwiki.scm

    r15475 r15490  
    224224            (begin
    225225              (undo-changes! source-file)
    226               (update-sources! source-file)
    227226              (send-content (make-form (conc "Warning! Someone has edited this page while you were editing it. You can click save again to overwrite those changes with yours if this is the case."
    228227                                             (if auth
Note: See TracChangeset for help on using the changeset viewer.