Changeset 15741 for lang/gauche

Show
Ignore:
Timestamp:
07/13/08 15:53:11 (4 months ago)
Author:
kiyoka
Message:

Added plugin svn.scm.

Location:
lang/gauche/oldtype/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/svn.scm

    r15710 r15741  
    3838  (use gauche.process) 
    3939  (export init 
     40          commit 
     41          status 
     42          get-fullpath 
    4043          <svn-work> 
     44          )) 
    4145(select-module oldtype.svn) 
    4246 
     
    6569(define-method init ((self <svn-work>) session-id) 
    6670  (set! (path-of self) session-id) 
     71  ;; /bin/rm if already exist 
     72  (call-with-input-process 
     73   (format "/bin/rm -rf ~a" (get-fullpath self)) 
     74   (lambda (p) 
     75     (display (port->string p)))) 
    6776  ;; mkdir  
    6877  (make-directory* (get-fullpath self)) 
    6978  ;; checkout 
    70   (co self)) 
     79  (_co self)) 
    7180 
    7281 
    73 (define-method co ((self <svn-work>)) 
     82 
     83(define-method _co ((self <svn-work>)) 
    7484  (call-with-input-process 
    7585   (format "cd ~a ; svn co --no-auth-cache --username ~a --password ~a ~a/edit" 
     
    7888           (url-of self)) 
    7989   (lambda (p) 
    80      (display (port->string p))))) 
     90     (let1 str (port->string-list p) 
     91           (display (port->string p)) 
     92           (last str))))) 
    8193 
    8294 
    8395(define-method get-fullpath ((self <svn-work>)) 
    8496  (string-append (basepath-of self) "/" (path-of self))) 
     97 
     98 
     99(define-method status ((self <svn-work>) wikiname) 
     100  (call-with-input-process 
     101   (format "cd ~a ; svn status --non-interactive --no-auth-cache --username ~a --password ~a edit/~a" 
     102           (get-fullpath self) 
     103           (user-of self) (pass-of self) 
     104           (string-append wikiname ".ot")) 
     105   (lambda (p) 
     106     (let1 str (port->string p) 
     107           (display str) 
     108           (if (string= "" str) 
     109               #f 
     110               (string-split str #/[ ]+/)))))) 
    85111 
    86112 
     
    91117           (user-of self) (pass-of self)) 
    92118   (lambda (p) 
    93      (display (port->string p))))) 
    94  
     119     (display (port->string p)))) 
     120  #t) 
    95121 
    96122 
  • lang/gauche/oldtype/trunk/Kahua/oldtype/plugins/oldtype.scm

    r13389 r15741  
    1818(allow-module oldtype.timeline) 
    1919(allow-module oldtype.page) 
     20(allow-module oldtype.svn) 
    2021(allow-module rfc.uri) 
  • lang/gauche/oldtype/trunk/src/test.scm

    r14305 r15741  
    1313(use oldtype.page) 
    1414(use oldtype.core) 
     15(use oldtype.svn) 
    1516(use gauche.test)                                                      
    1617(use util.list) 
     
    168169      (test-end) 
    169170 
     171      (test-start "svn commit") 
     172 
     173      (let1 work 
     174            (make <svn-work> :url "http://genkan.sumibi.org/svn/newtype" :user "anonymous" :pass "anonymous" :basepath "/Users/kiyoka/work/tmp") 
     175             
     176            (test "Initialize svn work directory" 
     177                  #t 
     178                  (lambda () 
     179                    (string? (init work "123")))) 
     180 
     181            (test "status of wikiname (no changes)" 
     182                  #f 
     183                  (lambda () 
     184                    (status work "_kiyoka"))) 
     185 
     186            (test "status of wikiname (some changes)" 
     187                  "M" 
     188                  (lambda () 
     189                    (sys-system (format "echo 'a' >> ~a/~a/~a" (get-fullpath work) "edit" "_kiyoka.ot")) 
     190                    (car (status work "_kiyoka")))) 
     191 
     192            (when 
     193                #f 
     194              (test "commit from work" 
     195                    #t 
     196                    (lambda () 
     197                      (commit work))))) 
     198 
     199      (test-end) 
     200       
    170201      )))