Mercurial > hg
comparison mercurial/wireproto.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 | fb743268510e |
children | 3e7f675628ad |
comparison
equal
deleted
inserted
replaced
26586:d51c658d3f04 | 26587:56b2bcea2529 |
---|---|
688 proto.redirect() | 688 proto.redirect() |
689 | 689 |
690 try: | 690 try: |
691 r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), | 691 r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), |
692 encoding.tolocal(old), new) or False | 692 encoding.tolocal(old), new) or False |
693 except util.Abort: | 693 except error.Abort: |
694 r = False | 694 r = False |
695 | 695 |
696 output = proto.restore() | 696 output = proto.restore() |
697 | 697 |
698 return '%s\n%s' % (int(r), output) | 698 return '%s\n%s' % (int(r), output) |
750 | 750 |
751 finally: | 751 finally: |
752 fp.close() | 752 fp.close() |
753 os.unlink(tempname) | 753 os.unlink(tempname) |
754 | 754 |
755 except (error.BundleValueError, util.Abort, error.PushRaced) as exc: | 755 except (error.BundleValueError, error.Abort, error.PushRaced) as exc: |
756 # handle non-bundle2 case first | 756 # handle non-bundle2 case first |
757 if not getattr(exc, 'duringunbundle2', False): | 757 if not getattr(exc, 'duringunbundle2', False): |
758 try: | 758 try: |
759 raise | 759 raise |
760 except util.Abort: | 760 except error.Abort: |
761 # The old code we moved used sys.stderr directly. | 761 # The old code we moved used sys.stderr directly. |
762 # We did not change it to minimise code change. | 762 # We did not change it to minimise code change. |
763 # This need to be moved to something proper. | 763 # This need to be moved to something proper. |
764 # Feel free to do it. | 764 # Feel free to do it. |
765 sys.stderr.write("abort: %s\n" % exc) | 765 sys.stderr.write("abort: %s\n" % exc) |
796 errpart = bundler.newpart('error:unsupportedcontent') | 796 errpart = bundler.newpart('error:unsupportedcontent') |
797 if exc.parttype is not None: | 797 if exc.parttype is not None: |
798 errpart.addparam('parttype', exc.parttype) | 798 errpart.addparam('parttype', exc.parttype) |
799 if exc.params: | 799 if exc.params: |
800 errpart.addparam('params', '\0'.join(exc.params)) | 800 errpart.addparam('params', '\0'.join(exc.params)) |
801 except util.Abort as exc: | 801 except error.Abort as exc: |
802 manargs = [('message', str(exc))] | 802 manargs = [('message', str(exc))] |
803 advargs = [] | 803 advargs = [] |
804 if exc.hint is not None: | 804 if exc.hint is not None: |
805 advargs.append(('hint', exc.hint)) | 805 advargs.append(('hint', exc.hint)) |
806 bundler.addpart(bundle2.bundlepart('error:abort', | 806 bundler.addpart(bundle2.bundlepart('error:abort', |