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

Mark Stosberg mark at summersault.com
Sat Jan 16 02:10:59 UTC 2010


Thanks to everyone for the work that's gone into Darcs 2.4 beta 1.

Here's some feedback on it:

It compiles fine for me on FreeBSD with GHC 6.8.3. I first ran "cabal update
cabal-update".  On FreeBSD an extra argument to cabal install is install
required:
    cabal install darcs --extra-lib-dirs=/usr/local/lib

I was interested to try the hunk splitting sometimes because I've wanted that
feature myself at times. My first impression found it to be a frustrating and
unintuitive experience. I'll try to explain why.

Here's a "screenshot" of what it looked like for me:

####################
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.
===
===
        use Data::Dumper;
        warn Dumper ('foo!');
===

#####################

First, it's not clear what "set of lines" refer to. Is it referring to the
"===" lines? I wouldn't call those sets. Maybe it is referring to the content between
the === lines. But there nothing between the first two === lines, so referring to nothing
as a "set of lines" is also confusing.

What I wanted to do here was to remove the lines from the code. So I remove
them and leave my editor. Darcs doesn't register the change! It acts like
nothing has happened. Ok, so maybe I'm not allowed to edit the code, despite
that the first line is labeled "interactive hunk edit". Maybe I'm only supposed
to split the code. 

So the next time I do that, and put the second === in between the two lines of
code.  Now I'm asked if I want to keep the "use Data::Dumper;" line. I say
"no", because in fact I want to eventually revert it. Then darcs tells me that
is skipping the next two patches and dumps me out of "record"! So that didn't work
as I expected either. 

Next I tried moving my two lines of debugging code so they are above the second
=== line. I also changed a word that I was dumping. That produced the following three hunks:

hunk ./perllib/Data/FormValidator/Constraints.pm 368
+        use Data::Dumper;
+        warn Dumper ('zoo!');
Shall I record this change? (1/3)  [ynWesfvplxdaqjk], or ? for help: j
hunk ./perllib/Data/FormValidator/Constraints.pm 368
-        use Data::Dumper;
-        warn Dumper ('zoo!');
Shall I record this change? (2/3)  [ynWesfvplxdaqjk], or ? for help: j
hunk ./perllib/Data/FormValidator/Constraints.pm 368
+        use Data::Dumper;
+        warn Dumper ('foo!');
+
Shall I record this change? (3/3)  [ynWesfvplxdaqjk], or ? for help:

###

I find this very confusing. Darcs is offering to both add, remove and re-add the same lines
in the same "record" section. This is definitely *not* intuitive. 

One basic experience here is that is being changed here is that before when I used "record",
I was recording a change to a file. With this feature, I can apparently record a change which
temporarily exists in darcs memory. This weird sequence above suggests that I'm not recording
a file, but some stack of patches. 

I think you should not break the metaphor of recording changes to file. I think the UI should 
be used to *only* split where one hunks begins and another ends. A separate feature could
allow you jump into the file and do a edit on-the-fly, and in that case, the actual file copy
would be modified directly as I would expect. 

I don't recommend shipping the hunk editting feature in it's current form. I think it needs
to be re-thought.

Here's a proposed "screenshot" how I think it could work more intuitively:

#####
Interactive hunk splitting:
    - move the ==SPLIT line to the location where you would like the hunk to be split
    - Otherwise changing the content is not supported. 
==BEGIN
==SPLIT
        use Data::Dumper;
        warn Dumper ('you!');
==END
######

Again, I appreciate the opportunity to try an updated darcs and generally enjoy
it as as very satisfying and efficient tool to work with.

    Mark




More information about the darcs-users mailing list