Mercurial > hgrepos > DevTools > mercurial-extensions
diff read_revinfo.py @ 6:538c8f20ed51
Make compatible to older Python versions: don't use "with:" construct
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Fri, 14 Aug 2015 15:16:57 +0200 |
| parents | 3e0f25b30aaa |
| children | 8af25826bca3 |
line wrap: on
line diff
--- a/read_revinfo.py Fri Aug 14 15:14:58 2015 +0200 +++ b/read_revinfo.py Fri Aug 14 15:16:57 2015 +0200 @@ -17,8 +17,11 @@ """ try: - with open(filename, "rt") as f: + f = open(filename, "rt") + try: return dict([[i.strip() for i in line.split(":", 1)] for line in f]) + finally: + f.close() except EnvironmentError: return None
