##// END OF EJS Templates
commands: report http exceptions nicely...
mpm@selenic.com -
r395:fbe88349 default
parent child Browse files
Show More
@@ -0,0 +1,34 b''
1 #!/bin/bash
2
3 mkdir copy
4 cd copy
5 hg init http://localhost:20059/
6 hg verify
7 hg co
8 cat foo
9 hg manifest
10
11 cat > dumb.py <<EOF
12 import BaseHTTPServer, SimpleHTTPServer, signal
13
14 def run(server_class=BaseHTTPServer.HTTPServer,
15 handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
16 server_address = ('localhost', 20059)
17 httpd = server_class(server_address, handler_class)
18 httpd.serve_forever()
19
20 signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
21 run()
22 EOF
23
24 python dumb.py 2>/dev/null &
25
26 mkdir copy2
27 cd copy2
28 hg init http://localhost:20059/foo
29 hg verify
30 hg co
31 cat foo
32 hg manifest
33
34 kill %1
@@ -0,0 +1,22 b''
1 requesting all changes
2 adding changesets
3 abort: error 111: Connection refused
4 transaction abort!
5 rollback completed
6 checking changesets
7 checking manifests
8 crosschecking files in changesets and manifests
9 checking files
10 0 files, 0 changesets, 0 total revisions
11 cat: foo: No such file or directory
12 requesting all changes
13 adding changesets
14 abort: HTTP Error 404: File not found
15 transaction abort!
16 rollback completed
17 checking changesets
18 checking manifests
19 crosschecking files in changesets and manifests
20 checking files
21 0 files, 0 changesets, 0 total revisions
22 cat: foo: No such file or directory
@@ -752,7 +752,11 b' def dispatch(args):'
752 752 except KeyboardInterrupt:
753 753 u.warn("interrupted!\n")
754 754 except IOError, inst:
755 if inst.errno == errno.EPIPE:
755 if hasattr(inst, "code"):
756 u.warn("abort: %s\n" % inst)
757 elif hasattr(inst, "reason"):
758 u.warn("abort: error %d: %s\n" % (inst.reason[0], inst.reason[1]))
759 elif hasattr(inst, "args") and inst[0] == errno.EPIPE:
756 760 u.warn("broken pipe\n")
757 761 else:
758 762 raise
General Comments 0
You need to be logged in to leave comments. Login now