-
Notifications
You must be signed in to change notification settings - Fork 0
/
SvnInterface.h
114 lines (84 loc) · 3.35 KB
/
SvnInterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//----------------------------------------------------------------------------------------
// SvnInterface.h - Interface to Subversion libraries
//
// Copyright © Chris, 2003 - 2010. All rights reserved.
//----------------------------------------------------------------------------------------
#pragma once
#include "DbgUtils.h"
#include "CommonUtils.h"
#ifndef DARWIN
#define DARWIN
#endif
#include "svn_client.h"
#include "svn_cmdline.h"
#include "svn_pools.h"
//----------------------------------------------------------------------------------------
typedef enum svn_wc_status_kind SvnWCStatusKind;
typedef apr_pool_t* SvnPool;
typedef apr_array_header_t* SvnArray;
typedef apr_hash_t* SvnHash;
typedef apr_hash_index_t* SvnHashIndex;
typedef svn_boolean_t SvnBool;
typedef svn_string_t* SvnString;
typedef svn_opt_revision_t SvnOptRevision;
typedef svn_revnum_t SvnRevNum;
typedef svn_node_kind_t SvnNodeKind;
typedef svn_error_t* SvnError;
typedef svn_client_ctx_t* SvnClient;
typedef svn_client_proplist_item_t* SvnProplistItem;
typedef svn_auth_baton_t* SvnAuth;
typedef svn_auth_provider_object_t* SvnAuthProvider;
typedef svn_wc_status2_t* SvnStatus;
typedef const svn_info_t* SvnInfo;
typedef struct SvnEnv SvnEnv;
static const int kSvnRetryLimit = 2;
static const SvnBool kSvnRecurse = true,
kSvnLock = true;
//----------------------------------------------------------------------------------------
@protocol SvnInterface
- (NSString*) user;
- (NSString*) pass;
@end // SvnInterface
//typedef NSObject<SvnInterface> SvnInterface;
typedef NSObject SvnInterface;
//----------------------------------------------------------------------------------------
// NSObject wrapper for svn_error_t*
@interface SvnException : NSObject
{
SvnError fError;
};
- (id) init: (SvnError) err;
- (SvnError) error;
- (NSString*) message;
@end // SvnException
void SvnDoThrow (SvnError err);
void SvnDoReport (SvnError err);
#if qDebug
#define SvnThrowIf(expr) DbgSvnThrowIf((expr), _F_L_F_)
#define SvnReportCatch(ex) DbgSvnReportCatch((ex), _F_L_F_)
void DbgSvnPrint (SvnError err);
void DbgSvnThrowIf (SvnError err, ConstCStr file, int line, ConstCStr func);
void DbgSvnReportCatch(SvnException* ex, ConstCStr file, int line, ConstCStr func);
#elif !qDebug
#define SvnThrowIf(expr) SvnDoThrowIf((expr))
#define SvnReportCatch(ex) SvnDoReport([(ex) error])
static inline void SvnDoThrowIf (SvnError err) { if (err) SvnDoThrow(err); }
#endif
//----------------------------------------------------------------------------------------
BOOL SvnInitialize (void);
BOOL SvnWantAndHave (void);
SvnPool SvnNewPool (void);
void SvnDeletePool (SvnPool pool);
SvnRevNum SvnRevNumFromString (NSString* revision);
NSString* SvnRevNumToString (SvnRevNum rev);
NSString* SvnStatusToString (SvnWCStatusKind kind);
SvnClient SvnSetupClient (SvnEnv** envRef, SvnInterface* delegate);
void SvnEndClient (SvnEnv* env);
SvnPool SvnGetPool (SvnEnv* env);
static inline
SvnArray SvnNewArray (SvnPool pool, int count, int elem_size)
{ return apr_array_make(pool, count, elem_size); }
int SvnRun (NSArray* args, NSData** stdOut, NSData** stdErr,
NSTimeInterval maxTime); // maxTime=0 => default
//----------------------------------------------------------------------------------------
// End of SvnInterface.h