git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v7 10/16] vcs-svn: add fast_export_note to create notes

From
Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
Date
Aug 28, 2012, 08:49 UTC
Message-ID
<1346143790-23491-11-git-send-email-florian.achleitner.2.6.31@gmail.com>
In-Reply-To
<1346143790-23491-10-git-send-email-florian.achleitner.2.6.31@gmail.com>
From: Dmitry Ivankov <divanorama@gmail.com>

fast_export lacked a method to writes notes to fast-import stream. Add two new functions fast_export_note which is similar to fast_export_modify. And also add fast_export_buf_to_data to be able to write inline blobs that don't come from a line_buffer or from delta application.

To be used like this:
  fast_export_begin_commit("refs/notes/somenotes", ...)
  fast_export_note("refs/heads/master", "inline")
  fast_export_buf_to_data(&data)
or maybe
  fast_export_note("refs/heads/master", sha1)
Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 vcs-svn/fast_export.c |   12 ++++++++++++
 vcs-svn/fast_export.h |    2 ++
 2 files changed, 14 insertions(+)
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index 11f8f94..1ecae4b 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -68,6 +68,11 @@ void fast_export_modify(const char *path, uint32_t mode, const char *dataref)
 	putchar('\n');
 }
 
+void fast_export_note(const char *committish, const char *dataref)
+{
+	printf("N %s %s\n", dataref, committish);
+}
+
 static char gitsvnline[MAX_GITSVN_LINE_LEN];
 void fast_export_begin_commit(uint32_t revision, const char *author,
 			const struct strbuf *log,
@@ -222,6 +227,13 @@ static long apply_delta(off_t len, struct line_buffer *input,
 	return ret;
 }
 
+void fast_export_buf_to_data(const struct strbuf *data)
+{
+	printf("data %"PRIuMAX"\n", (uintmax_t)data->len);
+	fwrite(data->buf, data->len, 1, stdout);
+	fputc('\n', stdout);
+}
+
 void fast_export_data(uint32_t mode, off_t len, struct line_buffer *input)
 {
 	assert(len >= 0);
diff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h
index 17eb13b..9b32f1e 100644
--- a/vcs-svn/fast_export.h
+++ b/vcs-svn/fast_export.h
@@ -9,11 +9,13 @@ void fast_export_deinit(void);
 
 void fast_export_delete(const char *path);
 void fast_export_modify(const char *path, uint32_t mode, const char *dataref);
+void fast_export_note(const char *committish, const char *dataref);
 void fast_export_begin_commit(uint32_t revision, const char *author,
 			const struct strbuf *log, const char *uuid,
 			const char *url, unsigned long timestamp, const char *local_ref);
 void fast_export_end_commit(uint32_t revision);
 void fast_export_data(uint32_t mode, off_t len, struct line_buffer *input);
+void fast_export_buf_to_data(const struct strbuf *data);
 void fast_export_blob_delta(uint32_t mode,
 			uint32_t old_mode, const char *old_data,
 			off_t len, struct line_buffer *input);
-- 
1.7.9.5
Previous: Florian AchleitnerNext: Florian Achleitner
Message 11 of 26 in “GSOC remote-svn”
  1. 00/16 GSOC remote-svnFlorian Achleitner, Aug 28, 2012
  2. 01/16 Implement a remote helper for svn in CFlorian Achleitner, Aug 28, 2012
  3. 02/16 Add git-remote-testsvn to MakefileFlorian Achleitner, Aug 28, 2012
  4. 03/16 Add svndump_init_fd to allow reading dumps from arbitrary FDsFlorian Achleitner, Aug 28, 2012
  5. 04/16 Add argv_array_detach and argv_array_free_detachedFlorian Achleitner, Aug 28, 2012
  6. 05/16 Connect fast-import to the remote-helper via pipe, adding 'bidi-import' capabilityFlorian Achleitner, Aug 28, 2012
  7. 06/16 Add documentation for the 'bidi-import' capability of remote-helpersFlorian Achleitner, Aug 28, 2012
  8. 07/16 When debug==1, start fast-import with "--stats" instead of "--quiet"Florian Achleitner, Aug 28, 2012
  9. 08/16 remote-svn, vcs-svn: Enable fetching to private refsFlorian Achleitner, Aug 28, 2012
  10. 09/16 Allow reading svn dumps from files via file:// urlsFlorian Achleitner, Aug 28, 2012
  11. 10/16 vcs-svn: add fast_export_note to create notesFlorian Achleitner, Aug 28, 2012
  12. 11/16 Create a note for every imported commit containing svn metadataFlorian Achleitner, Aug 28, 2012
  13. 12/16 remote-svn: Activate import/export-marks for fast-importFlorian Achleitner, Aug 28, 2012
  14. 13/16 remote-svn: add incremental importFlorian Achleitner, Aug 28, 2012
  15. 14/16 Add a svnrdump-simulator replaying a dump file for testingFlorian Achleitner, Aug 28, 2012
  16. 15/16 remote-svn: add marks-file regenerationFlorian Achleitner, Aug 28, 2012
  17. 16/16 Add a test script for remote-svnFlorian Achleitner, Aug 28, 2012
  18. Junio C HamanoAug 28, 2012
  19. Junio C HamanoAug 28, 2012
  20. Junio C HamanoAug 28, 2012
  21. Junio C HamanoAug 28, 2012
  22. Junio C HamanoAug 28, 2012
  23. Junio C HamanoAug 28, 2012
  24. Junio C HamanoAug 28, 2012
  25. Junio C HamanoAug 28, 2012
  26. Florian AchleitnerAug 28, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.