[darcs-users] Feature idea: Suggest replace operation

Eric Kow kowey at darcs.net
Fri Oct 9 13:07:19 UTC 2009

Hi Henrik,

Sorry for the late reply.

On Mon, Sep 07, 2009 at 12:25:16 +0200, Henrik Hjelte wrote:
> Hello, maybe this is too obvious and has been discussed before? Anyway
> I came to think of a great feature idea, so I wanted to tell the
> world.

I don't think this has been suggested before in this form

> Now, darcs has a replace operation. Which I too seldom use. Thinking
> of how to best record my changes is not on the top of my head while
> coding. Could darcs automatically detect that a series of hunks might
> mean a replace and suggest the use of the replace operation?

Well, I know of one darcs user who probably would not like this
suggestion ;-), but making darcs replace more discoverable seems
interesting to me.

I suspect that we're stuck with a primitive UI for now, though, in the
interests of simplicity.  It may be worth revisiting this when our
library is in good enough shape to support GUIs and such-like.

>     -            $twitteringNotice.toggle();
>     +            $twitterPublishIcon.toggle();
>     86
>     -                $twitteringNotice.toggle();
>     +                $twitterPublishIcon.toggle();

> Now darcs can ask us if we instead of recording 5 hunks meant to
> record a replace operation?  We might even be given a choice between
> ingNotice for PublishIcon or twitteringNotice for twitterPublishIcon
> (but I think that the last form is probably what you would want, it
> preserves more semantic meaning I guess).

> It seems I don't know enough about the replace command, I needed two
> replace operations to do the same thing, replacing twitteringNotice
> didn't have effect on twitteringNoticeHtml but it did work on
> $twitteringNotice. So it treats a prefix and a postfix differently.
> replace ./src/js/gui/twitter/twitter-view.js [A-Za-z_0-9]
> twitteringNotice twitterPublishIcon
> replace ./src/js/gui/twitter/twitter-view.js [A-Za-z_0-9]
> twitteringNoticeHtml twitterPublishIconHtml

There's two reasons there.  For twitteringNotice vs twitteringNoticeHtml
that's because darcs replace considers them to be two different tokens.
So if that's OK, why did it happily replace $twitteringNotice with
$twitterPublishIcon?  That is because darcs replace only knows about two
things: token characters (in the above, [A-Za-z_0-9]) and everything else.
Since '$' was not matched by the token characters, Darcs replace ignored
it much like it would ignore whitespace.

Hope this helps!

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: 197 bytes
Desc: Digital signature
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20091009/972fb52c/attachment.pgp>

More information about the darcs-users mailing list