Changeset 2481 in project


Ignore:
Timestamp:
11/19/06 17:36:56 (15 years ago)
Author:
azul
Message:

svn_client_cat and svn_client_cat2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • svn-client/trunk/svn-client.scm

    r1030 r2481  
    22#include <apr.h>
    33#include <apr_hash.h>
     4#include <apr_file_io.h>
    45#include <apr_pools.h>
    56#include <svn_auth.h>
     
    301302  mkstemp(template);
    302303  apr_file_open(&outfile, template, APR_WRITE, APR_OS_DEFAULT, svn_pool);
    303 
    304304  svn_client_diff(diff_opts, path, &rev1, path, &rev2, TRUE, FALSE, TRUE, outfile, NULL, svn_ctx, svn_pool);
     305  apr_file_close(outfile);
    305306  return(strdup(template));
    306307EOF
     
    592593EOF
    593594))
     595
     596(define svn-client-cat2
     597  (foreign-safe-lambda* c-string* ((c-string path_or_url) (svn-opt-revision-type peg_revision) (svn-opt-revision-type revision) (c-string user) (c-string pass))
     598#<<EOF
     599  apr_array_header_t *diff_opts = apr_array_make(svn_pool, 0, sizeof (char *));
     600  char template[] = "/tmp/svnwiki-cat-XXXXXX";
     601  apr_file_t *outfile;
     602  svn_stream_t *out;
     603  apr_pool_t *pool;
     604
     605  apr_file_t *stdout_file;
     606  svn_error_t *err;
     607
     608  svnwiki_user = user;
     609  svnwiki_pass = pass;
     610
     611  pool = svn_pool_create(NULL);
     612
     613  mkstemp(template);
     614
     615  apr_file_open(&outfile, template, APR_WRITE, APR_OS_DEFAULT, pool);
     616  out = svn_stream_from_aprfile(outfile, pool);
     617
     618  err = svn_client_cat2(out, path_or_url, peg_revision, revision, svn_ctx, pool);
     619  if (err)
     620    {
     621      svn_handle_error(err, stderr, FALSE);
     622      return(C_SCHEME_FALSE);
     623    }
     624
     625  svn_stream_close(out);
     626  apr_pool_destroy(pool);
     627
     628  return(strdup(template));
     629EOF
     630))
     631
     632(define (svn-client-cat path-or-url revision user pass)
     633  (svn-client-cat2 path-or-url revision revision user pass))
Note: See TracChangeset for help on using the changeset viewer.