Skip to content

Commit e605164

Browse files
jrngitster
authored andcommitted
Add a sample user for the svndump library
The svn-fe tool takes a Subversion dump file as input and produces a fast-import stream as output. This can be useful as a low-level tool in building other importers, or for debugging the vcs-svn library. make svn-fe make svn-fe.1 to test. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 53b3042 commit e605164

File tree

4 files changed

+147
-0
lines changed

4 files changed

+147
-0
lines changed

contrib/svn-fe/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*.xml
2+
/*.1
3+
/*.html

contrib/svn-fe/Makefile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
all:: svn-fe$X
2+
3+
CC = gcc
4+
RM = rm -f
5+
MV = mv
6+
7+
CFLAGS = -g -O2 -Wall
8+
LDFLAGS =
9+
ALL_CFLAGS = $(CFLAGS)
10+
ALL_LDFLAGS = $(LDFLAGS)
11+
EXTLIBS =
12+
13+
GIT_LIB = ../../libgit.a
14+
VCSSVN_LIB = ../../vcs-svn/lib.a
15+
LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
16+
17+
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
18+
QUIET_SUBDIR1 =
19+
20+
ifneq ($(findstring $(MAKEFLAGS),w),w)
21+
PRINT_DIR = --no-print-directory
22+
else # "make -w"
23+
NO_SUBDIR = :
24+
endif
25+
26+
ifneq ($(findstring $(MAKEFLAGS),s),s)
27+
ifndef V
28+
QUIET_CC = @echo ' ' CC $@;
29+
QUIET_LINK = @echo ' ' LINK $@;
30+
QUIET_SUBDIR0 = +@subdir=
31+
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
32+
$(MAKE) $(PRINT_DIR) -C $$subdir
33+
endif
34+
endif
35+
36+
svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
37+
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
38+
$(ALL_LDFLAGS) $(LIBS)
39+
40+
svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
41+
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
42+
43+
svn-fe.html: svn-fe.txt
44+
$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
45+
MAN_TXT=../contrib/svn-fe/svn-fe.txt \
46+
../contrib/svn-fe/$@
47+
48+
svn-fe.1: svn-fe.txt
49+
$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
50+
MAN_TXT=../contrib/svn-fe/svn-fe.txt \
51+
../contrib/svn-fe/$@
52+
$(MV) ../../Documentation/svn-fe.1 .
53+
54+
../../vcs-svn/lib.a: FORCE
55+
$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
56+
57+
../../libgit.a: FORCE
58+
$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
59+
60+
clean:
61+
$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
62+
63+
.PHONY: all clean FORCE

contrib/svn-fe/svn-fe.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* This file is in the public domain.
3+
* You may freely use, modify, distribute, and relicense it.
4+
*/
5+
6+
#include <stdlib.h>
7+
#include "vcs-svn/svndump.h"
8+
9+
int main(int argc, char **argv)
10+
{
11+
svndump_init(NULL);
12+
svndump_read((argc > 1) ? argv[1] : NULL);
13+
svndump_reset();
14+
return 0;
15+
}

contrib/svn-fe/svn-fe.txt

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
svn-fe(1)
2+
=========
3+
4+
NAME
5+
----
6+
svn-fe - convert an SVN "dumpfile" to a fast-import stream
7+
8+
SYNOPSIS
9+
--------
10+
svnadmin dump --incremental REPO | svn-fe [url] | git fast-import
11+
12+
DESCRIPTION
13+
-----------
14+
15+
Converts a Subversion dumpfile (version: 2) into input suitable for
16+
git-fast-import(1) and similar importers. REPO is a path to a
17+
Subversion repository mirrored on the local disk. Remote Subversion
18+
repositories can be mirrored on local disk using the `svnsync`
19+
command.
20+
21+
INPUT FORMAT
22+
------------
23+
Subversion's repository dump format is documented in full in
24+
`notes/dump-load-format.txt` from the Subversion source tree.
25+
Files in this format can be generated using the 'svnadmin dump' or
26+
'svk admin dump' command.
27+
28+
OUTPUT FORMAT
29+
-------------
30+
The fast-import format is documented by the git-fast-import(1)
31+
manual page.
32+
33+
NOTES
34+
-----
35+
Subversion dumps do not record a separate author and committer for
36+
each revision, nor a separate display name and email address for
37+
each author. Like git-svn(1), 'svn-fe' will use the name
38+
39+
---------
40+
user <user@UUID>
41+
---------
42+
43+
as committer, where 'user' is the value of the `svn:author` property
44+
and 'UUID' the repository's identifier.
45+
46+
To support incremental imports, 'svn-fe' will put a `git-svn-id`
47+
line at the end of each commit log message if passed an url on the
48+
command line. This line has the form `git-svn-id: URL@REVNO UUID`.
49+
50+
Empty directories and unknown properties are silently discarded.
51+
52+
The resulting repository will generally require further processing
53+
to put each project in its own repository and to separate the history
54+
of each branch. The 'git filter-branch --subdirectory-filter' command
55+
may be useful for this purpose.
56+
57+
BUGS
58+
----
59+
Litters the current working directory with .bin files for
60+
persistence. Will be fixed when the svn-fe infrastructure is aware of
61+
a Git working directory.
62+
63+
SEE ALSO
64+
--------
65+
git-svn(1), svn2git(1), svk(1), git-filter-branch(1), git-fast-import(1),
66+
https://svn.apache.org/repos/asf/subversion/trunk/notes/dump-load-format.txt

0 commit comments

Comments
 (0)