Mercurial > hg > easyhg
comparison grapher.cpp @ 139:e8a481789607
* Avoid unnecessary duplicate layout; fix off-by-one in resetting changeset children
author | Chris Cannam |
---|---|
date | Tue, 30 Nov 2010 14:27:34 +0000 |
parents | c3e8342d2de9 |
children | e6c6b88d19b9 |
comparison
equal
deleted
inserted
replaced
138:a7dbc8e5b69d | 139:e8a481789607 |
---|---|
194 // look for merging children and children distant from us but in a | 194 // look for merging children and children distant from us but in a |
195 // straight line, and make sure nobody is going to overwrite their | 195 // straight line, and make sure nobody is going to overwrite their |
196 // connection lines | 196 // connection lines |
197 | 197 |
198 foreach (QString childId, cs->children()) { | 198 foreach (QString childId, cs->children()) { |
199 DEBUG << "reserving connection line space" << endl; | |
199 if (!m_changesets.contains(childId)) continue; | 200 if (!m_changesets.contains(childId)) continue; |
200 Changeset *child = m_changesets[childId]; | 201 Changeset *child = m_changesets[childId]; |
201 int childRow = m_items[childId]->row(); | 202 int childRow = m_items[childId]->row(); |
202 if (child->parents().size() > 1 || | 203 if (child->parents().size() > 1 || |
203 child->branch() == cs->branch()) { | 204 child->branch() == cs->branch()) { |
209 | 210 |
210 // look for the case where exactly two children have the same | 211 // look for the case where exactly two children have the same |
211 // branch as us: split them to a little either side of our position | 212 // branch as us: split them to a little either side of our position |
212 | 213 |
213 if (nchildren > 1) { | 214 if (nchildren > 1) { |
214 | |
215 QList<QString> special; | 215 QList<QString> special; |
216 foreach (QString childId, cs->children()) { | 216 foreach (QString childId, cs->children()) { |
217 if (!m_changesets.contains(childId)) continue; | 217 if (!m_changesets.contains(childId)) continue; |
218 Changeset *child = m_changesets[childId]; | 218 Changeset *child = m_changesets[childId]; |
219 if (child->branch() == branch && | 219 if (child->branch() == branch && |
220 child->parents().size() == 1) { | 220 child->parents().size() == 1) { |
221 special.push_back(childId); | 221 special.push_back(childId); |
222 } | 222 } |
223 } | 223 } |
224 if (special.size() == 2) { | 224 if (special.size() == 2) { |
225 DEBUG << "handling split-in-two for children " << special[0] << " and " << special[1] << endl; | |
225 for (int i = 0; i < 2; ++i) { | 226 for (int i = 0; i < 2; ++i) { |
226 int off = i * 2 - 1; // 0 -> -1, 1 -> 1 | 227 int off = i * 2 - 1; // 0 -> -1, 1 -> 1 |
227 ChangesetItem *it = m_items[special[i]]; | 228 ChangesetItem *it = m_items[special[i]]; |
228 it->setColumn(findAvailableColumn(it->row(), col + off, true)); | 229 it->setColumn(findAvailableColumn(it->row(), col + off, true)); |
229 for (int r = row-1; r >= it->row(); --r) { | 230 for (int r = row-1; r >= it->row(); --r) { |
322 m_changesets.clear(); | 323 m_changesets.clear(); |
323 m_items.clear(); | 324 m_items.clear(); |
324 m_alloc.clear(); | 325 m_alloc.clear(); |
325 m_branchHomes.clear(); | 326 m_branchHomes.clear(); |
326 | 327 |
328 DEBUG << "Grapher::layout: Have " << csets.size() << " changesets" << endl; | |
329 | |
327 if (csets.empty()) return; | 330 if (csets.empty()) return; |
328 | 331 |
329 foreach (Changeset *cs, csets) { | 332 foreach (Changeset *cs, csets) { |
330 | 333 |
331 QString id = cs->id(); | 334 QString id = cs->id(); |
332 DEBUG << id.toStdString() << endl; | 335 // DEBUG << id.toStdString() << endl; |
333 | 336 |
334 if (id == "") { | 337 if (id == "") { |
335 throw LayoutException("Changeset has no ID"); | 338 throw LayoutException("Changeset has no ID"); |
336 } | 339 } |
337 if (m_changesets.contains(id)) { | 340 if (m_changesets.contains(id)) { |