Re: tag sharing

Subject: Re: tag sharing

Date: Fri, 07 Oct 2011 07:36:30 -0400

To: David Bremner, Jameson Graef Rollins, Notmuch Mail

Cc:

From: Jesse Rosenthal


On Thu, 06 Oct 2011 11:18:51 -0300, David Bremner <david@tethera.net> wrote:
Non-text part: multipart/signed
> On Thu, 06 Oct 2011 09:21:48 -0400, Jesse Rosenthal <jrosenthal@jhu.edu> wrote:
> > morning's project. In retrospect, I think the main issue was that I was
> > trying to figure out how history would be kept. By using git, though,
> > your idea would be that we get history for free, right?
> 
> Yeah. Of course, one would have to decide if the history of the current
> dump file format is intelligible, or if some alternative format should
> be used.

I've managed to reconstruct a bit of my thinking. I think it could work
with the current format if we went as follows. I also think we could use
git, but I'm not sure that wouldn't be overkill. Some of the steps are
in extreme slow motion, just to make sure we're on the same page. (I've
also replaced the real msg-ids to cut down on noise).

  1. David dumps the targeted messages (tags in namespace "my"), so we
     get a file like this:
      
      msg-id-1@example.1 (my.foo inbox)
      msg-id-2@example.2 (answered my.to-do inbox signed)

  2. David strips out everything but tags in the namespace and removes
     the namespace:

      msg-id-1@example.1 (foo)
      msg-id-2@example.2 (to-do)

  3. David makes it available, Jesse pulls.

  4. Jesse dumps the namespace he has associated with David ("bremner"):

      msg-id-3@example.3 (bremner.bar)
      msg-id-4@example.4 (bremner.bar unread)
      msg-id-1@example.1 (bremner.foo inbox)
      msg-id-5@example.5 (bremner.wishlist inbox)

  5. Jesse strips the tags:

      msg-id-3@example.3 (bar)
      msg-id-4@example.4 (bar)
      msg-id-1@example.1 (foo)
      msg-id-5@example.5 (wishlist)

  6. Jesse replaces this list with David's:

      msg-id-1@example.1 (foo)
      msg-id-2@example.2 (to-do)

  7. Jesse removes all tags with the "bremner" namespace from his
     database.

  8. Jesse adds the tags from the list in step (6), with the appropriate
     namespace, to his list of tags. The messages of interest now look like:

      msg-id-3@example.3 ()
      msg-id-4@example.4 (unread)
      msg-id-1@example.1 (bremner.foo inbox)
      msg-id-5@example.5 (inbox)
      msg-id-2@example.2 (bremner.to-do someothertag)

  9. Jesse runs `notmuch restore`

The reason I went through this slowly is to highlight the fact that the
only thing that needs to be recorded in diffs somehow (in git, let's
say) are the files in steps (5) and (6). So if we integrated this with
git, there would be something along the lines of a commit (on Jesse's
computer) in step (5) and then another commit (again on Jesse's
computer) in step (6). 

Note that we don't actually need (5) to do tag-sharing. The only reason
it's there is for keeping history.

I'm pretty sure that we don't need a commit on David's computer in step
(1), because what the history would record is when the tag-sharing
utility changed your tags, not when you did.

Note also that all we would really be asking git to do here is keep an
ordered collection of diffs of a single file. Honest question: since
this is the barest possible form of version control, is git necessary?
Some of the features, like commit messages, don't seem to fit well with
this model; and others, like branching, seem pretty useless. What's the
value added over just keeping a (compressed?) collection of diffs for
each namespace?

Best,
Jesse

Thread: