##// END OF EJS Templates
merge with stable
Gregory Szorc -
r39876:a9f56e45 merge default
parent child Browse files
Show More
@@ -198,13 +198,15 b' def _newchgui(srcui, csystem, attachio):'
198 self._csystem = csystem
198 self._csystem = csystem
199
199
200 def _runsystem(self, cmd, environ, cwd, out):
200 def _runsystem(self, cmd, environ, cwd, out):
201 # fallback to the original system method if the output needs to be
201 # fallback to the original system method if
202 # captured (to self._buffers), or the output stream is not stdout
202 # a. the output stream is not stdout (e.g. stderr, cStringIO),
203 # (e.g. stderr, cStringIO), because the chg client is not aware of
203 # b. or stdout is redirected by protectstdio(),
204 # these situations and will behave differently (write to stdout).
204 # because the chg client is not aware of these situations and
205 # will behave differently (i.e. write to stdout).
205 if (out is not self.fout
206 if (out is not self.fout
206 or not util.safehasattr(self.fout, 'fileno')
207 or not util.safehasattr(self.fout, 'fileno')
207 or self.fout.fileno() != procutil.stdout.fileno()):
208 or self.fout.fileno() != procutil.stdout.fileno()
209 or self._finoutredirected):
208 return procutil.system(cmd, environ=environ, cwd=cwd, out=out)
210 return procutil.system(cmd, environ=environ, cwd=cwd, out=out)
209 self.flush()
211 self.flush()
210 return self._csystem(cmd, procutil.shellenviron(environ), cwd)
212 return self._csystem(cmd, procutil.shellenviron(environ), cwd)
@@ -234,6 +234,7 b' class ui(object):'
234 self.fout = src.fout
234 self.fout = src.fout
235 self.ferr = src.ferr
235 self.ferr = src.ferr
236 self.fin = src.fin
236 self.fin = src.fin
237 self._finoutredirected = src._finoutredirected
237 self.pageractive = src.pageractive
238 self.pageractive = src.pageractive
238 self._disablepager = src._disablepager
239 self._disablepager = src._disablepager
239 self._tweaked = src._tweaked
240 self._tweaked = src._tweaked
@@ -258,6 +259,7 b' class ui(object):'
258 self.fout = procutil.stdout
259 self.fout = procutil.stdout
259 self.ferr = procutil.stderr
260 self.ferr = procutil.stderr
260 self.fin = procutil.stdin
261 self.fin = procutil.stdin
262 self._finoutredirected = False
261 self.pageractive = False
263 self.pageractive = False
262 self._disablepager = False
264 self._disablepager = False
263 self._tweaked = False
265 self._tweaked = False
@@ -278,13 +278,13 b' def protectstdio(uin, uout):'
278 """
278 """
279 uout.flush()
279 uout.flush()
280 fin, fout = uin, uout
280 fin, fout = uin, uout
281 if uin is stdin:
281 if _testfileno(uin, stdin):
282 newfd = os.dup(uin.fileno())
282 newfd = os.dup(uin.fileno())
283 nullfd = os.open(os.devnull, os.O_RDONLY)
283 nullfd = os.open(os.devnull, os.O_RDONLY)
284 os.dup2(nullfd, uin.fileno())
284 os.dup2(nullfd, uin.fileno())
285 os.close(nullfd)
285 os.close(nullfd)
286 fin = os.fdopen(newfd, r'rb')
286 fin = os.fdopen(newfd, r'rb')
287 if uout is stdout:
287 if _testfileno(uout, stdout):
288 newfd = os.dup(uout.fileno())
288 newfd = os.dup(uout.fileno())
289 os.dup2(stderr.fileno(), uout.fileno())
289 os.dup2(stderr.fileno(), uout.fileno())
290 fout = os.fdopen(newfd, r'wb')
290 fout = os.fdopen(newfd, r'wb')
@@ -783,6 +783,8 b' class sshserver(object):'
783 self._ui = ui
783 self._ui = ui
784 self._repo = repo
784 self._repo = repo
785 self._fin, self._fout = procutil.protectstdio(ui.fin, ui.fout)
785 self._fin, self._fout = procutil.protectstdio(ui.fin, ui.fout)
786 # TODO: manage the redirection flag internally by ui
787 ui._finoutredirected = (self._fin, self._fout) != (ui.fin, ui.fout)
786
788
787 # Log write I/O to stdout and stderr if configured.
789 # Log write I/O to stdout and stderr if configured.
788 if logfh:
790 if logfh:
@@ -313,6 +313,26 b' push should succeed even though it has a'
313 summary: z
313 summary: z
314
314
315
315
316 #if chg
317
318 try again with remote chg, which should succeed as well
319
320 $ hg rollback -R ../remote
321 repository tip rolled back to revision 4 (undo serve)
322
323 $ hg push --config ui.remotecmd=chg
324 pushing to ssh://user@dummy/remote
325 searching for changes
326 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
327 remote: adding changesets
328 remote: adding manifests
329 remote: adding file changes
330 remote: added 1 changesets with 1 changes to 1 files
331 remote: KABOOM
332 remote: KABOOM IN PROCESS
333
334 #endif
335
316 clone bookmarks
336 clone bookmarks
317
337
318 $ hg -R ../remote bookmark test
338 $ hg -R ../remote bookmark test
@@ -554,6 +574,8 b' debug output'
554 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
574 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
555 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
575 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
556 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
576 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
577 Got arguments 1:user@dummy 2:chg -R remote serve --stdio (chg !)
578 changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP (chg !)
557 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
579 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
558 Got arguments 1:user@dummy 2:hg init 'a repo'
580 Got arguments 1:user@dummy 2:hg init 'a repo'
559 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
581 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
General Comments 0
You need to be logged in to leave comments. Login now