Re: [PATCH QGit RFC] Fix "Save patch..." on a commit range
Marco Costalba, 15.06.2009:
> So you could check, in ListView::getSelectedItems() how the rows are returned.
I added this snippet:
-->8--
diff --git a/src/listview.cpp b/src/listview.cpp
index b2f4915..5bd1ee6 100644
--- a/src/listview.cpp
+++ b/src/listview.cpp
@@ -171,10 +171,12 @@ void ListView::showIdValues() {
viewport()->update();
}
+#include <QtDebug>
void ListView::getSelectedItems(QStringList& selectedItems) {
selectedItems.clear();
QModelIndexList ml = selectionModel()->selectedRows();
+ qDebug() << ml;
FOREACH (QModelIndexList, it, ml)
selectedItems.append(sha((*it).row()));
}
--8<--
and got the following for the 4 commits around v1.6.3 in git.git when
enabled "All branches" (output prettified, was one line):
(QModelIndex(2554,0,0x0,FileHistory(0xa06bfe8) ) ,
QModelIndex(2553,0,0x0,FileHistory(0xa06bfe8) ) ,
QModelIndex(2552,0,0x0,FileHistory(0xa06bfe8) ) ,
QModelIndex(2551,0,0x0,FileHistory(0xa06bfe8) ) )
Here it is ordered from oldest to newest. The newest commit (HEAD or
working tree) has '0'.
The same with "All branches" unchecked, just a bit smaller values:
(QModelIndex(404,0,0x0,FileHistory(0xa06bfe8) ) ,
QModelIndex(403,0,0x0,FileHistory(0xa06bfe8) ) ,
QModelIndex(402,0,0x0,FileHistory(0xa06bfe8) ) ,
QModelIndex(401,0,0x0,FileHistory(0xa06bfe8) ) )
But try with selecting many commits, for example v1.6.3..origin/master
(fewer are sufficient). The order has a pattern, but it's not sorted at
all.
Or selecting only two commits v1.6.3 and origin/master prints this for
me, ordered from newest to oldest this time:
(QModelIndex(16,0,0x0,FileHistory(0xa06bfe8) ) ,
QModelIndex(401,0,0x0,FileHistory(0xa06bfe8) ) )