summaryrefslogtreecommitdiff
path: root/vcs-svn/svndump.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-11-19 18:54:20 -0600
committerJunio C Hamano <gitster@pobox.com>2010-11-24 14:53:58 -0800
commit2a48afe1c256db6273a4ff99eaddc5c18dc46ffd (patch)
treeed00b57f7053feb50e32931c2b70780fc87a7c70 /vcs-svn/svndump.c
parent3f3e676d6e6c1d445181107770670368e0ad3160 (diff)
downloadgit-2a48afe1c256db6273a4ff99eaddc5c18dc46ffd.tar.gz
vcs-svn: Split off function for handling of individual properties
The handle_property function is the part of read_props that would be interesting for most people: semantics of properties rather than the algorithm for parsing them. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'vcs-svn/svndump.c')
-rw-r--r--vcs-svn/svndump.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index 153b0c337d..5de8dadcdd 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -30,7 +30,7 @@
/* Create memory pool for log messages */
obj_pool_gen(log, char, 4096)
-static char* log_copy(uint32_t length, char *log)
+static char *log_copy(uint32_t length, const char *log)
{
char *buffer;
log_free(log_pool.size);
@@ -115,6 +115,23 @@ static void init_keys(void)
keys.prop_delta = pool_intern("Prop-delta");
}
+static void handle_property(uint32_t key, const char *val, uint32_t len)
+{
+ if (key == keys.svn_log) {
+ /* Value length excludes terminating nul. */
+ rev_ctx.log = log_copy(len + 1, val);
+ } else if (key == keys.svn_author) {
+ rev_ctx.author = pool_intern(val);
+ } else if (key == keys.svn_date) {
+ if (parse_date_basic(val, &rev_ctx.timestamp, NULL))
+ fprintf(stderr, "Invalid timestamp: %s\n", val);
+ } else if (key == keys.svn_executable) {
+ node_ctx.type = REPO_MODE_EXE;
+ } else if (key == keys.svn_special) {
+ node_ctx.type = REPO_MODE_LNK;
+ }
+}
+
static void read_props(void)
{
uint32_t len;
@@ -129,19 +146,7 @@ static void read_props(void)
} else if (!strncmp(t, "V ", 2)) {
len = atoi(&t[2]);
val = buffer_read_string(len);
- if (key == keys.svn_log) {
- /* Value length excludes terminating nul. */
- rev_ctx.log = log_copy(len + 1, val);
- } else if (key == keys.svn_author) {
- rev_ctx.author = pool_intern(val);
- } else if (key == keys.svn_date) {
- if (parse_date_basic(val, &rev_ctx.timestamp, NULL))
- fprintf(stderr, "Invalid timestamp: %s\n", val);
- } else if (key == keys.svn_executable) {
- node_ctx.type = REPO_MODE_EXE;
- } else if (key == keys.svn_special) {
- node_ctx.type = REPO_MODE_LNK;
- }
+ handle_property(key, val, len);
key = ~0;
buffer_read_line();
}