Increased robustness in the stash parsing
FossilOrigin-Name: ce3816871d40d08821944aa58329baf993fcb688
This commit is contained in:
parent
ef4945494c
commit
dbaf78d164
@ -664,26 +664,37 @@ void MainWindow::scanWorkspace()
|
||||
if(!runFossil(QStringList() << "stash" << "ls", &res, RUNGLAGS_SILENT_ALL))
|
||||
return;
|
||||
|
||||
for(QStringList::iterator line_it=res.begin(); line_it!=res.end(); ++line_it)
|
||||
{
|
||||
QString l = (*line_it).trimmed();
|
||||
int colon = l.indexOf(':');
|
||||
// 19: [5c46757d4b9765] on 2012-04-22 04:41:15
|
||||
QRegExp stash_rx("\\s*(\\d+):\\s+\\[(.*)\\] on (\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)", Qt::CaseInsensitive);
|
||||
|
||||
// When no colon we have no stash to process
|
||||
if(colon==-1)
|
||||
for(QStringList::iterator line_it=res.begin(); line_it!=res.end();)
|
||||
{
|
||||
QString line = *line_it;
|
||||
|
||||
int index = stash_rx.indexIn(line);
|
||||
if(index==-1)
|
||||
break;
|
||||
|
||||
QString id = l.left(colon);
|
||||
QString id = stash_rx.cap(1);
|
||||
|
||||
// Parse stash name
|
||||
++line_it;
|
||||
line = *line_it;
|
||||
|
||||
// Invalid stash, exit
|
||||
if(line_it==res.end())
|
||||
break;
|
||||
|
||||
QString name = (*line_it);
|
||||
// Named stash
|
||||
QString name;
|
||||
// Finish at an anonymous stash or start of a new stash
|
||||
if(line_it==res.end() || stash_rx.indexIn(line)!=-1)
|
||||
{
|
||||
name = tr("Stash %1").arg(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = (*line_it);
|
||||
name = name.trimmed();
|
||||
++line_it;
|
||||
}
|
||||
|
||||
stashMap.insert(name, id);
|
||||
}
|
||||
|
||||
|
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Allow\sopening\sa\sspecific\sworkspace\spath\sfrom\sthe\scommandline\n\n
|
||||
D 2012-04-15T14:42:09.758
|
||||
C Increased\srobustness\sin\sthe\sstash\sparsing\n
|
||||
D 2012-04-22T05:57:52.133
|
||||
F CommitDialog.cpp a46020a9361151d8d286a2670257d01d8967bf69
|
||||
F CommitDialog.h f1ee8db92103164e7db55a8407ccdcff24571b72
|
||||
F CommitDialog.ui 813d7cba316e226de1a22b7e480bb969fbe9b0c4
|
||||
@ -8,7 +8,7 @@ F FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
|
||||
F FileActionDialog.ui c63644428579741aeb5fa052e237ba799ced9ad7
|
||||
F FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
||||
F FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||
F MainWindow.cpp 8d0d6d8e78210670a8fe533b1413bcbe77196ce1
|
||||
F MainWindow.cpp 865788d994bc7c132e8a2dc0ff8893bcf0230081
|
||||
F MainWindow.h 78dc49fe4500a6113ed8bbff597d5305d203a80c
|
||||
F MainWindow.ui d569997fecf4a22d61a016a4a23eea04eaad6dee
|
||||
F SettingsDialog.cpp e1fad18cc020d08b82c6d35dc94f6624deec9a3b
|
||||
@ -176,7 +176,7 @@ F installer/fuel.iss 13b6a938bcdf273cbd3649d2549887baa1577214
|
||||
F installer/license.txt 4cc77b90af91e615a64ae04893fdffa7939db84c
|
||||
F main.cpp 69c1f9e873c016ef466d20298a67c3bc4c2b2f3a
|
||||
F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53
|
||||
P 8e08f86043f0c2159037824f125e6acf2c2be007
|
||||
R 2e9aacb62b629a4e755adad517f7f50b
|
||||
P e42f476b1c07959ee224b1abbd60f811893d0717
|
||||
R f3af307696f374c7ed861ac0ac8da9ef
|
||||
U kostas
|
||||
Z 528eba2e411becfe13a36cbfcfcf8dde
|
||||
Z a39a161794cfc1b645b89f5c61f2466d
|
||||
|
@ -1 +1 @@
|
||||
e42f476b1c07959ee224b1abbd60f811893d0717
|
||||
ce3816871d40d08821944aa58329baf993fcb688
|
Loading…
x
Reference in New Issue
Block a user