comparison changeset.cpp @ 128:fcaf09ee825d

* Show tags and current working copy parents in history graph
author Chris Cannam
date Mon, 29 Nov 2010 20:09:58 +0000
parents 63c2f3f61c79
children 70fe12873106
comparison
equal deleted inserted replaced
127:758471b71721 128:fcaf09ee825d
25 foreach (QString key, e.keys()) { 25 foreach (QString key, e.keys()) {
26 if (key == "parents") { 26 if (key == "parents") {
27 QStringList parents = e.value(key).split 27 QStringList parents = e.value(key).split
28 (" ", QString::SkipEmptyParts); 28 (" ", QString::SkipEmptyParts);
29 setParents(parents); 29 setParents(parents);
30 } else if (key == "tag") {
31 QStringList tags = e.value(key).split
32 (" ", QString::SkipEmptyParts);
33 setTags(tags);
30 } else if (key == "timestamp") { 34 } else if (key == "timestamp") {
31 setTimestamp(e.value(key).split(" ")[0].toULongLong()); 35 setTimestamp(e.value(key).split(" ")[0].toULongLong());
32 } else if (key == "changeset") { 36 } else if (key == "changeset") {
33 setId(e.value(key)); 37 setId(e.value(key));
34 } else { 38 } else {
37 } 41 }
38 } 42 }
39 43
40 QString Changeset::getLogTemplate() 44 QString Changeset::getLogTemplate()
41 { 45 {
42 return "id: {rev}:{node|short}\\nuser: {author}\\nbranch: {branches}\\ntag: {tag}\\ndatetime: {date|isodate}\\ntimestamp: {date|hgdate}\\nage: {date|age}\\nparents: {parents}\\ncomment: {desc|json}\\n\\n"; 46 return "id: {rev}:{node|short}\\nauthor: {author}\\nbranch: {branches}\\ntag: {tags}\\ndatetime: {date|isodate}\\ntimestamp: {date|hgdate}\\nage: {date|age}\\nparents: {parents}\\ncomment: {desc|json}\\n\\n";
43 } 47 }
44 48
45 QString Changeset::formatHtml() 49 QString Changeset::formatHtml()
46 { 50 {
47 QString description; 51 QString description;
57 c = c.replace("\\n", "<br>"); 61 c = c.replace("\\n", "<br>");
58 62
59 QStringList propNames, propTexts; 63 QStringList propNames, propTexts;
60 64
61 propNames << "id" 65 propNames << "id"
62 << "user" 66 << "author"
63 << "datetime" 67 << "datetime"
64 << "branch" 68 << "branch"
65 << "tag" 69 << "tags"
66 << "comment"; 70 << "comment";
67 71
68 propTexts << QObject::tr("Identifier") 72 propTexts << QObject::tr("Identifier")
69 << QObject::tr("Author") 73 << QObject::tr("Author")
70 << QObject::tr("Date") 74 << QObject::tr("Date")
73 << QObject::tr("Comment"); 77 << QObject::tr("Comment");
74 78
75 for (int i = 0; i < propNames.size(); ++i) { 79 for (int i = 0; i < propNames.size(); ++i) {
76 QString prop = propNames[i]; 80 QString prop = propNames[i];
77 QString value; 81 QString value;
78 if (prop == "comment") value = c; 82 if (prop == "comment") {
79 else { 83 value = c;
84 } else if (prop == "tags") {
85 value = tags().join(" ");
86 } else {
80 value = xmlEncode(property(prop.toLocal8Bit().data()).toString()); 87 value = xmlEncode(property(prop.toLocal8Bit().data()).toString());
81 } 88 }
82 if (value != "") { 89 if (value != "") {
83 description += rowTemplate 90 description += rowTemplate
84 .arg(xmlEncode(propTexts[i])) 91 .arg(xmlEncode(propTexts[i]))