Given the discussion in the other thread(s), I have been thinking about
pull requests. (I've also had a beer. You Have Been Warned.)

I rather like the pull request workflow from github and Bazaar, and it's
something that I rather miss from Fossil. However, given Fossil's
different philosophy, I think the workflow needs to be modified. So what
I'm proposing works like this:

We have a maintainer M and a contributor C. C does not have checkin
privileges to M's repository.

1) C clones M's repository.
2) C does some work in multiple checkins.
3) C points the Magic Pull Request tool at a commit. This spits out a
bundle containing everything that's needed to add that commit (and its
ancestors) to M's repository.
4) C sends the bundle to M.
5) M adds the bundle to their repository (or a clone of their
repository). All of C's changes end up in a private branch.
6) M examines the changes, and either rejects them or merges them into
trunk.

Key point: all of C's branch and tag information is discarded --- M
wants all of C's changes to end up in a *single* branch, so they're all
safely isolated. This means that M doesn't have to worry about
conflicting tag names. If C does branching and merging before the bundle
is created then they'll all show up as anonymous ad-hoc branches in M's
import branch.

None of this actually looks very hard. The trickiest part is step 3.
Exporting the bundle is easy --- the git exporter is only 400 loc.
Calculating what goes into the bundle is the only bit of interest, and
even that's pretty straightforward:

a) construct set of all ancestor commits from the nominated one
b) subtract all commits in M's repository
c) export commits remaining

Pulling the commit graph from a local .fossil file looks pretty
straightforward --- experimentation gives me this:

SELECT parent.uuid, child.uuid
FROM plink, blob AS parent, blob AS child
WHERE child.rid = plink.cid AND parent.rid = plink.pid;

(That seems way too easy, so I'm sure there's something I'm missing.)

However, M's repository is *remote*, so I don't have direct access to
its database. What's the easiest way to get the same information from a
remote repository? It doesn't matter if it's hacky; I'd like to put
together a proof-of-concept...

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "Blue is beautiful... blue is best...
│ I'm blue! I'm beautiful! I'm best!"
│ --- _Dougal and the Blue Cat_

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to