vcs-svn: implement text-delta handling
Handle input in Subversion's dumpfile format, version 3. This is the format produced by "svnrdump dump" and "svnadmin dump --deltas", and the main difference between v3 dumpfiles and the dumpfiles already handled is that these can include nodes whose properties and text are expressed relative to some other node. To handle such nodes, we find which node the text and properties are based on, handle its property changes, use the cat-blob command to request the basis blob from the fast-import backend, use the svndiff0_apply() helper to apply the text delta on the fly, writing output to a temporary file, and then measure that postimage file's length and write its content to the fast-import stream. The temporary postimage file is shared between delta-using nodes to avoid some file system overhead. The svn-fe interface needs to be more complicated to accomodate the backward flow of information from the fast-import backend to svn-fe. The backflow fd is not needed when parsing streams without deltas, though, so existing scripts using svn-fe on v2 dumps should continue to work. NEEDSWORK: generalize interface so caller sets the backflow fd, close temporary file before exiting Signed-off-by: David Barr <david.barr@cordelta.com> Signed-off-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
e9f3f8b6f4
commit
7a75e661c5
@ -217,9 +217,7 @@ static void handle_node(void)
|
||||
*/
|
||||
static const char *const empty_blob = "::empty::";
|
||||
const char *old_data = NULL;
|
||||
|
||||
if (node_ctx.text_delta)
|
||||
die("text deltas not supported");
|
||||
uint32_t old_mode = REPO_MODE_BLB;
|
||||
|
||||
if (node_ctx.action == NODEACT_DELETE) {
|
||||
if (have_text || have_props || node_ctx.srcRev)
|
||||
@ -255,6 +253,7 @@ static void handle_node(void)
|
||||
if (mode != REPO_MODE_DIR && type == REPO_MODE_DIR)
|
||||
die("invalid dump: cannot modify a file into a directory");
|
||||
node_ctx.type = mode;
|
||||
old_mode = mode;
|
||||
} else if (node_ctx.action == NODEACT_ADD) {
|
||||
if (type == REPO_MODE_DIR)
|
||||
old_data = NULL;
|
||||
@ -289,8 +288,14 @@ static void handle_node(void)
|
||||
fast_export_modify(node_ctx.dst.buf, node_ctx.type, old_data);
|
||||
return;
|
||||
}
|
||||
if (!node_ctx.text_delta) {
|
||||
fast_export_modify(node_ctx.dst.buf, node_ctx.type, "inline");
|
||||
fast_export_data(node_ctx.type, node_ctx.textLength, &input);
|
||||
return;
|
||||
}
|
||||
fast_export_modify(node_ctx.dst.buf, node_ctx.type, "inline");
|
||||
fast_export_data(node_ctx.type, node_ctx.textLength, &input);
|
||||
fast_export_blob_delta(node_ctx.type, old_mode, old_data,
|
||||
node_ctx.textLength, &input);
|
||||
}
|
||||
|
||||
static void begin_revision(void)
|
||||
|
Reference in New Issue
Block a user