From: Jonathan Nieder Date: Fri, 10 Dec 2010 10:27:16 GMT Subject: [PATCH 07/10] vcs-svn: split off function to make 'ls' requests Message-ID: <20101210102716.GG26331@burratino> In-Reply-To: <20101210102007.GA26298@burratino> Signed-off-by: Jonathan Nieder --- ls_from_rev will survive; cat_from_rev will not. vcs-svn/fast_export.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c index cca9810..6a4a689 100644 --- a/vcs-svn/fast_export.c +++ b/vcs-svn/fast_export.c @@ -80,6 +80,15 @@ void fast_export_commit(uint32_t revision, uint32_t author, char *log, printf("progress Imported commit %"PRIu32".\n\n", revision); } +static void ls_from_rev(uint32_t rev, const uint32_t *path) +{ + /* ls :5 "path/to/old/file" */ + printf("ls :%"PRIu32" \"", rev); + pool_print_seq(REPO_MAX_PATH_DEPTH, path, '/', stdout); + printf("\"\n"); + fflush(stdout); +} + static int ends_with(const char *s, size_t len, const char *suffix) { const size_t suffixlen = strlen(suffix); @@ -150,12 +159,7 @@ static off_t cat_from_rev(uint32_t rev, const uint32_t *path) off_t length = length; struct strbuf blob_name = STRBUF_INIT; - /* ls :5 "path/to/old/file" */ - printf("ls :%"PRIu32" \"", rev); - pool_print_seq(REPO_MAX_PATH_DEPTH, path, '/', stdout); - printf("\"\n"); - fflush(stdout); - + ls_from_rev(rev, path); response = get_response_line(); if (parse_ls_response_line(response, &blob_name)) die("invalid ls response: %s", response); -- 1.7.2.4