Menu

[r568]: / branches / multiSCCS / src / SCCS.h  Maximize  Restore  History

Download this file

318 lines (280 with data), 10.4 kB

  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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
// CommitMonitor - simple checker for new commits in svn repositories
// Copyright (C) 2007, 2009-2010 - Stefan Kueng
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#pragma once
#include <vector>
#include <map>
#include "apr_general.h"
#include "svn_pools.h"
#include "svn_client.h"
#include "svn_path.h"
#include "svn_wc.h"
#include "svn_utf.h"
#include "svn_config.h"
#include "svn_error_codes.h"
#include "svn_subst.h"
#include "svn_repos.h"
#include "svn_time.h"
#include "SVNPool.h"
#include "UnicodeUtils.h"
#include "Registry.h"
#include "SerializeUtils.h"
#include "ProgressDlg.h"
#include <string>
using namespace std;
class SVNInfoData
{
public:
SVNInfoData(){}
std::wstring url;
svn_revnum_t rev;
svn_node_kind_t kind;
std::wstring reposRoot;
std::wstring reposUUID;
svn_revnum_t lastchangedrev;
__time64_t lastchangedtime;
std::wstring author;
std::wstring lock_path;
std::wstring lock_token;
std::wstring lock_owner;
std::wstring lock_comment;
bool lock_davcomment;
__time64_t lock_createtime;
__time64_t lock_expirationtime;
bool hasWCInfo;
svn_wc_schedule_t schedule;
std::wstring copyfromurl;
svn_revnum_t copyfromrev;
__time64_t texttime;
__time64_t proptime;
std::wstring checksum;
std::wstring conflict_old;
std::wstring conflict_new;
std::wstring conflict_wrk;
std::wstring prejfile;
};
class SVNLogChangedPaths
{
public:
SVNLogChangedPaths()
: action(0)
{
}
wchar_t action;
svn_revnum_t copyfrom_revision;
std::wstring copyfrom_path;
bool Save(FILE * hFile) const
{
if (!CSerializeUtils::SaveNumber(hFile, action))
return false;
if (!CSerializeUtils::SaveNumber(hFile, copyfrom_revision))
return false;
if (!CSerializeUtils::SaveString(hFile, copyfrom_path))
return false;
return true;
}
bool Load(FILE * hFile)
{
unsigned __int64 value;
if (!CSerializeUtils::LoadNumber(hFile, value))
return false;
action = (wchar_t)value;
if (!CSerializeUtils::LoadNumber(hFile, value))
return false;
copyfrom_revision = (svn_revnum_t)value;
if (!CSerializeUtils::LoadString(hFile, copyfrom_path))
return false;
return true;
}
bool Load(const unsigned char *& buf)
{
unsigned __int64 value;
if (!CSerializeUtils::LoadNumber(buf, value))
return false;
action = (wchar_t)value;
if (!CSerializeUtils::LoadNumber(buf, value))
return false;
copyfrom_revision = (svn_revnum_t)value;
if (!CSerializeUtils::LoadString(buf, copyfrom_path))
return false;
return true;
}
};
class SVNLogEntry
{
public:
SVNLogEntry()
: read(false)
, revision(0)
, date(0)
{
}
bool read;
svn_revnum_t revision;
std::wstring author;
apr_time_t date;
std::wstring message;
map<std::wstring, SVNLogChangedPaths> m_changedPaths;
bool Save(FILE * hFile) const
{
if (!CSerializeUtils::SaveNumber(hFile, read))
return false;
if (!CSerializeUtils::SaveNumber(hFile, revision))
return false;
if (!CSerializeUtils::SaveString(hFile, author))
return false;
if (!CSerializeUtils::SaveNumber(hFile, date))
return false;
if (!CSerializeUtils::SaveString(hFile, message))
return false;
if (!CSerializeUtils::SaveNumber(hFile, CSerializeUtils::SerializeType_Map))
return false;
if (!CSerializeUtils::SaveNumber(hFile, m_changedPaths.size()))
return false;
for (map<std::wstring,SVNLogChangedPaths>::const_iterator it = m_changedPaths.begin(); it != m_changedPaths.end(); ++it)
{
if (!CSerializeUtils::SaveString(hFile, it->first))
return false;
if (!it->second.Save(hFile))
return false;
}
return true;
}
bool Load(FILE * hFile)
{
unsigned __int64 value = 0;
if (!CSerializeUtils::LoadNumber(hFile, value))
return false;
read = !!value;
if (!CSerializeUtils::LoadNumber(hFile, value))
return false;
revision = (svn_revnum_t)value;
if (!CSerializeUtils::LoadString(hFile, author))
return false;
if (!CSerializeUtils::LoadNumber(hFile, value))
return false;
date = value;
if (!CSerializeUtils::LoadString(hFile, message))
return false;
m_changedPaths.clear();
if (!CSerializeUtils::LoadNumber(hFile, value))
return false;
if (CSerializeUtils::SerializeType_Map == value)
{
if (CSerializeUtils::LoadNumber(hFile, value))
{
for (unsigned __int64 i=0; i<value; ++i)
{
wstring key;
SVNLogChangedPaths cpaths;
if (!CSerializeUtils::LoadString(hFile, key))
return false;
if (!cpaths.Load(hFile))
return false;
m_changedPaths[key] = cpaths;
}
return true;
}
}
return false;
}
bool Load(const unsigned char *& buf)
{
unsigned __int64 value = 0;
if (!CSerializeUtils::LoadNumber(buf, value))
return false;
read = !!value;
if (!CSerializeUtils::LoadNumber(buf, value))
return false;
revision = (svn_revnum_t)value;
if (!CSerializeUtils::LoadString(buf, author))
return false;
if (!CSerializeUtils::LoadNumber(buf, value))
return false;
date = value;
if (!CSerializeUtils::LoadString(buf, message))
return false;
m_changedPaths.clear();
if (!CSerializeUtils::LoadNumber(buf, value))
return false;
if (CSerializeUtils::SerializeType_Map == value)
{
if (CSerializeUtils::LoadNumber(buf, value))
{
for (unsigned __int64 i=0; i<value; ++i)
{
wstring key;
SVNLogChangedPaths cpaths;
if (!CSerializeUtils::LoadString(buf, key))
return false;
if (!cpaths.Load(buf))
return false;
m_changedPaths[key] = cpaths;
}
return true;
}
}
return false;
}
};
class SCCS
{
public:
SCCS(void);
~SCCS(void);
virtual void SetAuthInfo(const std::wstring& username, const std::wstring& password) = 0;
virtual bool Cat(std::wstring sUrl, std::wstring sFile) = 0;
/**
* returns the info for the \a path.
* \param path a path or an url
* \param pegrev the peg revision to use
* \param revision the revision to get the info for
* \param recurse if TRUE, then GetNextFileInfo() returns the info also
* for all children of \a path.
*/
virtual const SVNInfoData * GetFirstFileInfo(std::wstring path, svn_revnum_t pegrev, svn_revnum_t revision, bool recurse = false) = 0;
virtual size_t GetFileCount() = 0;
/**
* Returns the info of the next file in the file list. If no more files are in the list then NULL is returned.
* See GetFirstFileInfo() for details.
*/
virtual const SVNInfoData * GetNextFileInfo() = 0;
virtual svn_revnum_t GetHEADRevision(const std::wstring& repo, const std::wstring& url) = 0;
virtual bool GetLog(const std::wstring& repo, const std::wstring& url, svn_revnum_t startrev, svn_revnum_t endrev) = 0;
virtual bool Diff(const wstring& url1, svn_revnum_t pegrevision, svn_revnum_t revision1,
svn_revnum_t revision2, bool ignoreancestry, bool nodiffdeleted,
bool ignorecontenttype, const wstring& options, bool bAppend,
const wstring& outputfile, const wstring& errorfile) = 0;
virtual wstring CanonicalizeURL(const wstring& url) = 0;
virtual wstring GetLastErrorMsg() = 0;
/**
* Sets and clears the progress info which is shown during lengthy operations.
* \param pProgressDlg the CProgressDlg object to show the progress info on.
* \param bShowProgressBar set to true if the progress bar should be shown. Only makes
* sense if the total amount of the progress is known beforehand. Otherwise the
* progressbar is always "empty".
*/
virtual void SetAndClearProgressInfo(CProgressDlg * pProgressDlg, bool bShowProgressBar = false) = 0;
struct SVNProgress
{
apr_off_t progress; ///< operation progress
apr_off_t total; ///< operation progress
apr_off_t overall_total; ///< total bytes transferred, use SetAndClearProgressInfo() to reset this
apr_off_t BytesPerSecond; ///< Speed in bytes per second
wstring SpeedString; ///< String for speed. Either "xxx Bytes/s" or "xxx kBytes/s"
};
bool m_bCanceled;
svn_error_t * Err; ///< Global error object struct
map<svn_revnum_t,SVNLogEntry> m_logs; ///< contains the gathered log information
};
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.