vcs-svn: set up channel to read fast-import cat-blob response
Set up some plumbing: teach the svndump lib to pass a file descriptor number to the fast_export lib, representing where cat-blob/ls responses can be read from, and add a get_response_line helper function to the fast_export lib to read a line from that file. Unfortunately this means that svn-fe needs file descriptor 3 to be redirected from somewhere (preferrably the cat-blob stream of a fast-import backend); otherwise it will fail: $ svndump <path> | svn-fe fatal: cannot read from file descriptor 3: Bad file descriptor For the moment, "svn-fe 3</dev/null" works as a workaround but it will not work for very long. A fast-import backend that can retrieve old commits is needed in order to be able to fulfill svn "Node-copyfrom-rev" requests that refer to revs from a previous run. [jn: with new change description] Based-on-patch-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
This commit is contained in:
committed by
Jonathan Nieder
parent
efc749b48f
commit
41529bbce4
@ -12,6 +12,24 @@
|
||||
#define MAX_GITSVN_LINE_LEN 4096
|
||||
|
||||
static uint32_t first_commit_done;
|
||||
static struct line_buffer report_buffer = LINE_BUFFER_INIT;
|
||||
|
||||
void fast_export_init(int fd)
|
||||
{
|
||||
if (buffer_fdinit(&report_buffer, fd))
|
||||
die_errno("cannot read from file descriptor %d", fd);
|
||||
}
|
||||
|
||||
void fast_export_deinit(void)
|
||||
{
|
||||
if (buffer_deinit(&report_buffer))
|
||||
die_errno("error closing fast-import feedback stream");
|
||||
}
|
||||
|
||||
void fast_export_reset(void)
|
||||
{
|
||||
buffer_reset(&report_buffer);
|
||||
}
|
||||
|
||||
void fast_export_delete(uint32_t depth, uint32_t *path)
|
||||
{
|
||||
@ -63,6 +81,16 @@ void fast_export_commit(uint32_t revision, uint32_t author, char *log,
|
||||
printf("progress Imported commit %"PRIu32".\n\n", revision);
|
||||
}
|
||||
|
||||
static const char *get_response_line(void)
|
||||
{
|
||||
const char *line = buffer_read_line(&report_buffer);
|
||||
if (line)
|
||||
return line;
|
||||
if (buffer_ferror(&report_buffer))
|
||||
die_errno("error reading from fast-import");
|
||||
die("unexpected end of fast-import feedback");
|
||||
}
|
||||
|
||||
void fast_export_blob(uint32_t mode, uint32_t mark, uint32_t len, struct line_buffer *input)
|
||||
{
|
||||
if (mode == REPO_MODE_LNK) {
|
||||
|
||||
Reference in New Issue
Block a user