comparison mercurial/bookmarks.py @ 16573:5983de86462c stable 2.2.1

bookmarks: catch the proper exception for missing revisions This fixes a regression from 1.7
author Matt Mackall <mpm@selenic.com>
date Thu, 03 May 2012 16:03:08 -0500
parents 6b16ded5c810
children c285aae10f6c
comparison
equal deleted inserted replaced
16572:8d44b5a2974f 16573:5983de86462c
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from mercurial.i18n import _ 8 from mercurial.i18n import _
9 from mercurial.node import hex 9 from mercurial.node import hex
10 from mercurial import encoding, error, util 10 from mercurial import encoding, util
11 import errno, os 11 import errno, os
12 12
13 def valid(mark): 13 def valid(mark):
14 for c in (':', '\0', '\n', '\r'): 14 for c in (':', '\0', '\n', '\r'):
15 if c in mark: 15 if c in mark:
34 continue 34 continue
35 sha, refspec = line.split(' ', 1) 35 sha, refspec = line.split(' ', 1)
36 refspec = encoding.tolocal(refspec) 36 refspec = encoding.tolocal(refspec)
37 try: 37 try:
38 bookmarks[refspec] = repo.changelog.lookup(sha) 38 bookmarks[refspec] = repo.changelog.lookup(sha)
39 except error.RepoLookupError: 39 except LookupError:
40 pass 40 pass
41 except IOError, inst: 41 except IOError, inst:
42 if inst.errno != errno.ENOENT: 42 if inst.errno != errno.ENOENT:
43 raise 43 raise
44 return bookmarks 44 return bookmarks