# HG changeset patch
# User Alain Leufroy <alain@leufroy.fr>
# Date 1368151820 -7200
# Fri May 10 04:10:20 2013 +0200
# Branch stable
# Node ID ff735a2a686c75d2d232ff5fc01128bd429a1950
# Parent 8aa4cdf5193952c3b91cb59b4f9fdfcc5e70d44f
[qt4] fix non displayed working directory on refreshing (closes #137714)
This bug was appearing when the model was filled and the working
directory was hidden, for exemple on filtered branch.
# User Alain Leufroy <alain@leufroy.fr>
# Date 1368151820 -7200
# Fri May 10 04:10:20 2013 +0200
# Branch stable
# Node ID ff735a2a686c75d2d232ff5fc01128bd429a1950
# Parent 8aa4cdf5193952c3b91cb59b4f9fdfcc5e70d44f
[qt4] fix non displayed working directory on refreshing (closes #137714)
This bug was appearing when the model was filled and the working
directory was hidden, for exemple on filtered branch.
@@ -384,11 +384,10 @@
1 def indexFromRev(self, rev): 2 self.ensureBuilt(rev=rev) 3 row = self.rowFromRev(rev) 4 if row is not None: 5 return self.index(row, 0) 6 - return None 7 8 class FileRevModel(HgRepoListModel): 9 """ 10 Model used to manage the list of revisions of a file, in file 11 viewer of in diff-file viewer dialogs.
@@ -434,11 +434,15 @@
12 pass 13 wc = self.repo[None] 14 idx = tv.model().index(0, 0) # Working directory or tip 15 if not wc.dirty() and wc.p1().rev() >= 0: 16 # parent of working directory is not nullrev 17 - idx = tv.model().indexFromRev(wc.p1().rev()) 18 + _idx = tv.model().indexFromRev(wc.p1().rev()) 19 + # may appears if wc has been filtered out 20 + # (for example not on the filtered branch) 21 + if _idx is not None: 22 + idx = _idx 23 tv.setCurrentIndex(idx) 24 25 def revision_activated(self, rev=None): 26 """ 27 Callback called when a revision is double-clicked in the revisions table