comparison mercurial/phases.py @ 25660:328739ea70c3

global: mass rewrite to use modern exception syntax Python 2.6 introduced the "except type as instance" syntax, replacing the "except type, instance" syntax that came before. Python 3 dropped support for the latter syntax. Since we no longer support Python 2.4 or 2.5, we have no need to continue supporting the "except type, instance". This patch mass rewrites the exception syntax to be Python 2.6+ and Python 3 compatible. This patch was produced by running `2to3 -f except -w -n .`.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 23 Jun 2015 22:20:08 -0700
parents f0745da75056
children f14cea32e1d4
comparison
equal deleted inserted replaced
25659:d60678a567a9 25660:328739ea70c3
127 try: 127 try:
128 f = None 128 f = None
129 if 'HG_PENDING' in os.environ: 129 if 'HG_PENDING' in os.environ:
130 try: 130 try:
131 f = repo.svfs('phaseroots.pending') 131 f = repo.svfs('phaseroots.pending')
132 except IOError, inst: 132 except IOError as inst:
133 if inst.errno != errno.ENOENT: 133 if inst.errno != errno.ENOENT:
134 raise 134 raise
135 if f is None: 135 if f is None:
136 f = repo.svfs('phaseroots') 136 f = repo.svfs('phaseroots')
137 try: 137 try:
138 for line in f: 138 for line in f:
139 phase, nh = line.split() 139 phase, nh = line.split()
140 roots[int(phase)].add(bin(nh)) 140 roots[int(phase)].add(bin(nh))
141 finally: 141 finally:
142 f.close() 142 f.close()
143 except IOError, inst: 143 except IOError as inst:
144 if inst.errno != errno.ENOENT: 144 if inst.errno != errno.ENOENT:
145 raise 145 raise
146 if phasedefaults: 146 if phasedefaults:
147 for f in phasedefaults: 147 for f in phasedefaults:
148 roots = f(repo, roots) 148 roots = f(repo, roots)