Mercurial > hg-stable
comparison contrib/synthrepo.py @ 26587:56b2bcea2529
error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.
For great justice.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 08 Oct 2015 12:55:45 -0700 |
parents | 328739ea70c3 |
children | 62250a48dc7f |
comparison
equal
deleted
inserted
replaced
26586:d51c658d3f04 | 26587:56b2bcea2529 |
---|---|
35 - Executability of files | 35 - Executability of files |
36 - Symlinks and binary files are ignored | 36 - Symlinks and binary files are ignored |
37 ''' | 37 ''' |
38 | 38 |
39 import bisect, collections, itertools, json, os, random, time, sys | 39 import bisect, collections, itertools, json, os, random, time, sys |
40 from mercurial import cmdutil, context, patch, scmutil, util, hg | 40 from mercurial import cmdutil, context, patch, scmutil, util, hg, error |
41 from mercurial.i18n import _ | 41 from mercurial.i18n import _ |
42 from mercurial.node import nullrev, nullid, short | 42 from mercurial.node import nullrev, nullid, short |
43 | 43 |
44 # Note for extension authors: ONLY specify testedwith = 'internal' for | 44 # Note for extension authors: ONLY specify testedwith = 'internal' for |
45 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | 45 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
252 path to an alternate dictionary to use. | 252 path to an alternate dictionary to use. |
253 ''' | 253 ''' |
254 try: | 254 try: |
255 fp = hg.openpath(ui, descpath) | 255 fp = hg.openpath(ui, descpath) |
256 except Exception as err: | 256 except Exception as err: |
257 raise util.Abort('%s: %s' % (descpath, err[0].strerror)) | 257 raise error.Abort('%s: %s' % (descpath, err[0].strerror)) |
258 desc = json.load(fp) | 258 desc = json.load(fp) |
259 fp.close() | 259 fp.close() |
260 | 260 |
261 def cdf(l): | 261 def cdf(l): |
262 if not l: | 262 if not l: |
284 | 284 |
285 dictfile = opts.get('dict') or '/usr/share/dict/words' | 285 dictfile = opts.get('dict') or '/usr/share/dict/words' |
286 try: | 286 try: |
287 fp = open(dictfile, 'rU') | 287 fp = open(dictfile, 'rU') |
288 except IOError as err: | 288 except IOError as err: |
289 raise util.Abort('%s: %s' % (dictfile, err.strerror)) | 289 raise error.Abort('%s: %s' % (dictfile, err.strerror)) |
290 words = fp.read().splitlines() | 290 words = fp.read().splitlines() |
291 fp.close() | 291 fp.close() |
292 | 292 |
293 initdirs = {} | 293 initdirs = {} |
294 if desc['initdirs']: | 294 if desc['initdirs']: |