##// END OF EJS Templates
dispatch: unify handling of None returned by a command function...
Yuya Nishihara -
r38015:6f9ac3cb default
parent child Browse files
Show More
@@ -256,7 +256,7 b' class server(object):'
256 256 self.cout, self.cerr)
257 257
258 258 try:
259 ret = (dispatch.dispatch(req) or 0) & 255 # might return None
259 ret = dispatch.dispatch(req) & 255
260 260 self.cresult.write(struct.pack('>i', int(ret)))
261 261 finally:
262 262 # restore old cwd
@@ -87,7 +87,7 b' def run():'
87 87 req = request(pycompat.sysargv[1:])
88 88 err = None
89 89 try:
90 status = dispatch(req) or 0
90 status = dispatch(req)
91 91 except error.StdioError as e:
92 92 err = e
93 93 status = -1
@@ -175,7 +175,7 b' def _formatargs(args):'
175 175 return ' '.join(procutil.shellquote(a) for a in args)
176 176
177 177 def dispatch(req):
178 "run the command specified in req.args"
178 """run the command specified in req.args; returns an integer status code"""
179 179 if req.ferr:
180 180 ferr = req.ferr
181 181 elif req.ui:
@@ -208,9 +208,9 b' def dispatch(req):'
208 208
209 209 msg = _formatargs(req.args)
210 210 starttime = util.timer()
211 ret = None
211 ret = -1
212 212 try:
213 ret = _runcatch(req)
213 ret = _runcatch(req) or 0
214 214 except error.ProgrammingError as inst:
215 215 req.ui.warn(_('** ProgrammingError: %s\n') % inst)
216 216 if inst.hint:
@@ -206,7 +206,7 b' log rotation'
206 206 committing changelog
207 207 updating the branch cache
208 208 committed changeset 0:0e46349438790c460c5c9f7546bfcd39b267bbd2
209 result: None
209 result: 0
210 210 running: --debug commit -m commit2 -d 2000-01-02 foo
211 211 committing files:
212 212 foo
@@ -214,7 +214,7 b' log rotation'
214 214 committing changelog
215 215 updating the branch cache
216 216 committed changeset 1:45589e459b2edfbf3dbde7e01f611d2c1e7453d7
217 result: None
217 result: 0
218 218 running: --debug log -r 0
219 219 changeset: 0:0e46349438790c460c5c9f7546bfcd39b267bbd2
220 220 phase: draft
@@ -229,7 +229,7 b' log rotation'
229 229 commit1
230 230
231 231
232 result: None
232 result: 0
233 233 running: --debug log -r tip
234 234 changeset: 1:45589e459b2edfbf3dbde7e01f611d2c1e7453d7
235 235 tag: tip
@@ -245,7 +245,7 b' log rotation'
245 245 commit2
246 246
247 247
248 result: None
248 result: 0
249 249 $ hg blackbox
250 250 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updating the branch cache
251 251 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updated served branch cache in * seconds (glob)
@@ -1,18 +1,18 b''
1 1 running: init test1
2 result: None
2 result: 0
3 3 running: add foo
4 4 result: 0
5 5 running: commit -m commit1 -d 2000-01-01 foo
6 result: None
6 result: 0
7 7 running: commit -m commit2 -d 2000-01-02 foo
8 result: None
8 result: 0
9 9 running: log -r 0
10 10 changeset: 0:0e4634943879
11 11 user: test
12 12 date: Sat Jan 01 00:00:00 2000 +0000
13 13 summary: commit1
14 14
15 result: None
15 result: 0
16 16 running: log -r tip
17 17 changeset: 1:45589e459b2e
18 18 tag: tip
@@ -20,4 +20,4 b' user: test'
20 20 date: Sun Jan 02 00:00:00 2000 +0000
21 21 summary: commit2
22 22
23 result: None
23 result: 0
General Comments 0
You need to be logged in to leave comments. Login now