660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
|
// Load the stash
stashMap.clear();
res.clear();
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(':');
// When no colon we have no stash to process
if(colon==-1)
break;
QString id = l.left(colon);
// Parse stash name
++line_it;
// Invalid stash, exit
if(line_it==res.end())
break;
QString name = (*line_it);
name = name.trimmed();
stashMap.insert(name, id);
}
// Update the file item model
updateDirView();
updateFileView();
|
>
>
>
|
|
<
|
|
|
>
|
>
>
|
>
>
>
|
|
|
|
>
>
>
|
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
|
// Load the stash
stashMap.clear();
res.clear();
if(!runFossil(QStringList() << "stash" << "ls", &res, RUNGLAGS_SILENT_ALL))
return;
// 19: [5c46757d4b9765] on 2012-04-22 04:41:15
QRegExp stash_rx("\\s*(\\d+):\\s+\\[(.*)\\] on (\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)", Qt::CaseInsensitive);
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 = stash_rx.cap(1);
// Parse stash name
++line_it;
line = *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);
}
// Update the file item model
updateDirView();
updateFileView();
|