git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Tomas Carnecky <tom@dbservice.com>
Cc: git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	David Barr <david.barr@cordelta.com>, Sam Vilain <sam@vilain.net>,
	Stephen Bash <bash@genarts.com>
Subject: fast-import tweaks for remote helpers (Re: Status of the svn remote helper project (Dec 2010, #1))
Date: Sun, 12 Dec 2010 00:14:37 -0600	[thread overview]
Message-ID: <20101212061437.GA17185@burratino> (raw)
In-Reply-To: <4CFFCDCD.9060602@dbservice.com>

Tomas Carnecky wrote:

> I simplified the code and the requirements on fast-import are much
> lighter now. All I need is a way to tell fast-import to stop writing
> refs and after each commit write its sha1 to stdout.

That's good to hear.  What should be the syntax for asking fast-import
not to write to a ref?  Something like this?

	commit
	mark :1
	committer c o mitter <committer@example.com> now
	data <<END
	...

Writing the sha1 as each commit is written: how early does the
frontend need access to the sha1?  Would a facility to report marks
back to the frontend at the end of the stream take care of it?

Based on [1] I guess the main need is some way for fast-import to
tell the transport machinery what refs the transport machinery
should update (or at least ought to report as updated).  A hackish
way might be to make the remote helper send "progress" commands
with that information.

> It's possible to
> to modify fast-import.c with a small patch to make it behave like
> that. However, I haven't followed the svn remote helper that much
> lately so I don't know whether one of the other patches already
> modifies fast-import in this way.

No, the patches have mostly been adding commands that send information
back to the frontend.

 cat-blob (<dataref> | <mark>):
	Sends back an old blob along with its length (in
	cat-file --batch format).  svn-fe uses this to acquire
	the preimage when applying deltas.

 ls <quoted-path>:
	Sends back information about the current state of a path
	in the commit being prepared (as a single line in ls-tree
	format).  svn-fe uses this to move around files and to find
	a <dataref> to use with cat-blob when applying deltas.

 ls (<dataref> | <mark>) <path>:
	Sends back information about a path in a previous revision
	(tag, commit, or tree), in ls-tree format.

 M 040000 (<dataref> | <mark>) <path>:
	Like "M 100644 <dataref> <path>", replaces an entry in the
	active commit with content of the frontend's choice.  This
	gets used to copy in old directories.

> From the beginning my code was meant to be just an example how the
> interaction between git and the svn remote helper could look like.

It makes a nice demo, too. :)

> For example I save the svn rev <-> sha1 mapping in notes, which is
> appears to work well. I'll take a look if I'll be able to use the
> svn-fe in my script.

svn-fe needs a fast mapping svn rev -> sha1; it currently uses a marks
file for that.  (In the back of my mind, I have the idea of using a
file that allows O(1) access, perhaps of the form

	<commit name for rev 1> NL
	<commit name for rev 2> NL
	...

but as Ram has noted, keeping the whole table in memory is pretty
cheap already.)  A remote helper needs a fast mapping sha1 -> svn rev,
and imho notes are ideal for that[2].

The way I imagine it, the authoritative mapping is in notes and the
reverse mapping (e.g. in a marks file) is rebuilt when needed.

[1] remote-helper branch at git://github.com/wereHamster/git.git
[2] Why?  When a project switches from one svn server to another,
revision numbers tend to change, so revision numbers are not permanent
enough to belong in the commit message imho.  (If only git-notes had
existed when git svn was written...)

  reply	other threads:[~2010-12-12  6:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-07 11:21 Status of the svn remote helper project (Nov, 2010) Jonathan Nieder
2010-11-07 12:06 ` David Michael Barr
2010-11-08  3:56   ` David Barr
2010-11-08  6:11     ` Jonathan Nieder
2010-11-08  6:20       ` David Barr
2010-11-07 12:50 ` Ramkumar Ramachandra
2010-11-07 17:42   ` Jonathan Nieder
2010-11-21  6:31 ` Status of the svn remote helper project (Nov 2010, #2) Jonathan Nieder
2010-11-21  9:38   ` David Michael Barr
2010-11-21 23:06     ` Jonathan Nieder
2010-11-22  2:06       ` David Barr
2010-12-05 11:37   ` Status of the svn remote helper project (Dec 2010, #1) Jonathan Nieder
2010-12-08 18:26     ` Tomas Carnecky
2010-12-12  6:14       ` Jonathan Nieder [this message]
2010-12-12  9:53         ` fast-import tweaks for remote helpers (Re: Status of the svn remote helper project (Dec 2010, #1)) Sam Vilain
2010-12-12 17:16           ` fast-import tweaks for remote helpers Jonathan Nieder
2011-01-05 21:20             ` fast-import --report-fd (Re: fast-import tweaks for remote helpers) Jonathan Nieder
2011-01-05 23:39     ` Status of the svn remote helper project (Jan 2011, #1) Jonathan Nieder
2011-01-07 14:00       ` David Michael Barr
2011-02-11  9:09       ` Plans for the vcs-svn-pu branch Jonathan Nieder
2011-02-11 10:36         ` [PATCH] svn-fe: warn about experimental status Jonathan Nieder
2011-02-11 15:49         ` Plans for the vcs-svn-pu branch Ramkumar Ramachandra

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20101212061437.GA17185@burratino \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=bash@genarts.com \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=sam@vilain.net \
    --cc=srabbelier@gmail.com \
    --cc=tom@dbservice.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).