Show More
@@ -841,35 +841,38 b' def unbundle(repo, proto, heads):' | |||
|
841 | 841 | finally: |
|
842 | 842 | fp.close() |
|
843 | 843 | os.unlink(tempname) |
|
844 | except error.BundleValueError, exc: | |
|
845 | bundler = bundle2.bundle20(repo.ui) | |
|
844 | ||
|
845 | except (error.BundleValueError, util.Abort, error.PushRaced), exc: | |
|
846 | # handle non-bundle2 case first | |
|
847 | if not getattr(exc, 'duringunbundle2', False): | |
|
848 | try: | |
|
849 | raise | |
|
850 | except util.Abort: | |
|
851 | # The old code we moved used sys.stderr directly. | |
|
852 | # We did not change it to minimise code change. | |
|
853 | # This need to be moved to something proper. | |
|
854 | # Feel free to do it. | |
|
855 | sys.stderr.write("abort: %s\n" % exc) | |
|
856 | return pushres(0) | |
|
857 | except error.PushRaced: | |
|
858 | return pusherr(str(exc)) | |
|
859 | ||
|
860 | bundler = bundle2.bundle20(repo.ui) | |
|
861 | try: | |
|
862 | raise | |
|
863 | except error.BundleValueError, exc: | |
|
846 | 864 | errpart = bundler.newpart('error:unsupportedcontent') |
|
847 | 865 | if exc.parttype is not None: |
|
848 | 866 | errpart.addparam('parttype', exc.parttype) |
|
849 | 867 | if exc.params: |
|
850 | 868 | errpart.addparam('params', '\0'.join(exc.params)) |
|
851 | return streamres(bundler.getchunks()) | |
|
852 | except util.Abort, inst: | |
|
853 | # The old code we moved used sys.stderr directly. | |
|
854 | # We did not change it to minimise code change. | |
|
855 | # This need to be moved to something proper. | |
|
856 | # Feel free to do it. | |
|
857 | if getattr(inst, 'duringunbundle2', False): | |
|
858 | bundler = bundle2.bundle20(repo.ui) | |
|
859 | manargs = [('message', str(inst))] | |
|
869 | except util.Abort, exc: | |
|
870 | manargs = [('message', str(exc))] | |
|
860 | 871 | advargs = [] |
|
861 |
if |
|
|
862 |
advargs.append(('hint', |
|
|
872 | if exc.hint is not None: | |
|
873 | advargs.append(('hint', exc.hint)) | |
|
863 | 874 | bundler.addpart(bundle2.bundlepart('error:abort', |
|
864 | 875 | manargs, advargs)) |
|
865 | return streamres(bundler.getchunks()) | |
|
866 | else: | |
|
867 | sys.stderr.write("abort: %s\n" % inst) | |
|
868 | return pushres(0) | |
|
869 | except error.PushRaced, exc: | |
|
870 | if getattr(exc, 'duringunbundle2', False): | |
|
871 | bundler = bundle2.bundle20(repo.ui) | |
|
876 | except error.PushRaced, exc: | |
|
872 | 877 | bundler.newpart('error:pushraced', [('message', str(exc))]) |
|
873 |
|
|
|
874 | else: | |
|
875 | return pusherr(str(exc)) | |
|
878 | return streamres(bundler.getchunks()) |
General Comments 0
You need to be logged in to leave comments.
Login now