Changeset 15492 in project


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

Fix handling of directories - it was a mess before, it's better but slower now

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

Legend:

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

    r15491 r15492  
    112112   (error "Could not store changes")))
    113113
    114 ;; This not only undoes the changes, but also updates to the latest version
    115 ;; of the file...
    116114(define (undo-changes! source-path)
    117   (if (get-info source-path) ; Existing file?
     115  (if (get-info source-path)            ; Existing file?
     116      (svn-client-revert (list source-path) #t
     117                         (qwiki-repos-username)
     118                         (qwiki-repos-password))
    118119      (begin
    119         (svn-client-revert (list source-path) #t
    120                            (qwiki-repos-username)
    121                            (qwiki-repos-password))
    122         (update-sources! source-path))
    123       (begin (delete-file* source-path)
    124              (let loop ((path (pathname-directory source-path)))
    125                (if (get-info path)
    126                    (update-sources! path)
    127                    (begin
    128                      (delete-directory path)
    129                      (loop (pathname-directory path))))))))
     120        (delete-file* source-path)
     121        (let loop ((path (pathname-directory source-path)))
     122          (unless (get-info path)
     123            (begin
     124              (delete-directory path)
     125              (loop (pathname-directory path))))))))
    130126
    131127)
  • release/4/qwiki/trunk/qwiki.scm

    r15490 r15492  
    224224            (begin
    225225              (undo-changes! source-file)
     226              ;; No idea how to cleanly ensure a proper update...
     227              ;; The enclosing directory might have been removed, or the file
     228              ;; might have been deleted, renamed etc.  Let's just update the
     229              ;; whole tree (but this can take a long time)
     230              (ensure-latest-sources! #t)
    226231              (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."
    227232                                             (if auth
     
    295300  (or (string=? name ".") (string=? name "..") (string-index name #\/)))
    296301
    297 (define (ensure-latest-sources!)
     302(define (ensure-latest-sources! #!optional force?)
    298303  (if (not (directory-exists? (qwiki-source-path)))
    299304      (checkout-sources! (qwiki-source-path))
    300305      ;; Not sure if this should be done every freaking time - it's slow!
    301       #;(update-sources! (qwiki-source-path))
    302       (void)))
     306      (if force?
     307          (update-sources! (qwiki-source-path))
     308          (void))))
    303309
    304310;; Spiffy handler for requests that should be routed to the wiki
Note: See TracChangeset for help on using the changeset viewer.