CernVM-FS
2.13.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
repository_tags.cc
Go to the documentation of this file.
1
6
#include <vector>
7
8
#include "
history_sqlite.h
"
9
#include "
publish/except.h
"
10
#include "
publish/repository.h
"
11
#include "
sanitizer.h
"
12
13
namespace
publish {
14
15
void
Publisher::CheckTagName
(
const
std::string &name) {
16
if
(name.empty())
17
throw
EPublish
(
"the empty string is not a valid tag name"
);
18
if
(name ==
"trunk"
)
19
throw
EPublish
(
"'trunk' is not allowed as a custom tag name"
);
20
if
(name ==
"trunk-previous"
)
21
throw
EPublish
(
"'trunk-previous' is not allowed as a custom tag name"
);
22
if
(!
sanitizer::TagSanitizer
().IsValid(name))
23
throw
EPublish
(
"invalid tag name: "
+ name);
24
}
25
26
27
void
Publisher::EditTags
(
const
std::vector<history::History::Tag> &add_tags,
28
const
std::vector<std::string> &rm_tags) {
29
if
(!
in_transaction_
.
IsSet
())
30
throw
EPublish
(
"cannot edit tags outside transaction"
);
31
32
for
(
unsigned
i = 0; i < add_tags.size(); ++i) {
33
const
std::string name = add_tags[i].name;
34
CheckTagName
(name);
35
history_
->
Insert
(add_tags[i]);
36
}
37
38
for
(
unsigned
i = 0; i < rm_tags.size(); ++i) {
39
const
std::string name = rm_tags[i];
40
CheckTagName
(name);
41
if
(
history_
->
Exists
(name)) {
42
const
bool
retval =
history_
->
Remove
(name);
43
if
(!retval)
44
throw
EPublish
(
"cannot remove tag "
+ name);
45
}
46
}
47
48
PushHistory
();
49
50
// TODO(jblomer): virtual catalog
51
}
52
53
}
// namespace publish
except.h
publish::ServerFlagFile::IsSet
bool IsSet() const
Definition:
repository_util.cc:110
sanitizer::TagSanitizer
Definition:
sanitizer.h:94
history::SqliteHistory::Remove
bool Remove(const std::string &name)
Definition:
history_sqlite.cc:179
history::SqliteHistory::Exists
bool Exists(const std::string &name) const
Definition:
history_sqlite.cc:193
publish::EPublish
Definition:
except.h:13
publish::PushHistory
void PushHistory()
Definition:
repository.cc:366
repository.h
history::SqliteHistory::Insert
bool Insert(const Tag &tag)
Definition:
history_sqlite.cc:170
publish::EditTags
void EditTags(const std::vector< history::History::Tag > &add_tags, const std::vector< std::string > &rm_tags)
Definition:
repository_tags.cc:27
publish::history_
history::SqliteHistory * history_
Definition:
repository.h:148
publish::in_transaction_
ServerFlagFile in_transaction_
Definition:
repository.h:369
sanitizer.h
history_sqlite.h
publish::CheckTagName
void CheckTagName(const std::string &name)
Definition:
repository_tags.cc:15
cvmfs
cvmfs
publish
repository_tags.cc
Generated on Sun Jun 15 2025 02:21:13 for CernVM-FS by
1.8.5