00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <stdlib.h>
00010 #include <unistd.h>
00011
00012
00013 #include "global.h"
00014 #include "waa.h"
00015 #include "revert.h"
00016 #include "url.h"
00017 #include "est_ops.h"
00018
00019
00045 int cat__work(struct estat *root, int argc, char *argv[])
00046 {
00047 int status;
00048 char **normalized;
00049 struct estat *sts;
00050 struct svn_stream_t *output;
00051 svn_error_t *status_svn;
00052
00053
00054 status=0;
00055 STOPIF_CODE_ERR( argc != 1, EINVAL,
00056 "!Exactly a single path must be given.");
00057
00058 STOPIF_CODE_ERR( opt_target_revisions_given > 1, EINVAL,
00059 "!At most a single revision is allowed.");
00060
00061 STOPIF( waa__find_common_base(argc, argv, &normalized), NULL);
00062 STOPIF( url__load_list(NULL, 0), NULL);
00063 STOPIF( waa__input_tree( root, NULL, NULL), NULL);
00064
00065 STOPIF( ops__traverse(root, normalized[0],
00066 OPS__FAIL_NOT_LIST, 0, &sts), NULL);
00067
00068 current_url=sts->url;
00069 STOPIF_CODE_ERR( !current_url, EINVAL,
00070 "!For this entry no URL is known.");
00071
00072 STOPIF( url__open_session(NULL, NULL), NULL);
00073 STOPIF_SVNERR( svn_stream_for_stdout,
00074 (&output, global_pool));
00075
00076 STOPIF( rev__get_text_to_stream( normalized[0],
00077 opt_target_revisions_given ?
00078 opt_target_revision : sts->repos_rev,
00079 DECODER_UNKNOWN,
00080 output, NULL, NULL, NULL, global_pool), NULL);
00081
00082 ex:
00083 return status;
00084 }
00085