Why fork for stat?
[svn-fe.git] / fast_export.c
blobd6048064f9fef90026c907182444e8f60fdf5d1a
1 #include <string.h>
3 #include "fast_export.h"
4 #include "line_buffer.h"
5 #include "repo_tree.h"
6 #include "string_pool.h"
8 #define MAX_GITSVN_LINE_LEN 4096
10 void fast_export_delete(uint32_t depth, uint32_t * path)
12 putchar('D');
13 putchar(' ');
14 pool_print_seq(depth, path, '/', stdout);
15 putchar('\n');
18 void fast_export_modify(uint32_t depth, uint32_t * path, uint32_t mode,
19 uint32_t mark)
21 printf("M %06o :%d ", mode, mark);
22 pool_print_seq(depth, path, '/', stdout);
23 putchar('\n');
26 static char gitsvnline[MAX_GITSVN_LINE_LEN];
27 void fast_export_commit(uint32_t revision, char * author, char * log,
28 char * uuid, char * url, time_t timestamp)
30 printf("commit refs/heads/master\nmark :%d\n", revision);
31 printf("committer %s <%s@%s> %ld +0000\n",
32 author, author, uuid ? uuid : "local", timestamp);
33 if (uuid && url) {
34 snprintf(gitsvnline, MAX_GITSVN_LINE_LEN, "\n\ngit-svn-id: %s@%d %s\n",
35 url, revision, uuid);
36 } else {
37 *gitsvnline = '\0';
39 printf("data %ld\n%s%s\n",
40 strlen(log) + strlen(gitsvnline), log, gitsvnline);
41 repo_diff(revision - 1, revision);
42 fputc('\n', stdout);
44 printf("progress Imported commit %d.\n\n", revision);
47 void fast_export_blob(uint32_t mode, uint32_t mark, uint32_t len)
49 if (mode == REPO_MODE_LNK) {
50 /* svn symlink blobs start with "link " */
51 buffer_skip_bytes(5);
52 len -= 5;
54 printf("blob\nmark :%d\ndata %d\n", mark, len);
55 buffer_copy_bytes(len);
56 fputc('\n', stdout);