[darcs-users] Feedback on hunk splitting with Darcs 2.4 beta 1

Eric Kow kowey at darcs.net
Sat Jan 16 20:31:47 UTC 2010


On Sat, Jan 16, 2010 at 15:05:22 -0500, Isaac Dupree wrote:
> ...so this is how it works: ? It's basically just like how I would
> go and manually edit the file in between darcs-records, except
> possibly less of a nuisance.

That's a good way of putting it.

It is indeed a useful insight that you should be thinking of each
section as a different version of the file, and not the patch.

One key point, however, is that hunk editor has no effect on your
working directory.  This comes thanks to the principle that the patch
sequence that results from hunk editing is equivalent to the original
patch.  This is also why the initial and final states of the file will
always be those from your original patch, or rather why the hunk editor
will dis-regard any attempts to modify those states.

> (So, not intrisically intuitive or
> quick, but something I've learned to do already that lets me control
> my darcs-patches.)  Does it allow to split into more than this
> number of patches?

No and yes.  No you cannot add new separators (yet).  For now, if you
want to split it into multiple patches, you're best off using the hunk
editor multiple times:
  split h0 into h0' + h1
  split h1 into h1' + h2,
  etc

Yes, indirectly, in that because you are really (in effect) editing
some intermediate representation of a file, if you happen to separate
some stuff out with blank lines, Darcs will propose each of these
paragraphs separately.  That's not because of the hunk editor; it's
just what Darcs naturally does when you record patches anyway.

> (basically, can you add new "===" lines for more
> sections in between?)
> I vote "yes" on the last question, if I'm understanding correctly.
> In fact, couldn't it start out as simply,

It depends on what you're asking for!  If you really do accept that
each section represents different versions of the file being edited,
then we could do this in principle.

The cost is that the sections would contain a bit of duplicate
information.

Suppose you wanted to split this hunk into its 4 constituent
modifications:

 -a
 +a2
 +b2
 +c2

How this would work in your proposal is something like this:

JUST A SINGLE PASS:

   === REFERENCE OLD STATE, do not edit --v ========
   a
   === PATCH here between this state --^ and that state --v ==
   === PATCH here between this state --^ and that state --v ==
   a2
   === PATCH here between this state --^ and that state --v ==
   a2
   b2
   === PATCH here between this state --^ and that state --v ==
   a2
   b2
   c2
   === (REFERENCE NEW STATE ABOVE, do not edit --^
   
Note the duplication above...

In the current proposal, it would be similar, but you'd just be making
three (?) passes with the hunk editor.

> Of course this would take some explaining that we'd have to figure
> out -- especially to newbies.  But, tell me, have *I* gotten the
> idea correctly?

I *think* you've got it :-), and I certainly like that we're moving in
the direction of not trying to number the intermediate patches...

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100116/bdad27bc/attachment.pgp>


More information about the darcs-users mailing list