Mercurial > hg > easyhg
changeset 305:7708149d252a
Avoid exception when incremental log is called for in a situation where the heads have not actually been determined yet -- we could end up adding all existing history as an incremental update and getting a duplicate changeset error
author | Chris Cannam |
---|---|
date | Sat, 26 Feb 2011 23:04:05 +0000 |
parents | bb4702918ba6 |
children | b280a2dc0512 978b8c03118a |
files | historywidget.cpp mainwindow.cpp |
diffstat | 2 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/historywidget.cpp Tue Feb 22 15:55:13 2011 +0000 +++ b/historywidget.cpp Sat Feb 26 23:04:05 2011 +0000 @@ -141,7 +141,8 @@ m_newIds.insert(cs->id()); } - DEBUG << "addChangesets: " << csets.size() << " new changesets" << endl; + DEBUG << "addChangesets: " << csets.size() << " new changesets have (" + << m_changesets.size() << " already)" << endl; csets << m_changesets; m_changesets = csets;
--- a/mainwindow.cpp Tue Feb 22 15:55:13 2011 +0000 +++ b/mainwindow.cpp Sat Feb 26 23:04:05 2011 +0000 @@ -325,6 +325,16 @@ void MainWindow::hgLogIncremental(QStringList prune) { + // Sometimes we can be called with prune empty -- it represents + // the current heads, but if we have none already and for some + // reason are being prompted for an incremental update, we may run + // into trouble. In that case, make this a full log instead + + if (prune.empty()) { + hgLog(); + return; + } + QStringList params; params << "log"; @@ -906,6 +916,7 @@ void MainWindow::clearState() { + DEBUG << "MainWindow::clearState" << endl; foreach (Changeset *cs, m_currentParents) delete cs; m_currentParents.clear(); foreach (Changeset *cs, m_currentHeads) delete cs; @@ -1905,6 +1916,8 @@ QStringList newHeadIds = Changeset::getIds(newHeads); if (oldHeadIds != newHeadIds) { DEBUG << "Heads changed, will prompt an incremental log if appropriate" << endl; + DEBUG << "Old heads: " << oldHeadIds.join(",") << endl; + DEBUG << "New heads: " << newHeadIds.join(",") << endl; headsChanged = true; foreach (Changeset *cs, m_currentHeads) delete cs; m_currentHeads = newHeads;