@@ -32,6 +32,15 @@ static const mark_t maxMark = ULONG_MAX;
32
32
class FastImportRepository : public Repository
33
33
{
34
34
public:
35
+ struct AnnotatedTag
36
+ {
37
+ QString supportingRef;
38
+ QByteArray svnprefix;
39
+ QByteArray author;
40
+ QByteArray log;
41
+ uint dt;
42
+ int revnum;
43
+ };
35
44
class Transaction : public Repository ::Transaction
36
45
{
37
46
Q_DISABLE_COPY (Transaction)
@@ -69,6 +78,7 @@ class FastImportRepository : public Repository
69
78
};
70
79
FastImportRepository (const Rules::Repository &rule);
71
80
int setupIncremental (int &cutoff);
81
+ void restoreAnnotatedTags ();
72
82
void restoreLog ();
73
83
~FastImportRepository ();
74
84
@@ -100,15 +110,6 @@ class FastImportRepository : public Repository
100
110
QVector<int > marks;
101
111
QByteArray note;
102
112
};
103
- struct AnnotatedTag
104
- {
105
- QString supportingRef;
106
- QByteArray svnprefix;
107
- QByteArray author;
108
- QByteArray log;
109
- uint dt;
110
- int revnum;
111
- };
112
113
113
114
QHash<QString, Branch> branches;
114
115
QHash<QString, AnnotatedTag> annotatedTags;
@@ -183,6 +184,7 @@ class ForwardingRepository : public Repository
183
184
ForwardingRepository (const QString &n, Repository *r, const QString &p) : name(n), repo(r), prefix(p) {}
184
185
185
186
int setupIncremental (int &) { return 1 ; }
187
+ void restoreAnnotatedTags () {}
186
188
void restoreLog () {}
187
189
188
190
void reloadBranches () { return repo->reloadBranches (); }
@@ -248,6 +250,33 @@ class ProcessCache: QLinkedList<FastImportRepository *>
248
250
};
249
251
static ProcessCache processCache;
250
252
253
+ QDataStream &operator <<(QDataStream &out, const FastImportRepository::AnnotatedTag &annotatedTag)
254
+ {
255
+ out << annotatedTag.supportingRef
256
+ << annotatedTag.svnprefix
257
+ << annotatedTag.author
258
+ << annotatedTag.log
259
+ << (quint64) annotatedTag.dt
260
+ << (qint64) annotatedTag.revnum ;
261
+ return out;
262
+ }
263
+
264
+ QDataStream &operator >>(QDataStream &in, FastImportRepository::AnnotatedTag &annotatedTag)
265
+ {
266
+ quint64 dt;
267
+ qint64 revnum;
268
+
269
+ in >> annotatedTag.supportingRef
270
+ >> annotatedTag.svnprefix
271
+ >> annotatedTag.author
272
+ >> annotatedTag.log
273
+ >> dt
274
+ >> revnum;
275
+ annotatedTag.dt = (uint ) dt;
276
+ annotatedTag.revnum = (int ) revnum;
277
+ return in;
278
+ }
279
+
251
280
Repository *createRepository (const Rules::Repository &rule, const QHash<QString, Repository *> &repositories)
252
281
{
253
282
if (rule.forwardTo .isEmpty ())
@@ -267,6 +296,13 @@ static QString marksFileName(QString name)
267
296
return name;
268
297
}
269
298
299
+ static QString annotatedTagsFileName (QString name)
300
+ {
301
+ name.replace (' /' , ' _' );
302
+ name.prepend (" annotatedTags-" );
303
+ return name;
304
+ }
305
+
270
306
FastImportRepository::FastImportRepository (const Rules::Repository &rule)
271
307
: name(rule.name), prefix(rule.forwardTo), fastImport(name), commitCount(0 ), outstandingTransactions(0 ),
272
308
last_commit_mark(0 ), next_file_mark(maxMark - 1 ), processHasStarted(false )
@@ -451,6 +487,17 @@ int FastImportRepository::setupIncremental(int &cutoff)
451
487
return cutoff;
452
488
}
453
489
490
+ void FastImportRepository::restoreAnnotatedTags ()
491
+ {
492
+ QFile annotatedTagsFile (name + " /" + annotatedTagsFileName (name));
493
+ if (!annotatedTagsFile.exists ())
494
+ return ;
495
+ annotatedTagsFile.open (QIODevice::ReadOnly);
496
+ QDataStream annotatedTagsStream (&annotatedTagsFile);
497
+ annotatedTagsStream >> annotatedTags;
498
+ annotatedTagsFile.close ();
499
+ }
500
+
454
501
void FastImportRepository::restoreLog ()
455
502
{
456
503
QString file = logFileName (name);
@@ -710,7 +757,13 @@ void FastImportRepository::finalizeTags()
710
757
if (annotatedTags.isEmpty ())
711
758
return ;
712
759
713
- printf (" Finalising tags for %s..." , qPrintable (name));
760
+ QFile annotatedTagsFile (name + " /" + annotatedTagsFileName (name));
761
+ annotatedTagsFile.open (QIODevice::WriteOnly);
762
+ QDataStream annotatedTagsStream (&annotatedTagsFile);
763
+ annotatedTagsStream << annotatedTags;
764
+ annotatedTagsFile.close ();
765
+
766
+ printf (" Finalising annotated tags for %s..." , qPrintable (name));
714
767
startFastImport ();
715
768
716
769
QHash<QString, AnnotatedTag>::ConstIterator it = annotatedTags.constBegin ();
0 commit comments