-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.cpp
More file actions
28 lines (26 loc) · 821 Bytes
/
Copy pathlog.cpp
File metadata and controls
28 lines (26 loc) · 821 Bytes
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
void log() {
string branch = getCurrentBranch();
string current = getBranchHead(branch);
while (current != "null") {
string path = COMMITS_DIR + "/" + current;
ifstream in(path);
string line;
cout << "Commit: " << current << endl;
while (getline(in, line)) {
if (line.rfind("message:", 0) == 0 ||
line.rfind("timestamp:", 0) == 0 ||
line.rfind("parent:", 0) == 0) {
cout << line << endl;
}
}
cout << "###################################" << endl;
in.clear();
in.seekg(0, ios::beg);
while (getline(in, line)) {
if (line.rfind("parent:", 0) == 0) {
current = line.substr(8);
break;
}
}
}
}