# HG changeset patch # User derekbrowncmu@gmail.com # Date 1658129393 14400 # Node ID b9fcf54030d7d490f08bf82fdfe61dac3e883ab1 # Parent 5baf873ccb6e69368511bc3f05ba76f8e40a7771 subrepo: avoid opening console window for non-native subrepos on Windows Prevent annoying command prompt windows popping up when using TortoiseHG with Git and SVN subrepos by passing creationflags=subprocess.CREATE_NO_WINDOW to subprocess.Popen. diff -r 5baf873ccb6e -r b9fcf54030d7 mercurial/subrepo.py --- a/mercurial/subrepo.py Wed Jul 13 17:13:33 2022 -0400 +++ b/mercurial/subrepo.py Mon Jul 18 03:29:53 2022 -0400 @@ -1099,6 +1099,10 @@ # --non-interactive. if commands[0] in (b'update', b'checkout', b'commit'): cmd.append(b'--non-interactive') + if util.safehasattr(subprocess, 'CREATE_NO_WINDOW'): + # On Windows, prevent command prompts windows from popping up when + # running in pythonw. + extrakw['creationflags'] = getattr(subprocess, 'CREATE_NO_WINDOW') cmd.extend(commands) if filename is not None: path = self.wvfs.reljoin( @@ -1469,6 +1473,11 @@ # insert the argument in the front, # the end of git diff arguments is used for paths commands.insert(1, b'--color') + extrakw = {} + if util.safehasattr(subprocess, 'CREATE_NO_WINDOW'): + # On Windows, prevent command prompts windows from popping up when + # running in pythonw. + extrakw['creationflags'] = getattr(subprocess, 'CREATE_NO_WINDOW') p = subprocess.Popen( pycompat.rapply( procutil.tonativestr, [self._gitexecutable] + commands @@ -1479,6 +1488,7 @@ close_fds=procutil.closefds, stdout=subprocess.PIPE, stderr=errpipe, + **extrakw ) if stream: return p.stdout, None