[darcs-users] hunk editing

Eric Kow kowey at darcs.net
Sat Sep 26 06:02:41 UTC 2009


Hi darcs users,

On Sat, Sep 19, 2009 at 22:01:51 +0100, Ganesh Sittampalam wrote:
> I'd like to encourage everyone interested to try out the hunk editing  
> patches I posted and comment on the usability of the feature.

Just thought I should make some more noise about this.  Hunk editing
is now in the Darcs darcs repository and it's already making my life
as a Darcs user better!

  darcs get --lazy http://darcs.net

> I have also started a wiki page for explaining/discussing the design 
> here: http://wiki.darcs.net/Review/HunkEditing - please feel free to add 
> your comments or questions there, or in this email thread.

Time for a UI discussion.  See the page above for details.

Basic principle
---------------
The number one thing to keep in mind is that under the hood, we replace
a patch by a sequence of patches that does the *exact same thing* as the
original.  This may be unintuitive for editing patches (because we will
offer you a patch that seems to undo your changes), but it's hard for me
to see how to implement this otherwise.  I think we can do some
commutation to make life easier, though.

Current UI
----------
This is a slightly "idealised" representation of the current UI

  Interactive hunk edit: 
   - Edit the first set of lines to insert a new change before the
     current one. 
   - Edit the second set of lines to insert a new change after the
     current one.
  ==== Before
  l1
  l2
  ==== After
  new l1
  new l2
  new l3
  ====

A plus and minus centric proposal
---------------------------------
For what it's worth, what I was thinking about was something like this:

1. Help text is good.

2. Display the original patch in some ignored area

   hunk editing place
   -- everything below ignored ---
   Original patch:
   - foo
   - bar
   + baz

3. As suggested in the review page, do NOT offer (after2, after)
   to user.

4. Attempt to commute (after2, after) to the end by making it last. If
   you cannot do this then refuse the modifications with a friendly
   explanation.

5. Apply the inverse of (after2, after) to the working directory.

6. Let users edit minuses and plusses.  I think I want to be able to
   take

   - r1
   - r2 
   - r3
   + a1
   + a2

   and turn it into

   - r1
   + a1-plus-changes
   + a1-oh I forgot this

   - r2
   + a2

   - r3

   whereby the hunk editor/splitter recognises I want to turn this into
   three hunk patches and implicitly tack on a fourth

   - a1-plus-changes
   - a1-oh I forgo this
   + a1

   to bring us back to square one, but then commute that to the end...

7. Reject nonsense edits such as removing lines that don't exist.

Note that I'm not sure if what I'm asking is necessarily possible.
We'll have to keep these three things in mind as we discuss the UI for
hunk editing: (a) it's got to be something that Darcs can do safely and
(b) there are many use cases we may not have considered and (c) ideally,
at the end of the day, this should retain that simple mental model magic
behind the Darcs UI.

Anyway, this sounds like a great chance for Darcs users to shape their
near future UI.  Have fun!

PS. I think it would help if should somebody could cook up a nice
    example repo(s) that we can use to discuss hunk splitting and put on
    the web.  My idea is that we darcs get your repo, unrecord the last
    patch, then re-record and use the hunk editor.

-- 
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: 194 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20090926/119cce09/attachment.pgp>


More information about the darcs-users mailing list