| 4016 | sys.stdout.write("\n") |
| 4017 | |
| 4018 | def openStreams(self): |
| 4019 | self.importProcess = subprocess.Popen(["git", "fast-import"], |
| 4020 | stdin=subprocess.PIPE, |
| 4021 | stdout=subprocess.PIPE, |
| 4022 | stderr=subprocess.PIPE) |
| 4023 | self.gitOutput = self.importProcess.stdout |
| 4024 | self.gitStream = self.importProcess.stdin |
| 4025 | self.gitError = self.importProcess.stderr |
| 4026 | |
| 4027 | if bytes is not str: |
| 4028 | # Wrap gitStream.write() so that it can be called using `str` arguments |
| 4029 | def make_encoded_write(write): |
| 4030 | def encoded_write(s): |
| 4031 | return write(s.encode() if isinstance(s, str) else s) |
| 4032 | return encoded_write |
| 4033 | |
| 4034 | self.gitStream.write = make_encoded_write(self.gitStream.write) |
| 4035 | |
| 4036 | def closeStreams(self): |
| 4037 | if self.gitStream is None: |