[darcs-devel] darcs patch: minor code cleanup. (and 5 more)
David Roundy
droundy at darcs.net
Wed Aug 8 20:19:16 UTC 2007
On Wed, Aug 08, 2007 at 08:41:28PM +0200, Eric Y. Kow wrote:
> Hi David,
>
> Most of these look ok and are going in, except...
>
> > Mon Aug 6 16:09:27 PDT 2007 David Roundy <droundy at darcs.net>
> > * refactor to expand is_identity and use it to encapsulate "identitiness"
>
> that I'm not sure I understand this one.
>
> > +sort_coalesce_composite (x:>:xs) | IsEq <- is_identity x = sort_coalesce_composite xs
>
> Does this make sort_coalesce_composite do new things?
Yes, it does, but these are good things. sort_coalesce_composite is only
used on unrecorded changes to mutate them into friendlier and more compact
forms, and filtering out identity patches is a Good Thing in this case.
I'm sending another patch to rename sort_coalesce_composite and clean up
its use just a tad.
> > -coalesceFilePatch _ (AddFile :< RmFile)
> > - = Just unsafeIdentity
>
> Is this intentional? If I understand correctly, the code said that
> removing a file and re-adding it cancels itself out. Does it no
> longer do that, or is it somehow implicit from the changes to the
> sort_coalesce_composite code?
Actually, this change is made obsolete by:
coalesce (p2 :< p1) | IsEq <- p2 =\/= invert p1 = Just null_patch
which I guess was either already present, or got added in a separate
patch.
> > -canonizeHunk _ _ o n | o == n = unsafeIdentity
>
> Here it seems clearer that the effect is the same because of the
> is_identity code added to canonize
Right.
> Anyway, I guess it's good that you're making me look at this code. Each
> time I get a little less scared... (just a little)
:) And each time you ask a question, I seem to clean up the code (or docs)
a little more...
--
David Roundy
Department of Physics
Oregon State University
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.osuosl.org/pipermail/darcs-devel/attachments/20070808/1bb7a6d8/attachment.pgp
More information about the darcs-devel
mailing list