From: David Barr <david.barr@cordelta.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Sverre Rabbelier <srabbelier@gmail.com>,
David Barr <david.barr@cordelta.com>
Subject: [PATCH 5/7] vcs-svn: extend svndump to parse version 3 format
Date: Wed, 13 Oct 2010 00:50:22 +1100 [thread overview]
Message-ID: <1286891424-2067-6-git-send-email-david.barr@cordelta.com> (raw)
In-Reply-To: <1286891424-2067-1-git-send-email-david.barr@cordelta.com>
Added 1 new dump header, SVN-fs-dump-format-version.
Added 6 new node headers:
* Text-delta: true|false
* Prop-delta: true|false
* Text-delta-base-md5: <32 hex digits>
* Text-delta-base-sha1: <40 hex digits>
* Text-copy-source-sha1: <40 hex digits>
* Text-content-sha1: <40 hex digits>
This change simply populates the context.
Further changes will be needed to handle text and prop deltas.
Signed-off-by: David Barr <david.barr@cordelta.com>
---
vcs-svn/svndump.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 53 insertions(+), 5 deletions(-)
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index 3bba0fe..458053e 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -27,6 +27,9 @@
#define LENGTH_UNKNOWN (~0)
#define DATE_RFC2822_LEN 31
+#define MD5_HEX_LENGTH 32
+#define SHA1_HEX_LENGTH 40
+
/* Create memory pool for log messages */
obj_pool_gen(log, char, 4096)
@@ -44,6 +47,11 @@ static char* log_copy(uint32_t length, char *log)
static struct {
uint32_t action, propLength, textLength, srcRev, srcMode, mark, type;
uint32_t src[REPO_MAX_PATH_DEPTH], dst[REPO_MAX_PATH_DEPTH];
+ uint32_t text_delta, prop_delta;
+ char text_delta_base_md5[MD5_HEX_LENGTH + 1];
+ char text_content_sha1[SHA1_HEX_LENGTH + 1];
+ char text_delta_base_sha1[SHA1_HEX_LENGTH + 1];
+ char text_copy_source_sha1[SHA1_HEX_LENGTH + 1];
} node_ctx;
static struct {
@@ -53,14 +61,20 @@ static struct {
} rev_ctx;
static struct {
- uint32_t uuid, url;
+ uint32_t version, uuid, url;
} dump_ctx;
static struct {
- uint32_t svn_log, svn_author, svn_date, svn_executable, svn_special, uuid,
+ uint32_t svn_log, svn_author, svn_date, svn_executable, svn_special,
revision_number, node_path, node_kind, node_action,
node_copyfrom_path, node_copyfrom_rev, text_content_length,
- prop_content_length, content_length;
+ prop_content_length, content_length,
+ /* SVN dump version 2 */
+ uuid, svn_fs_dump_format_version,
+ /* SVN dump version 3 */
+ text_delta, prop_delta, text_content_sha1,
+ text_delta_base_md5, text_delta_base_sha1,
+ text_copy_source_sha1;
} keys;
static void reset_node_ctx(char *fname)
@@ -74,6 +88,12 @@ static void reset_node_ctx(char *fname)
node_ctx.srcMode = 0;
pool_tok_seq(REPO_MAX_PATH_DEPTH, node_ctx.dst, "/", fname);
node_ctx.mark = 0;
+ node_ctx.text_delta = 0;
+ node_ctx.prop_delta = 0;
+ *node_ctx.text_delta_base_md5 = '\0';
+ *node_ctx.text_content_sha1 = '\0';
+ *node_ctx.text_delta_base_sha1 = '\0';
+ *node_ctx.text_copy_source_sha1 = '\0';
}
static void reset_rev_ctx(uint32_t revision)
@@ -87,6 +107,7 @@ static void reset_rev_ctx(uint32_t revision)
static void reset_dump_ctx(uint32_t url)
{
dump_ctx.url = url;
+ dump_ctx.version = 1;
dump_ctx.uuid = ~0;
}
@@ -97,7 +118,6 @@ static void init_keys(void)
keys.svn_date = pool_intern("svn:date");
keys.svn_executable = pool_intern("svn:executable");
keys.svn_special = pool_intern("svn:special");
- keys.uuid = pool_intern("UUID");
keys.revision_number = pool_intern("Revision-number");
keys.node_path = pool_intern("Node-path");
keys.node_kind = pool_intern("Node-kind");
@@ -107,6 +127,16 @@ static void init_keys(void)
keys.text_content_length = pool_intern("Text-content-length");
keys.prop_content_length = pool_intern("Prop-content-length");
keys.content_length = pool_intern("Content-length");
+ /* SVN dump version 2 */
+ keys.svn_fs_dump_format_version = pool_intern("SVN-fs-dump-format-version");
+ keys.uuid = pool_intern("UUID");
+ /* SVN dump version 3 */
+ keys.text_delta = pool_intern("Text-delta");
+ keys.prop_delta = pool_intern("Prop-delta");
+ keys.text_delta_base_md5 = pool_intern("Text-delta-base-md5");
+ keys.text_delta_base_sha1 = pool_intern("Text-delta-base-sha1");
+ keys.text_copy_source_sha1 = pool_intern("Text-copy-source-sha1");
+ keys.text_content_sha1 = pool_intern("Text-content-sha1");
}
static void read_props(void)
@@ -209,7 +239,9 @@ void svndump_read(const char *url)
*val++ = '\0';
key = pool_intern(t);
- if (key == keys.uuid) {
+ if (key == keys.svn_fs_dump_format_version) {
+ dump_ctx.version = atoi(val);
+ } else if (key == keys.uuid) {
dump_ctx.uuid = pool_intern(val);
} else if (key == keys.revision_number) {
if (active_ctx == NODE_CTX)
@@ -251,6 +283,22 @@ void svndump_read(const char *url)
node_ctx.textLength = atoi(val);
} else if (key == keys.prop_content_length) {
node_ctx.propLength = atoi(val);
+ } else if (key == keys.text_delta) {
+ node_ctx.text_delta = !strcmp(val, "true");
+ } else if (key == keys.prop_delta) {
+ node_ctx.prop_delta = !strcmp(val, "true");
+ } else if (key == keys.text_delta_base_md5) {
+ strncpy(node_ctx.text_delta_base_md5, val,
+ MD5_HEX_LENGTH + 1);
+ } else if (key == keys.text_delta_base_sha1) {
+ strncpy(node_ctx.text_delta_base_sha1, val,
+ SHA1_HEX_LENGTH + 1);
+ } else if (key == keys.text_copy_source_sha1) {
+ strncpy(node_ctx.text_copy_source_sha1, val,
+ SHA1_HEX_LENGTH + 1);
+ } else if (key == keys.text_content_sha1) {
+ strncpy(node_ctx.text_content_sha1, val,
+ SHA1_HEX_LENGTH + 1);
} else if (key == keys.content_length) {
len = atoi(val);
buffer_read_line(&input);
--
1.7.3.1
next prev parent reply other threads:[~2010-10-12 13:50 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-12 13:50 [PATCH/RFC] Add support for subversion dump format v3 David Barr
2010-10-12 13:50 ` [PATCH 1/7] Teach fast-import to print the id of each imported commit David Barr
2010-10-12 14:42 ` Sverre Rabbelier
2010-10-12 18:48 ` Jonathan Nieder
2010-10-12 18:57 ` Sverre Rabbelier
2010-10-12 19:07 ` Jonathan Nieder
2010-10-12 22:06 ` Jonathan Nieder
2010-10-12 23:05 ` Sverre Rabbelier
2010-10-12 13:50 ` [PATCH 2/7] fast-import: Let importers retrieve the objects being written David Barr
2010-10-12 22:38 ` Jonathan Nieder
2010-10-12 23:07 ` Sverre Rabbelier
2010-10-13 0:07 ` Jonathan Nieder
2010-10-13 13:10 ` Sverre Rabbelier
2010-10-12 13:50 ` [PATCH 3/7] fast-import: Allow cat command with empty path David Barr
2010-10-12 22:47 ` Jonathan Nieder
2010-10-12 13:50 ` [PATCH 4/7] fast-import: Allow cat requests at arbitrary points in stream David Barr
2010-10-12 22:50 ` Jonathan Nieder
2010-10-12 13:50 ` David Barr [this message]
2010-10-12 22:56 ` [PATCH 5/7] vcs-svn: extend svndump to parse version 3 format Jonathan Nieder
2010-10-12 13:50 ` [PATCH 6/7] vcs-svn: implement prop-delta handling David Barr
2010-10-12 22:59 ` Jonathan Nieder
2010-10-12 13:50 ` [PATCH 7/7] svn-fe: Use the --report-fd feature David Barr
2010-10-12 14:55 ` Sverre Rabbelier
2010-10-12 23:03 ` Jonathan Nieder
2010-10-12 23:11 ` Sverre Rabbelier
2010-10-12 23:36 ` Jonathan Nieder
2010-10-12 23:59 ` Jonathan Nieder
2010-10-13 2:24 ` [PATCH/RFC] Add support for subversion dump format v3 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1286891424-2067-6-git-send-email-david.barr@cordelta.com \
--to=david.barr@cordelta.com \
--cc=artagnon@gmail.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).