summaryrefslogtreecommitdiff
path: root/vcs-svn
diff options
context:
space:
mode:
Diffstat (limited to 'vcs-svn')
-rw-r--r--vcs-svn/fast_export.c28
-rw-r--r--vcs-svn/fast_export.h4
-rw-r--r--vcs-svn/svndump.c5
3 files changed, 37 insertions, 0 deletions
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index 260cf50e77..70bd9597e7 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -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) {
diff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h
index 054e7d5eb1..fed30c14e6 100644
--- a/vcs-svn/fast_export.h
+++ b/vcs-svn/fast_export.h
@@ -3,6 +3,10 @@
#include "line_buffer.h"
+void fast_export_init(int fd);
+void fast_export_deinit(void);
+void fast_export_reset(void);
+
void fast_export_delete(uint32_t depth, uint32_t *path);
void fast_export_modify(uint32_t depth, uint32_t *path, uint32_t mode,
uint32_t mark);
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index e6d84bada5..e05a99d51f 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -14,6 +14,8 @@
#include "obj_pool.h"
#include "string_pool.h"
+#define REPORT_FILENO 3
+
#define NODEACT_REPLACE 4
#define NODEACT_DELETE 3
#define NODEACT_ADD 2
@@ -367,6 +369,7 @@ int svndump_init(const char *filename)
if (buffer_init(&input, filename))
return error("cannot open %s: %s", filename, strerror(errno));
repo_init();
+ fast_export_init(REPORT_FILENO);
reset_dump_ctx(~0);
reset_rev_ctx(0);
reset_node_ctx(NULL);
@@ -377,6 +380,7 @@ int svndump_init(const char *filename)
void svndump_deinit(void)
{
log_reset();
+ fast_export_deinit();
repo_reset();
reset_dump_ctx(~0);
reset_rev_ctx(0);
@@ -390,6 +394,7 @@ void svndump_deinit(void)
void svndump_reset(void)
{
log_reset();
+ fast_export_reset();
buffer_reset(&input);
repo_reset();
reset_dump_ctx(~0);