| 286 | self._p4('change', ['-d', self._cl]) |
| 287 | |
| 288 | def _create_cl(self): |
| 289 | desc = f""" |
| 290 | Change: new |
| 291 | |
| 292 | Description: |
| 293 | \t{self._cl_desc} |
| 294 | """ |
| 295 | p = subprocess.Popen(['p4', 'change', '-i'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 296 | stdout, stderr = p.communicate(desc.encode()) |
| 297 | if p.returncode != 0: |
| 298 | raise subprocess.CalledProcessError(p.returncode, 'p4', stderr.decode()) |
| 299 | match = re.match(r'.*Change (\d+) created.*', stdout.decode(), re.IGNORECASE | re.MULTILINE) |
| 300 | if not match: |
| 301 | raise subprocess.CalledProcessError(p.returncode, 'p4', stderr.decode()) |
| 302 | return match.group(1) |
| 303 | |
| 304 | def _p4(self, action, paths): |
| 305 | args = ['p4', '-b', str(len(paths) + 1), '-x', '-', action] |