* [PATCH 8/8] Allow helpers to request marks for fast-import
@ 2009-08-09 19:28 Daniel Barkalow
2009-08-09 21:25 ` Johan Herland
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Barkalow @ 2009-08-09 19:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
From: Johan Herland <johan@herland.net>
The 'marks' capability is reported by the remote helper if it requires
the fast-import marks database to loaded/saved by any git-fast-import
process that is provided by the transport machinery. The feature is
advertised along with exactly one argument: the location of the file
containing the marks database.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
Documentation/git-remote-helpers.txt | 8 ++++++++
transport-helper.c | 15 +++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-remote-helpers.txt b/Documentation/git-remote-helpers.txt
index 2c5130f..9a3c5bc 100644
--- a/Documentation/git-remote-helpers.txt
+++ b/Documentation/git-remote-helpers.txt
@@ -67,6 +67,14 @@ CAPABILITIES
'import'::
This helper supports the 'import' command.
+'marks' filename::
+ Helper requires the marks from a git-fast-import run to be
+ loaded from, and saved to, the given filename. When this
+ "feature" is advertised, each git-fast-import run must load
+ and save the internal marks database (see the --import-marks
+ and --export-marks option to git-fast-import for more details)
+ located at the given filename.
+
REF LIST ATTRIBUTES
-------------------
diff --git a/transport-helper.c b/transport-helper.c
index 8134ff4..cc99368 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -10,6 +10,8 @@ struct helper_data
{
const char *name;
struct child_process *helper;
+
+ char *marks_filename;
unsigned fetch : 1;
unsigned import : 1;
};
@@ -53,6 +55,8 @@ static struct child_process *get_helper(struct transport *transport)
data->fetch = 1;
if (!strcmp(buf.buf, "import"))
data->import = 1;
+ if (!prefixcmp(buf.buf, "marks "))
+ data->marks_filename = xstrdup(buf.buf + 6);
}
return data->helper;
}
@@ -105,6 +109,15 @@ static int get_importer(struct transport *transport, struct child_process *fasti
fastimport->argv = xcalloc(5, sizeof(*fastimport->argv));
fastimport->argv[0] = "fast-import";
fastimport->argv[1] = "--quiet";
+ if (data->marks_filename) {
+ struct strbuf buf = STRBUF_INIT;
+ strbuf_addf(&buf, "--export-marks=%s", data->marks_filename);
+ fastimport->argv[2] = strbuf_detach(&buf, 0);
+ if (!access(data->marks_filename, R_OK)) {
+ strbuf_addf(&buf, "--import-marks=%s", data->marks_filename);
+ fastimport->argv[3] = strbuf_detach(&buf, 0);
+ }
+ }
fastimport->git_cmd = 1;
return start_command(fastimport);
@@ -133,6 +146,8 @@ static int fetch_with_import(struct transport *transport,
}
disconnect_helper(transport);
finish_command(&fastimport);
+ free((char *) fastimport.argv[2]);
+ free((char *) fastimport.argv[3]);
for (i = 0; i < nr_heads; i++) {
posn = to_fetch[i];
--
1.6.4.183.g77eb9.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 8/8] Allow helpers to request marks for fast-import
2009-08-09 19:28 [PATCH 8/8] Allow helpers to request marks for fast-import Daniel Barkalow
@ 2009-08-09 21:25 ` Johan Herland
2009-08-09 21:27 ` Sverre Rabbelier
0 siblings, 1 reply; 3+ messages in thread
From: Johan Herland @ 2009-08-09 21:25 UTC (permalink / raw)
To: git; +Cc: Daniel Barkalow, Junio C Hamano, Sverre Rabbelier,
Shawn O. Pearce
On Sunday 09 August 2009, Daniel Barkalow wrote:
> From: Johan Herland <johan@herland.net>
>
> The 'marks' capability is reported by the remote helper if it requires
> the fast-import marks database to loaded/saved by any git-fast-import
> process that is provided by the transport machinery. The feature is
> advertised along with exactly one argument: the location of the file
> containing the marks database.
>
> Signed-off-by: Johan Herland <johan@herland.net>
> Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Note that this patch can be dropped if Sverre Rabbelier's suggestion of
adding an "option" command to fast-import is accepted:
http://thread.gmane.org/gmane.comp.version-control.git/124655
In that case, the CVS helper (or any other helper) can use the "option"
fast-import command instead of having to tell transport-helper.c to invoke
fast-import appropriately. Seems like a somewhat cleaner solution to me...
Have fun!
...Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 8/8] Allow helpers to request marks for fast-import
2009-08-09 21:25 ` Johan Herland
@ 2009-08-09 21:27 ` Sverre Rabbelier
0 siblings, 0 replies; 3+ messages in thread
From: Sverre Rabbelier @ 2009-08-09 21:27 UTC (permalink / raw)
To: Johan Herland; +Cc: git, Daniel Barkalow, Junio C Hamano, Shawn O. Pearce
Heya,
On Sun, Aug 9, 2009 at 14:25, Johan Herland<johan@herland.net> wrote:
> In that case, the CVS helper (or any other helper) can use the "option"
> fast-import command instead of having to tell transport-helper.c to invoke
> fast-import appropriately. Seems like a somewhat cleaner solution to me...
Ah, another use case! I guess I'll go clean up my series and resend it then ;).
--
Cheers,
Sverre Rabbelier
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-09 21:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-09 19:28 [PATCH 8/8] Allow helpers to request marks for fast-import Daniel Barkalow
2009-08-09 21:25 ` Johan Herland
2009-08-09 21:27 ` Sverre Rabbelier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox