mercurial/subrepo.py
branchstable
changeset 14506 733af5d9f6b2
parent 14505 90ef40bf97e3
child 14509 4f695345979c
equal deleted inserted replaced
14505:90ef40bf97e3 14506:733af5d9f6b2
   522         self._ctx = ctx
   522         self._ctx = ctx
   523         self._ui = ctx._repo.ui
   523         self._ui = ctx._repo.ui
   524 
   524 
   525     def _svncommand(self, commands, filename=''):
   525     def _svncommand(self, commands, filename=''):
   526         cmd = ['svn']
   526         cmd = ['svn']
   527         # Starting in svn 1.5 --non-interactive is a global flag
   527         extrakw = {}
   528         # instead of being per-command, but we need to support 1.4 so
   528         if not self._ui.interactive():
   529         # we have to be intelligent about what commands take
   529             # Making stdin be a pipe should prevent svn from behaving
   530         # --non-interactive.
   530             # interactively even if we can't pass --non-interactive.
   531         if (not self._ui.interactive() and
   531             extrakw['stdin'] = subprocess.PIPE
   532             commands[0] in ('update', 'checkout', 'commit')):
   532             # Starting in svn 1.5 --non-interactive is a global flag
   533             cmd.append('--non-interactive')
   533             # instead of being per-command, but we need to support 1.4 so
       
   534             # we have to be intelligent about what commands take
       
   535             # --non-interactive.
       
   536             if commands[0] in ('update', 'checkout', 'commit'):
       
   537                 cmd.append('--non-interactive')
   534         cmd.extend(commands)
   538         cmd.extend(commands)
   535         if filename is not None:
   539         if filename is not None:
   536             path = os.path.join(self._ctx._repo.origroot, self._path, filename)
   540             path = os.path.join(self._ctx._repo.origroot, self._path, filename)
   537             cmd.append(path)
   541             cmd.append(path)
   538         env = dict(os.environ)
   542         env = dict(os.environ)
   539         # Avoid localized output, preserve current locale for everything else.
   543         # Avoid localized output, preserve current locale for everything else.
   540         env['LC_MESSAGES'] = 'C'
   544         env['LC_MESSAGES'] = 'C'
   541         p = subprocess.Popen(cmd, bufsize=-1, close_fds=util.closefds,
   545         p = subprocess.Popen(cmd, bufsize=-1, close_fds=util.closefds,
   542                              stdout=subprocess.PIPE, stderr=subprocess.PIPE,
   546                              stdout=subprocess.PIPE, stderr=subprocess.PIPE,
   543                               universal_newlines=True, env=env)
   547                               universal_newlines=True, env=env, **extrakw)
   544         stdout, stderr = p.communicate()
   548         stdout, stderr = p.communicate()
   545         stderr = stderr.strip()
   549         stderr = stderr.strip()
   546         if p.returncode:
   550         if p.returncode:
   547             raise util.Abort(stderr or 'exited with code %d' % p.returncode)
   551             raise util.Abort(stderr or 'exited with code %d' % p.returncode)
   548         if stderr:
   552         if stderr: