# HG changeset patch # User Marcin Kuzminski # Date 2018-02-12 13:05:48 # Node ID d27ef2a852e506b0ff91793cf17fc814905a5c79 # Parent 6548a47e4dcd29d47d165de9185fdd9e1ada2e37 sync: disable prompts to not allow in any case to block processes on input. diff --git a/vcsserver/git.py b/vcsserver/git.py --- a/vcsserver/git.py +++ b/vcsserver/git.py @@ -451,8 +451,9 @@ class GitRemote(object): if self.check_url(url, wire): repo = self._factory.repo(wire) self.run_git_command( - wire, ['push', url, '--mirror'], fail_on_stderr=False) - + wire, ['push', url, '--mirror'], fail_on_stderr=False, + _copts=['-c', 'core.askpass=""'], + extra_env={'GIT_TERMINAL_PROMPT': '0'}) @reraise_safe_exceptions def get_remote_refs(self, wire, url): @@ -625,6 +626,10 @@ class GitRemote(object): del opts['_safe'] safe_call = True + if '_copts' in opts: + _copts.extend(opts['_copts'] or []) + del opts['_copts'] + gitenv = os.environ.copy() gitenv.update(opts.pop('extra_env', {})) # need to clean fix GIT_DIR ! diff --git a/vcsserver/hg.py b/vcsserver/hg.py --- a/vcsserver/hg.py +++ b/vcsserver/hg.py @@ -553,7 +553,13 @@ class HgRemote(object): @reraise_safe_exceptions def pull(self, wire, url, commit_ids=None): repo = self._factory.repo(wire) + # Disable any prompts for this repo + repo.ui.setconfig('ui', 'interactive', 'off', '-y') + remote = peer(repo, {}, url) + # Disable any prompts for this remote + remote.ui.setconfig('ui', 'interactive', 'off', '-y') + if commit_ids: commit_ids = [bin(commit_id) for commit_id in commit_ids] @@ -564,8 +570,15 @@ class HgRemote(object): def sync_push(self, wire, url): if self.check_url(url, wire['config']): repo = self._factory.repo(wire) + + # Disable any prompts for this repo + repo.ui.setconfig('ui', 'interactive', 'off', '-y') + bookmarks = dict(repo._bookmarks).keys() remote = peer(repo, {}, url) + # Disable any prompts for this remote + remote.ui.setconfig('ui', 'interactive', 'off', '-y') + return exchange.push( repo, remote, newbranch=True, bookmarks=bookmarks).cgresult diff --git a/vcsserver/utils.py b/vcsserver/utils.py --- a/vcsserver/utils.py +++ b/vcsserver/utils.py @@ -14,6 +14,9 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +import logging + +log = logging.getLogger(__name__) def safe_int(val, default=None):