[darcs-users] darcs patch: add "parallel pairs" (and 6 more)

Eric Kow kowey at darcs.net
Fri Sep 18 07:14:25 UTC 2009


On Thu, Sep 17, 2009 at 22:52:30 +0100, Ganesh Sittampalam wrote:
> This is an initial attempt at adding interactive editing of hunk
> patches. I don't necessarily expect this sequence to be applied
> as-is, though it could be.

What a treat!  I'm going to push the easy patches first

 * add "parallel pairs"
 * break out and export run_editor utility function
 * Add utility code for editing text

And leave the meat of this bundle for later (perhaps somebody else
wants to tag themselves in?)

If we get this right, this kills one thing that git's UI can do
better that us :-D

add "parallel pairs"
--------------------
> -infix 1 :/\:, :\/:
> +infix 1 :/\:, :\/:, :||:
>  data (a1 :\/: a2) C(x y) = FORALL(z) (a1 C(z x)) :\/: (a2 C(z y))
>  data (a1 :/\: a2) C(x y) = FORALL(z) (a1 C(x z)) :/\: (a2 C(y z))
> hunk ./src/Darcs/Ordered.hs 72
> +data (a1 :||: a2) C(x y) = (a1 C(x y)) :||: (a2 C(x y))

Just a random refresher for the interested.  Echoing Jason's masters
thesis, these types help you represent merging.

Reading the symbols from bottom to top

  :/\: - 2. ... a pair of patches that go to the same context
  :\/: - 1. a pair of patches that start from the same context ^

Ganesh adds 'parallel' patches which represents a pair of patches
that start from and end up in the same place.  What for? Stay tuned!

break out and export run_editor utility function
------------------------------------------------
> +run_editor :: FilePath -> IO ExitCode
> +run_editor f = do
> +  ed <- get_editor
> +  exec_interactive ed f
> +       `ortryrunning` exec_interactive "emacs" f
> +       `ortryrunning` exec_interactive "emacs -nw" f
> +       `ortryrunning` exec_interactive "nano" f
> +#ifdef WIN32
> +       `ortryrunning` exec_interactive "edit" f
> +#endif

I think all new functions should be camelCase.  It's not that I care,
it's just that I want it to stop even being a question.  The desired
outcome is that we never get anybody having to scratch their heads
looking for a deeper meaning or conventions behind the case.

Nothing to see here otherwise, just a quick little refactor.

Add utility code for editing text
---------------------------------
> +edit_text :: String -> B.ByteString -> IO B.ByteString
> +edit_text desc txt = withNamedTemp desc $ \f -> do
> +  B.writeFile f txt
> +  run_editor f
> +  B.readFile f

Camels once more.  The new edit_text utility edits a bytestring in a
named temporary file (I think you get foo-42 as a name)

Remaining meaty patches
-----------------------
 * add substitution mechanism for PatchChoices
 * add canonization function for FL Prim
 * add some QC properties that demonstrate the problem with canonizeFL
 * Resolve issue291: add (basic) interactive patch splitting

-- 
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/20090918/f2eb3ff3/attachment.pgp>


More information about the darcs-users mailing list