def __init__(self, revision_reader, target): self.target = target # Since the output of this run is a repository, not a dumpfile, # the temporary dumpfiles we create should go in the tmpdir. But # since we delete it ourselves, we don't want to use # artifact_manager. DumpfileDelegate.__init__( self, revision_reader, Ctx().get_temp_filename(DUMPFILE) ) self.dumpfile = open(self.dumpfile_path, 'w+b') self.loader_pipe = subprocess.Popen( [Ctx().svnadmin_executable, 'load', '-q', self.target], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) self.loader_pipe.stdout.close() try: self._write_dumpfile_header(self.loader_pipe.stdin) except IOError: raise FatalError( 'svnadmin failed with the following output while ' 'loading the dumpfile:\n%s' % (self.loader_pipe.stderr.read(),) )
def end_commit(self): """Feed the revision stored in the dumpfile to the svnadmin load pipe.""" DumpfileDelegate.end_commit(self) self.dumpfile.seek(0) while True: data = self.dumpfile.read(128 * 1024) # Chunk size is arbitrary if not data: break try: self.loader_pipe.stdin.write(data) except IOError: raise FatalError("svnadmin failed with the following output " "while loading the dumpfile:\n" + self.loader_pipe.stderr.read()) self.dumpfile.seek(0) self.dumpfile.truncate()
def end_commit(self): """Feed the revision stored in the dumpfile to the svnadmin load pipe.""" DumpfileDelegate.end_commit(self) self.dumpfile.seek(0) while True: data = self.dumpfile.read(128*1024) # Chunk size is arbitrary if not data: break try: self.loader_pipe.stdin.write(data) except IOError: raise FatalError("svnadmin failed with the following output " "while loading the dumpfile:\n" + self.loader_pipe.stderr.read()) self.dumpfile.seek(0) self.dumpfile.truncate()
def __init__(self, revision_reader, target): self.target = target # Since the output of this run is a repository, not a dumpfile, # the temporary dumpfiles we create should go in the tmpdir. But # since we delete it ourselves, we don't want to use # artifact_manager. DumpfileDelegate.__init__( self, revision_reader, Ctx().get_temp_filename(DUMPFILE) ) self.dumpfile = open(self.dumpfile_path, 'w+b') self.loader_pipe = SimplePopen([ Ctx().svnadmin_executable, 'load', '-q', self.target ], True) self.loader_pipe.stdout.close() try: self._write_dumpfile_header(self.loader_pipe.stdin) except IOError: raise FatalError("svnadmin failed with the following output while " "loading the dumpfile:\n" + self.loader_pipe.stderr.read())
def start_commit(self, revnum, revprops): """Start a new commit.""" DumpfileDelegate.start_commit(self, revnum, revprops)