[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Git mirror - bidrectional
From: |
Stephen J. Turnbull |
Subject: |
Re: Git mirror - bidrectional |
Date: |
Thu, 14 Jan 2010 01:52:37 +0900 |
Ken Raeburn writes:
> Does git have sufficient hooks to push back submitted changes to bzr
> in real time,
Probably. There have been some more or less feeble attempts to create
bound branches in git with the post-commit hook. That might be
usable. There is also a post-update hook for push (see "git help
receive-pack").
> and detect conflicts at that point,
Any conflicts in pushing to the bzr mainline will be detected by bzr,
before anything gets pushed to bzr. But to get to that point, the
merge needs to have succeeded in the git mirror.
> and report an error to the client without updating the git mirror
> (aside from maybe some new commits unreferenced by branch labels)?
I think that would you would need is two refs per branch, one public
and one for the use of the mirror only. Maybe even three (a public
read-only branch updated by the bzr->git process, a public write-only
branch whose only reader should be the git-bzr branch, and a private
ref used for locking as below). (Note that something like this
three-branch method is how git remotes are currently implemented. But
at this point I'm to tired to work out whether it would be an
improvement in any of the failure states.)
To update bzr, the git/bzr repo's post-update hook will
1. Use "git branch -m public private" to lock the branch. (Yes, we
want readers locked out too, or you have a rebase fiasco when the
bzr push fails.) Before doing this, it should be verified that
branch -m is atomic, but I can't imagine why the operation would
exist if somebody didn't need it to be atomic.
2. Tag the head.
3. Push your new commits from local workspace to private.
4. Push private to the bzr mainline with bzr.
5. Delete the tag.
6. Use "git branch -m private public" to unlock the branch.
If 4 fails, you recreate the public branch at the tag, delete the tag
and the private branch ref, and inform the user she lost. Now you
have to resync the git mirror with bzr.
If 3 fails, you need to update local and try again. First clean up by
recreating the public branch ref at the tag, delete the tag and
private branch ref.
If 1 fails, somebody else is updating, wait your turn.
2, 5, and 6 shouldn't fail unless git is buggy.
I think that should work, except that if 4 fails, resyncing to bzr
looks like it will need manual intervention. It might not be that bad
if everybody who wants to use one of these implements their own, but
running one as a public service would probably be hairy.
Re: Git mirror - bidrectional,
Stephen J. Turnbull <=
Re: Git mirror - bidrectional, Dan Nicolaescu, 2010/01/13