From: Ramkumar Ramachandra <artagnon@gmail.com>
To: "Git Mailing List" <git@vger.kernel.org>
Cc: David Michael Barr <david.barr@cordelta.com>,
Jonathan Nieder <jrnieder@gmail.com>,
Sverre Rabbelier <srabbelier@gmail.com>,
Daniel Shahaf <daniel@shahaf.name>
Subject: [WIP PATCH 7/7] Dump the text delta
Date: Wed, 23 Jun 2010 18:22:20 +0200 [thread overview]
Message-ID: <1277310140-16891-8-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1277310140-16891-1-git-send-email-artagnon@gmail.com>
Add a handler and handler_baton to handle text deltas in the editor
baton. Currently, program exits with code 01 because delta source ends
unexpectedly.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
dump_editor.c | 51 +++++++++++++++++++++++++++++++--------------------
1 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/dump_editor.c b/dump_editor.c
index 7bd00a4..2192177 100644
--- a/dump_editor.c
+++ b/dump_editor.c
@@ -27,12 +27,13 @@ struct edit_baton {
apr_hash_t *properties;
apr_hash_t *del_properties; /* Value is always 0x1 */
- /* Store the text delta */
- const char *delta_text;
-
/* reusable buffer for writing file contents */
char buffer[SVN__STREAM_CHUNK_SIZE];
apr_size_t bufsize;
+
+ /* The txdelta handler and handler baton */
+ svn_txdelta_window_handler_t *handler;
+ void **handler_baton;
};
struct dir_baton {
@@ -351,22 +352,9 @@ static svn_error_t *dump_node(struct edit_baton *eb,
len = propstring->len;
SVN_ERR(svn_stream_write(eb->stream, propstring->data, &len));
}
- /* if (must_dump_text && (kind == svn_node_file)) */
- /* { */
- /* svn_stream_t *contents; */
-
- /* if (delta_file) */
- /* { */
- /* /\* Make sure to close the underlying file when the stream is */
- /* closed. *\/ */
- /* contents = svn_stream_from_aprfile2(delta_file, FALSE, pool); */
- /* } */
- /* else */
- /* SVN_ERR(svn_fs_file_contents(&contents, eb->fs_root, path, pool)); */
-
- /* SVN_ERR(svn_stream_copy3(contents, svn_stream_disown(eb->stream, pool), */
- /* NULL, NULL, pool)); */
- /* } */
+ if (must_dump_text && (kind == svn_node_file) && eb->handler) {
+ svn_txdelta_to_svndiff2(eb->handler, eb->handler_baton, eb->stream, 0, pool);
+ }
return SVN_NO_ERROR;
}
@@ -610,6 +598,28 @@ svn_error_t *change_file_prop(void *file_baton,
return SVN_NO_ERROR;
}
+svn_error_t *apply_textdelta(void *file_baton, const char *base_checksum,
+ apr_pool_t *pool,
+ svn_txdelta_window_handler_t *handler,
+ void **handler_baton)
+{
+ struct file_baton *fb = file_baton;
+ svn_stream_t *source_stream = svn_stream_empty(pool);
+ svn_txdelta_apply(source_stream, fb->eb->stream,
+ NULL, fb->path, pool, handler,
+ handler_baton);
+ fb->eb->handler = handler;
+ fb->eb->handler_baton = handler_baton;
+
+ text_changed = TRUE;
+
+ SVN_ERR(dump_node(fb->eb, fb->path,
+ svn_node_dir, svn_node_action_change,
+ FALSE, NULL, 0, pool));
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *get_dump_editor(const svn_delta_editor_t **editor,
void **edit_baton,
svn_revnum_t to_rev,
@@ -630,7 +640,8 @@ svn_error_t *get_dump_editor(const svn_delta_editor_t **editor,
dump_editor->open_directory = open_directory;
dump_editor->close_directory = close_directory;
dump_editor->change_dir_prop = change_dir_prop;
- dump_editor->change_file_prop = change_file_prop;
+ dump_editor->change_file_prop = change_file_prop;
+ dump_editor->apply_textdelta = apply_textdelta;
dump_editor->add_file = add_file;
dump_editor->open_file = open_file;
--
1.7.1
next prev parent reply other threads:[~2010-06-23 16:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-23 16:22 [GSoC update] git-remote-svn: Week 8 Ramkumar Ramachandra
2010-06-23 16:22 ` [WIP PATCH 1/7] Add skeleton RA svnclient Ramkumar Ramachandra
2010-06-25 0:14 ` Jonathan Nieder
2010-06-25 9:07 ` Daniel Shahaf
2010-06-25 11:07 ` Ramkumar Ramachandra
2010-06-25 11:30 ` Daniel Shahaf
2010-06-25 15:30 ` OT: typesafe callbacks in C (Re: [WIP PATCH 1/7] Add skeleton RA svnclient) Jonathan Nieder
2010-06-25 14:45 ` [WIP PATCH 1/7] Add skeleton RA svnclient Jonathan Nieder
2010-06-25 13:34 ` Jonathan Nieder
2010-06-23 16:22 ` [WIP PATCH 2/7] Add stripped dump editor Ramkumar Ramachandra
2010-06-23 16:22 ` [WIP PATCH 3/7] Import dump_node to dump what changed and cleanup whitespace Ramkumar Ramachandra
2010-06-23 17:05 ` Ramkumar Ramachandra
2010-06-23 16:22 ` [WIP PATCH 4/7] Replace deprecated svn_path_join Ramkumar Ramachandra
2010-06-23 16:22 ` [WIP PATCH 5/7] Trigger dump_node in change_dir_prop Ramkumar Ramachandra
2010-06-23 16:22 ` [WIP PATCH 6/7] Add file_baton and trigger dump_node in change_file_prop Ramkumar Ramachandra
2010-06-23 16:22 ` Ramkumar Ramachandra [this message]
2010-06-23 17:18 ` [GSoC update] git-remote-svn: Week 8 Ramkumar Ramachandra
2010-06-25 0:42 ` Jonathan Nieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1277310140-16891-8-git-send-email-artagnon@gmail.com \
--to=artagnon@gmail.com \
--cc=daniel@shahaf.name \
--cc=david.barr@cordelta.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=srabbelier@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).