THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

53 lines
1.3 KiB

  1. /*
  2. * test-svn-fe: Code to exercise the svn import lib
  3. */
  4. #include "git-compat-util.h"
  5. #include "vcs-svn/svndump.h"
  6. #include "vcs-svn/svndiff.h"
  7. #include "vcs-svn/sliding_window.h"
  8. #include "vcs-svn/line_buffer.h"
  9. static const char test_svnfe_usage[] =
  10. "test-svn-fe (<dumpfile> | [-d] <preimage> <delta> <len>)";
  11. static int apply_delta(int argc, char *argv[])
  12. {
  13. struct line_buffer preimage = LINE_BUFFER_INIT;
  14. struct line_buffer delta = LINE_BUFFER_INIT;
  15. struct sliding_view preimage_view = SLIDING_VIEW_INIT(&preimage, -1);
  16. if (argc != 5)
  17. usage(test_svnfe_usage);
  18. if (buffer_init(&preimage, argv[2]))
  19. die_errno("cannot open preimage");
  20. if (buffer_init(&delta, argv[3]))
  21. die_errno("cannot open delta");
  22. if (svndiff0_apply(&delta, (off_t) strtoumax(argv[4], NULL, 0),
  23. &preimage_view, stdout))
  24. return 1;
  25. if (buffer_deinit(&preimage))
  26. die_errno("cannot close preimage");
  27. if (buffer_deinit(&delta))
  28. die_errno("cannot close delta");
  29. strbuf_release(&preimage_view.buf);
  30. return 0;
  31. }
  32. int main(int argc, char *argv[])
  33. {
  34. if (argc == 2) {
  35. if (svndump_init(argv[1]))
  36. return 1;
  37. svndump_read(NULL, "refs/heads/master", "refs/notes/svn/revs");
  38. svndump_deinit();
  39. svndump_reset();
  40. return 0;
  41. }
  42. if (argc >= 2 && !strcmp(argv[1], "-d"))
  43. return apply_delta(argc, argv);
  44. usage(test_svnfe_usage);
  45. }