git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Gabriel <g2p.code@gmail.com>
To: Sverre Rabbelier <srabbelier@gmail.com>
Cc: git@vger.kernel.org
Subject: Writing git remote helpers
Date: Fri, 19 Feb 2010 16:15:41 +0100	[thread overview]
Message-ID: <20100219161541.272c688f@gmail.com> (raw)
In-Reply-To: <fabb9a1e1002190538q4600f8c7kb8b2a6345ef3cc33@mail.gmail.com>

Sverre Rabbelier:
> Heya,
> 
> On Fri, Feb 19, 2010 at 13:52, Gabriel <g2p.code@gmail.com> wrote:
> > FWIW, I'm interested in that remote-vcs code, but never figured out
> > where it was published. TIA for pushing it.
> 
> The remote-helpers code is already in git.git, and has been since git
> 1.6.6 with some improvements now in 1.7.0.

Yes, good; I meant I haven't found example uses of that code. I'm aware
of work on a cvs helper and an hg helper. Users of the python library
would be extra convenient.

> > I'll be using it to better integrate fast-import based backup
> > scripts.
> 
> Do you mean that you'll write a remote helper to import your backups?
> If so then my code could be useful as a demonstration on how to hook
> up a fast-import stream.

I think so.

I'm using fast-import to break down a big json file into a tree, and
slurp the tree into git. I'm doing this read only. This gives me a
history of the file, compact, human-readable with git log, with an
incremental remote mirror.

I expect making it work with remote-helpers (I'll need to rebuild json
from the git input to also handle push, I don't know what else is
required) will give me convenient push-pull semantics and I'll be able
to sync that file across machines, taking advantage of git's merging
abilities.
I imagine this kind of sync use case would also work with something
like CouchDB or MongoDB, but git has a low barrier to entry for me, and
I'm not sure how well the others handle tree merging, that sometimes
requires human intervention, in a multi-master replication setup.

Speaking of remote-helpers requirements, besides the fast-import
stream, what else do I need? I imagine I'll do some book-keeping to
note when the current import was last modified (and avoid reimporting
it when unchanged), and the last hash that was pushed (and avoid
re-exporting it needlessly).

When pushing, how do I tell that the current push is a non
fast-forward? I can look for the hash of the json file in the history
of the pushed branch; if it isn't there I'll refuse the push. Do I keep
json hashes in log messages like git-svn does?
Or do I store a commit_id -> json hash mapping next to the json file?
Do I use git notes for that mapping? How do I index back from json hash
to matching commit to commits having the matching commit in their
ancestry?

When pulling, how do I tell there's nothing further to import? Same
approach as for push: look for the json hash in the history or in a
local mapping, import nothing if found?

Thinking about it some more, those two operations need a json_hash ->
commit_id lookup followed by a commit_id, commit_id -> bool DAG ancestry
test. Is that something the support library provides, or would welcome?

  reply	other threads:[~2010-02-19 15:16 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18 18:13 RFD: git-bzr: anyone interested? Gabriel Filion
2010-02-18 18:37 ` Sverre Rabbelier
2010-02-19  7:05   ` Gabriel Filion
2010-02-19  7:49     ` Sverre Rabbelier
2010-02-19 12:52       ` Gabriel
2010-02-19 13:38         ` Sverre Rabbelier
2010-02-19 15:15           ` Gabriel [this message]
2010-02-22  4:53       ` Gabriel Filion
2010-02-19 13:55     ` Ilari Liusvaara
2010-02-22  4:42       ` Gabriel Filion
2010-02-22 10:51         ` Ilari Liusvaara
2010-02-23  3:20           ` Gabriel Filion
2010-02-23 12:45             ` Ilari Liusvaara
2010-04-26 21:41               ` Chris Packham
2010-04-26 23:46                 ` Dmitrijs Ledkovs
2010-04-27  0:58                   ` Chris Packham
2010-04-27  2:10                   ` Miles Bader
2010-04-27  2:53                 ` Gabriel Filion
2010-04-27  8:47                   ` Dmitrijs Ledkovs
2010-04-27 17:00                     ` Chris Packham
2010-04-27 17:13                   ` Chris Packham
2010-04-27 23:22                     ` Dmitrijs Ledkovs
2010-08-06  7:19                 ` Conrad Parker
2010-08-07  3:36                   ` Miles Bader
2010-08-07  8:48                     ` Gabriel Filion
2010-08-07 13:37                       ` Miles Bader
2010-08-07 13:03                   ` git-archimport (was: Re: RFD: git-bzr: anyone interested?) Jakub Narebski
2010-08-07 13:11                     ` git-archimport Matthieu Moy
2010-02-20 13:58 ` RFD: git-bzr: anyone interested? Felipe Contreras
2010-02-22  2:43   ` Gabriel Filion

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=20100219161541.272c688f@gmail.com \
    --to=g2p.code@gmail.com \
    --cc=git@vger.kernel.org \
    --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.
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).