[core] fix OSError while focusing on removed file (closes #87839)

authorAlain Leufroy <alain.leufroy@logilab.fr>
changeset60ae286afdf4
branchstable
phasepublic
hiddenno
parent revision#133acb2b057d [curses] disable lazy import (from Hg) for urwid (closes #87901)
child revision#451bb3d322d1 [mq] fix ``ev/null`` file entry appearing with removed files on unapplied patches (closes #89335)
files modified by this revision
hgviewlib/hggraph.py
# HG changeset patch
# User Alain Leufroy <alain.leufroy@logilab.fr>
# Date 1327566266 -3600
# Thu Jan 26 09:24:26 2012 +0100
# Branch stable
# Node ID 60ae286afdf4aafb4ef1e4930d9dbeac3fffc6b9
# Parent 133acb2b057da40b926681eb4a2389a8d087aa67
[core] fix OSError while focusing on removed file (closes #87839)

diff --git a/hgviewlib/hggraph.py b/hgviewlib/hggraph.py
@@ -462,12 +462,12 @@
1          ctx = self.repo.changectx(rev)
2          filesize = 0
3          try:
4              fctx = ctx.filectx(filename)
5              filesize = fctx.size() # compute size here to lookup data securely
6 -        except LookupError:
7 -            fctx = None # may happen for renamed files or mq patch ?
8 +        except (LookupError, OSError):
9 +            fctx = None # may happen for renamed/removed files or mq patch ?
10 
11          if isbfile(filename):
12              data = "[bfile]\n"
13              if fctx:
14                  data = fctx.data()