All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: David Barr <david.barr@cordelta.com>,
	Git Mailing List <git@vger.kernel.org>,
	Sverre Rabbelier <srabbelier@gmail.com>
Subject: Re: [PATCH 5/5] svn-fe: Use the cat-blob command to apply deltas
Date: Mon, 18 Oct 2010 17:48:28 +0530	[thread overview]
Message-ID: <20101018121822.GG22376@kytes> (raw)
In-Reply-To: <20101018092418.GB5425@burratino>

Hi Jonathan,

Jonathan Nieder writes:
> Ramkumar Ramachandra wrote:
> > David Barr writes:
> 
> >> +	if (!backchannel.infile)
> >> +		backchannel.infile = fdopen(REPORT_FILENO, "r");
> >> +	if (!backchannel.infile)
> >> +		return error("Could not open backchannel fd: %d", REPORT_FILENO);
> >
> > REPORT_FILENO = 3 is hard-coded. Is this intended? Maybe a
> > command-line option to specify the fd?
> 
> fast-import gets the --cat-file-fd parameter to choose between stdout,
> stdin-as-socket, stderr, or another fd (not necessarily 3 because it
> might have to compete with other similar features some day).
> 
> For svn-fe, it is just like another stdin.  stdin is always fd 0,
> so...
> 
> For callers other than svn-fe, it would be especially useful to
> make it configurable, yes.

Right, got it.

> >> +	tail = buffer_read_line(&backchannel);
> >> +	if (!tail)
> >> +		return 1;
> >
> > Could you clarify when exactly will this happen?
> 
> buffer_read_line() returns NULL on error and when data is exhausted
> without the trailing newline appearing.  The input here is supposed to
> be just a single newline (trimmed to an empty string).

Thanks for the clarification.

> >> +	long preimage_len = 0;
> >> +
> >> +	if (delta) {
> >> +		if (!preimage.infile)
> >> +			preimage.infile = tmpfile();
> >
> > Didn't you later decide against this and use one tmpfile instead?
> 
> This is a single tempfile (because static).  Or am I missing
> something?

Er, sorry about that. When I saw this code, it immediately reminded me
of one of David's commits that used several temporary files- a later
one made it a global variable. I didn't notice the static here.

> >> +		if (!preimage.infile)
> >> +			die("Unable to open temp file for blob retrieval");
> >> +		if (srcMark) {
> >> +			printf("cat-blob :%"PRIu32"\n", srcMark);
> >> +			fflush(stdout);
> >> +			if (srcMode == REPO_MODE_LNK)
> >> +				fwrite("link ", 1, 5, preimage.infile);
> >
> > Special handling for symbolic links. Perhaps you should mention it in
> > a comment here?
> 
> Or better yet, a comment in the commit message. :)

*nod*

> >> +			if (fast_export_save_blob(preimage.infile))
> >> +				die("Failed to retrieve blob for delta application");
> >> +		}
> >> +		preimage_len = ftell(preimage.infile);
> >> +		fseek(preimage.infile, 0, SEEK_SET);
> >> +		if (!postimage.infile)
> >> +			postimage.infile = tmpfile();
> >
> > One tmpfile?
> 
> Do you mean letting the preimage and postimage share a file?

No :)

> [...]
> >>  	printf("blob\nmark :%"PRIu32"\ndata %"PRIu32"\n", mark, len);
> >> -	buffer_copy_bytes(input, stdout, len);
> >> +	if (!delta)
> >> +		buffer_copy_bytes(input, stdout, len);
> >> +	else
> >> +		buffer_copy_bytes(&postimage, stdout, len);
> >>  	fputc('\n', stdout);
> >
> > I should have asked this a long time ago: why the extra newline?
> 
> From the fast-import manual:
> 
> 	The LF after <raw> is optional (it used to be required)
> 	but recommended. Always including it makes debugging a
> 	fast-import stream easier as the next command always
> 	starts in column 0 of the next line, even if <raw> did
> 	not end with an LF.

Thanks for the explanation. I really should have looked this up
earlier, but I suppose it's not a biggie.

-- Ram

  reply	other threads:[~2010-10-18 12:20 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-15 12:54 [PATCHv2] Add support for subversion dump format v3 David Barr
2010-10-15 12:54 ` [PATCH 1/5] fast-import: Let importers retrieve blobs David Barr
2010-10-18  7:36   ` Ramkumar Ramachandra
2010-10-18  8:50     ` Jonathan Nieder
2010-10-18  8:26   ` Jonathan Nieder
     [not found]   ` <20101119093530.GA19061@burratino>
2010-11-19  9:47     ` [PATCH 3/4] fast-import: let " Jonathan Nieder
2010-11-19  9:51     ` [PATCH 4/4] fast-import: Allow cat-blob requests at arbitrary points in stream Jonathan Nieder
     [not found]     ` <20101119094045.GC19061@burratino>
2010-11-19 11:58       ` [PATCH 2/4] fast-import: clarify documentation of "feature" command Sverre Rabbelier
2010-11-28 19:41   ` [PATCH/RFC v3 resend 0/4] fast-import: Let importers retrieve blobs Jonathan Nieder
2010-11-28 19:42     ` [PATCH 1/4] fast-import: stricter parsing of integer options Jonathan Nieder
2010-11-30  1:01       ` Junio C Hamano
2010-11-28 19:43     ` [PATCH 2/4] fast-import: clarify documentation of "feature" command Jonathan Nieder
2010-11-28 19:45     ` [PATCH 3/4] fast-import: let importers retrieve blobs Jonathan Nieder
2010-11-29 23:48       ` [PATCH] fixup! " David Barr
2010-11-30  0:16         ` David Barr
2010-11-30  1:22         ` Jonathan Nieder
2010-12-03 10:30       ` [PATCH 3/4] " Thomas Rast
2010-12-03 19:06         ` Jonathan Nieder
2010-12-03 20:17         ` Junio C Hamano
2010-12-03 20:26           ` Jonathan Nieder
2010-12-04 13:24         ` Thomas Rast
2010-12-04  2:35       ` Jonathan Nieder
2011-01-16  2:16       ` [PATCH] Documentation/fast-import: capitalize beginning of sentence Jonathan Nieder
2010-11-28 19:45     ` [PATCH 4/4] fast-import: Allow cat-blob requests at arbitrary points in stream Jonathan Nieder
2010-10-15 12:54 ` [PATCH 2/5] vcs-svn: Extend svndump to parse version 3 format David Barr
2010-10-15 12:54 ` [PATCH 3/5] vcs-svn: Implement prop-delta handling David Barr
2010-10-18 15:10   ` Ramkumar Ramachandra
2010-10-15 12:54 ` [PATCH 4/5] vcs-svn: Add outfile option to buffer_copy_bytes() David Barr
2010-10-18  8:59   ` Jonathan Nieder
2010-10-15 12:54 ` [PATCH 5/5] svn-fe: Use the cat-blob command to apply deltas David Barr
2010-10-18  6:57   ` Ramkumar Ramachandra
2010-10-18  9:24     ` Jonathan Nieder
2010-10-18 12:18       ` Ramkumar Ramachandra [this message]
2010-10-18  9:54 ` [PATCHv2] Add support for subversion dump format v3 Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101018121822.GG22376@kytes \
    --to=artagnon@gmail.com \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=srabbelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.