Skip to content

Commit 271fd1f

Browse files
flyingflogitster
authored andcommitted
remote-svn, vcs-svn: Enable fetching to private refs
The reference to update by the fast-import stream is hard-coded. When fetching from a remote the remote-helper shall update refs in a private namespace, i.e. a private subdir of refs/. This namespace is defined by the 'refspec' capability, that the remote-helper advertises as a reply to the 'capabilities' command. Extend svndump and fast-export to allow passing the target ref. Update svn-fe to be compatible. Signed-off-by: Florian Achleitner <[email protected]> Acked-by: David Michael Barr <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 19ba02a commit 271fd1f

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

contrib/svn-fe/svn-fe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int main(int argc, char **argv)
1010
{
1111
if (svndump_init(NULL))
1212
return 1;
13-
svndump_read((argc > 1) ? argv[1] : NULL);
13+
svndump_read((argc > 1) ? argv[1] : NULL, "refs/heads/master");
1414
svndump_deinit();
1515
svndump_reset();
1616
return 0;

test-svn-fe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int main(int argc, char *argv[])
4040
if (argc == 2) {
4141
if (svndump_init(argv[1]))
4242
return 1;
43-
svndump_read(NULL);
43+
svndump_read(NULL, "refs/heads/master");
4444
svndump_deinit();
4545
svndump_reset();
4646
return 0;

vcs-svn/fast_export.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static char gitsvnline[MAX_GITSVN_LINE_LEN];
7272
void fast_export_begin_commit(uint32_t revision, const char *author,
7373
const struct strbuf *log,
7474
const char *uuid, const char *url,
75-
unsigned long timestamp)
75+
unsigned long timestamp, const char *local_ref)
7676
{
7777
static const struct strbuf empty = STRBUF_INIT;
7878
if (!log)
@@ -84,7 +84,7 @@ void fast_export_begin_commit(uint32_t revision, const char *author,
8484
} else {
8585
*gitsvnline = '\0';
8686
}
87-
printf("commit refs/heads/master\n");
87+
printf("commit %s\n", local_ref);
8888
printf("mark :%"PRIu32"\n", revision);
8989
printf("committer %s <%s@%s> %ld +0000\n",
9090
*author ? author : "nobody",

vcs-svn/fast_export.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void fast_export_delete(const char *path);
1111
void fast_export_modify(const char *path, uint32_t mode, const char *dataref);
1212
void fast_export_begin_commit(uint32_t revision, const char *author,
1313
const struct strbuf *log, const char *uuid,
14-
const char *url, unsigned long timestamp);
14+
const char *url, unsigned long timestamp, const char *local_ref);
1515
void fast_export_end_commit(uint32_t revision);
1616
void fast_export_data(uint32_t mode, off_t len, struct line_buffer *input);
1717
void fast_export_blob_delta(uint32_t mode,

vcs-svn/svndump.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,13 @@ static void handle_node(void)
299299
node_ctx.text_length, &input);
300300
}
301301

302-
static void begin_revision(void)
302+
static void begin_revision(const char *remote_ref)
303303
{
304304
if (!rev_ctx.revision) /* revision 0 gets no git commit. */
305305
return;
306306
fast_export_begin_commit(rev_ctx.revision, rev_ctx.author.buf,
307307
&rev_ctx.log, dump_ctx.uuid.buf, dump_ctx.url.buf,
308-
rev_ctx.timestamp);
308+
rev_ctx.timestamp, remote_ref);
309309
}
310310

311311
static void end_revision(void)
@@ -314,7 +314,7 @@ static void end_revision(void)
314314
fast_export_end_commit(rev_ctx.revision);
315315
}
316316

317-
void svndump_read(const char *url)
317+
void svndump_read(const char *url, const char *local_ref)
318318
{
319319
char *val;
320320
char *t;
@@ -353,7 +353,7 @@ void svndump_read(const char *url)
353353
if (active_ctx == NODE_CTX)
354354
handle_node();
355355
if (active_ctx == REV_CTX)
356-
begin_revision();
356+
begin_revision(local_ref);
357357
if (active_ctx != DUMP_CTX)
358358
end_revision();
359359
active_ctx = REV_CTX;
@@ -366,7 +366,7 @@ void svndump_read(const char *url)
366366
if (active_ctx == NODE_CTX)
367367
handle_node();
368368
if (active_ctx == REV_CTX)
369-
begin_revision();
369+
begin_revision(local_ref);
370370
active_ctx = NODE_CTX;
371371
reset_node_ctx(val);
372372
break;
@@ -463,7 +463,7 @@ void svndump_read(const char *url)
463463
if (active_ctx == NODE_CTX)
464464
handle_node();
465465
if (active_ctx == REV_CTX)
466-
begin_revision();
466+
begin_revision(local_ref);
467467
if (active_ctx != DUMP_CTX)
468468
end_revision();
469469
}

vcs-svn/svndump.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
int svndump_init(const char *filename);
55
int svndump_init_fd(int in_fd, int back_fd);
6-
void svndump_read(const char *url);
6+
void svndump_read(const char *url, const char *local_ref);
77
void svndump_deinit(void);
88
void svndump_reset(void);
99

0 commit comments

Comments
 (0)