Mercurial > hg > easyhg
comparison mainwindow.cpp @ 225:05255f23f2af
* Properly handle the case where the working copy is empty but the repo is not (e.g. just after convert)
author | Chris Cannam |
---|---|
date | Thu, 06 Jan 2011 11:52:23 +0000 |
parents | 90e70a9024f3 |
children | 5d8a5ce96163 |
comparison
equal
deleted
inserted
replaced
220:5498774b34c8 | 225:05255f23f2af |
---|---|
179 "<h4>License</h4>" | 179 "<h4>License</h4>" |
180 "<p>This program is free software; you can redistribute it and/or " | 180 "<p>This program is free software; you can redistribute it and/or " |
181 "modify it under the terms of the GNU General Public License as " | 181 "modify it under the terms of the GNU General Public License as " |
182 "published by the Free Software Foundation; either version 2 of the " | 182 "published by the Free Software Foundation; either version 2 of the " |
183 "License, or (at your option) any later version. See the file " | 183 "License, or (at your option) any later version. See the file " |
184 "COPYING included with this distribution for more information.</p>")); | 184 "COPYING included with this distribution for more information.</p>" |
185 )); | |
185 } | 186 } |
186 | 187 |
187 void MainWindow::clearSelections() | 188 void MainWindow::clearSelections() |
188 { | 189 { |
189 hgTabs->clearSelections(); | 190 hgTabs->clearSelections(); |
2021 | 2022 |
2022 bool canMerge = false; | 2023 bool canMerge = false; |
2023 bool canUpdate = false; | 2024 bool canUpdate = false; |
2024 bool haveMerge = false; | 2025 bool haveMerge = false; |
2025 bool emptyRepo = false; | 2026 bool emptyRepo = false; |
2027 bool noWorkingCopy = false; | |
2026 int currentBranchHeads = 0; | 2028 int currentBranchHeads = 0; |
2027 | 2029 |
2028 if (currentParents.size() == 1) { | 2030 if (currentParents.size() == 1) { |
2029 bool parentIsHead = false; | 2031 bool parentIsHead = false; |
2030 Changeset *parent = currentParents[0]; | 2032 Changeset *parent = currentParents[0]; |
2047 foreach (Changeset *h, currentHeads) { | 2049 foreach (Changeset *h, currentHeads) { |
2048 DEBUG << "head id = " << h->id() << endl; | 2050 DEBUG << "head id = " << h->id() << endl; |
2049 } | 2051 } |
2050 } | 2052 } |
2051 } else if (currentParents.size() == 0) { | 2053 } else if (currentParents.size() == 0) { |
2052 emptyRepo = true; | 2054 if (currentHeads.size() == 0) { |
2055 // No heads -> empty repo | |
2056 emptyRepo = true; | |
2057 } else { | |
2058 // Heads, but no parents -> no working copy, e.g. we have | |
2059 // just converted this repo but haven't updated in it yet. | |
2060 // Uncommon but confusing; probably merits a special case | |
2061 noWorkingCopy = true; | |
2062 canUpdate = true; | |
2063 } | |
2053 } else { | 2064 } else { |
2054 haveMerge = true; | 2065 haveMerge = true; |
2055 justMerged = true; | 2066 justMerged = true; |
2056 } | 2067 } |
2057 | 2068 |
2071 | 2082 |
2072 if (stateUnknown) { | 2083 if (stateUnknown) { |
2073 hgTabs->setState(tr("(Examining repository)")); | 2084 hgTabs->setState(tr("(Examining repository)")); |
2074 } else if (emptyRepo) { | 2085 } else if (emptyRepo) { |
2075 hgTabs->setState(tr("Nothing committed to this repository yet")); | 2086 hgTabs->setState(tr("Nothing committed to this repository yet")); |
2087 } else if (noWorkingCopy) { | |
2088 hgTabs->setState(tr("No working copy yet: consider updating")); | |
2076 } else if (canMerge) { | 2089 } else if (canMerge) { |
2077 hgTabs->setState(tr("<b>Awaiting merge</b> on %1").arg(branchText)); | 2090 hgTabs->setState(tr("<b>Awaiting merge</b> on %1").arg(branchText)); |
2078 } else if (!hgTabs->getAllUnresolvedFiles().empty()) { | 2091 } else if (!hgTabs->getAllUnresolvedFiles().empty()) { |
2079 hgTabs->setState(tr("Have unresolved files following merge on %1").arg(branchText)); | 2092 hgTabs->setState(tr("Have unresolved files following merge on %1").arg(branchText)); |
2080 } else if (haveMerge) { | 2093 } else if (haveMerge) { |