Changeset 33974 in project


Ignore:
Timestamp:
04/16/17 13:45:33 (5 weeks ago)
Author:
sjamaan
Message:

svn-client: Make svn-diff accept revisions to diff (API change!)

Location:
release/4/svn-client/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/4/svn-client/trunk/svn-client-base.c

    r32360 r33974  
    1818
    1919static svn_opt_revision_t revision_head;
     20static svn_opt_revision_t revision_working;
    2021static svn_opt_revision_t revision_unspecified;
    2122
     
    152153  revision_head.kind = svn_opt_revision_head;
    153154  revision_unspecified.kind = svn_opt_revision_unspecified;
     155  revision_working.kind = svn_opt_revision_working;
    154156}
  • release/4/svn-client/trunk/svn-client.scm

    r33968 r33974  
    1414
    1515   make-svn-opt-revision-number svn-opt-revision-head
    16    svn-opt-revision-unspecified svn-opt-revision-number
     16   svn-opt-revision-working svn-opt-revision-unspecified
     17   svn-opt-revision-number
    1718
    1819   svn-commit svn-checkout svn-diff svn-client-list svn-propget
     
    133134  (make-svn-opt-revision
    134135   (foreign-value "&revision_head" (c-pointer "svn_opt_revision_t"))))
     136
     137(define svn-opt-revision-working
     138  (make-svn-opt-revision
     139   (foreign-value "&revision_working" (c-pointer "svn_opt_revision_t"))))
    135140
    136141(define svn-opt-revision-unspecified
     
    315320
    316321(define svn-diff
    317   (foreign-lambda* c-string* ((svn-path-or-url path) (svn-depth depth)
     322  (foreign-lambda* c-string* ((svn-path-or-url path)
     323                              (svn-opt-revision-type rev1)
     324                              (svn-opt-revision-type rev2)
     325                              (svn-depth depth)
    318326                              (c-string user) (c-string pass))
    319327#<<EOF
    320328  apr_array_header_t *diff_opts = NULL;
    321329  char template[] = "/tmp/svnwiki-diff-XXXXXX";
    322   svn_opt_revision_t rev1, rev2;
    323330  apr_file_t *outfile;
    324331  svn_stream_t *outstream;
     
    329336  diff_opts = apr_array_make(tmp_pool, 0, sizeof (char *));
    330337 
    331   rev1.kind = svn_opt_revision_head;
    332   rev2.kind = svn_opt_revision_working;
    333 
    334338  apr_file_mktemp(&outfile, template, APR_CREATE|APR_WRITE|APR_EXCL, tmp_pool);
    335339  outstream = svn_stream_from_aprfile2(outfile, FALSE, tmp_pool);
     
    337341  set_creds_for_next_command(user, pass);
    338342
    339   err = svn_client_diff6(diff_opts, path, &rev1, path, &rev2,
     343  err = svn_client_diff6(diff_opts, path, rev1, path, rev2,
    340344                         NULL, depth, FALSE, TRUE, TRUE, FALSE,
    341345                         FALSE, FALSE, FALSE, FALSE, APR_LOCALE_CHARSET,
  • release/4/svn-client/trunk/tests/run.scm

    r33963 r33974  
    9999(test-group "modification"
    100100  (write-svn-file "testdir/bar" "Changed")
    101   (let* ((diff-file (svn-diff (svn-file "testdir/bar") #t user pass))
     101  (let* ((diff-file (svn-diff (svn-file "testdir/bar")
     102                              svn-opt-revision-head
     103                              svn-opt-revision-working
     104                              #t user pass))
    102105         (diff (with-input-from-file diff-file read-lines)))
    103106    (delete-file* diff-file)
     
    108111          (cddddr diff)))
    109112  (test-assert "Reverting file" (svn-client-revert (list (svn-file "testdir/bar")) #f user pass))
    110   (let* ((diff-file (svn-diff (svn-file "testdir/bar") #t user pass))
     113  (let* ((diff-file (svn-diff (svn-file "testdir/bar")
     114                              svn-opt-revision-head
     115                              svn-opt-revision-working
     116                              #t user pass))
    111117         (diff (with-input-from-file diff-file read-lines)))
    112118    (delete-file* diff-file)
     
    116122  (write-svn-file "testdir/bar" "Changed")
    117123  (test-assert "Changed file can be committed"
    118                (svn-commit (svn-file "testdir/bar") #t user pass "Modified for the first time")))
     124               (svn-commit (svn-file "testdir/bar") #t user pass "Modified for the first time"))
     125
     126  (let* ((info (svn-client-info (svn-file "testdir/bar")
     127                                svn-opt-revision-head
     128                                svn-opt-revision-head
     129                                #f user pass))
     130         (rev (svn-info-rev (cadar info)))
     131         (diff-file (svn-diff (svn-file "testdir/bar")
     132                              (make-svn-opt-revision-number (sub1 rev))
     133                              (make-svn-opt-revision-number rev)
     134                              #t user pass))
     135         (diff (with-input-from-file diff-file read-lines)))
     136    (test "revision just committed is 3" 3 rev)
     137    (delete-file* diff-file)
     138    (test "Unified context diff file contents of revision just committed"
     139          '("@@ -1 +1 @@"
     140            "-Also just added"
     141            "+Changed")
     142          (cddddr diff))))
    119143
    120144(test-group "basic log"
Note: See TracChangeset for help on using the changeset viewer.