diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2011-05-26 02:27:48 -0500 |
---|---|---|
committer | Jonathan Nieder <jrnieder@gmail.com> | 2011-05-26 02:27:48 -0500 |
commit | e9f3f8b6f4141dae526e9792ba6dede7aa038622 (patch) | |
tree | e4d1b8abaaef180f844b1d0f57afbc87e4c4f677 /test-svn-fe.c | |
parent | Merge branch 'db/svn-fe-code-purge' into svn-fe (diff) | |
parent | vcs-svn: let deltas use data from preimage (diff) | |
download | tgif-e9f3f8b6f4141dae526e9792ba6dede7aa038622.tar.xz |
Merge branch 'db/delta-applier' into db/text-delta
* db/delta-applier:
vcs-svn: let deltas use data from preimage
vcs-svn: let deltas use data from postimage
vcs-svn: verify that deltas consume all inline data
vcs-svn: implement copyfrom_data delta instruction
vcs-svn: read instructions from deltas
vcs-svn: read inline data from deltas
vcs-svn: read the preimage when applying deltas
vcs-svn: parse svndiff0 window header
vcs-svn: skeleton of an svn delta parser
vcs-svn: make buffer_read_binary API more convenient
vcs-svn: learn to maintain a sliding view of a file
Makefile: list one vcs-svn/xdiff object or header per line
Conflicts:
Makefile
vcs-svn/LICENSE
Diffstat (limited to 'test-svn-fe.c')
-rw-r--r-- | test-svn-fe.c | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/test-svn-fe.c b/test-svn-fe.c index b42ba789b1..66bd04022d 100644 --- a/test-svn-fe.c +++ b/test-svn-fe.c @@ -4,15 +4,41 @@ #include "git-compat-util.h" #include "vcs-svn/svndump.h" +#include "vcs-svn/svndiff.h" +#include "vcs-svn/sliding_window.h" +#include "vcs-svn/line_buffer.h" int main(int argc, char *argv[]) { - if (argc != 2) - usage("test-svn-fe <file>"); - if (svndump_init(argv[1])) - return 1; - svndump_read(NULL); - svndump_deinit(); - svndump_reset(); - return 0; + static const char test_svnfe_usage[] = + "test-svn-fe (<dumpfile> | [-d] <preimage> <delta> <len>)"; + if (argc == 2) { + if (svndump_init(argv[1])) + return 1; + svndump_read(NULL); + svndump_deinit(); + svndump_reset(); + return 0; + } + if (argc == 5 && !strcmp(argv[1], "-d")) { + struct line_buffer preimage = LINE_BUFFER_INIT; + struct line_buffer delta = LINE_BUFFER_INIT; + struct sliding_view preimage_view = SLIDING_VIEW_INIT(&preimage); + if (buffer_init(&preimage, argv[2])) + die_errno("cannot open preimage"); + if (buffer_init(&delta, argv[3])) + die_errno("cannot open delta"); + if (svndiff0_apply(&delta, (off_t) strtoull(argv[4], NULL, 0), + &preimage_view, stdout)) + return 1; + if (buffer_deinit(&preimage)) + die_errno("cannot close preimage"); + if (buffer_deinit(&delta)) + die_errno("cannot close delta"); + buffer_reset(&preimage); + strbuf_release(&preimage_view.buf); + buffer_reset(&delta); + return 0; + } + usage(test_svnfe_usage); } |