[darcs-devel] [patch1593] clean up display of file names by separating display and storage of patches (rebased from Ben's encoding branch)

Guillaume Hoffmann bugs at darcs.net
Thu Aug 31 21:16:57 UTC 2017


New submission from Guillaume Hoffmann <guillaumh at gmail.com>:

These are the last 2 patches from Ben's darcs-encoding branch, the other
ones are at http://bugs.darcs.net/patch1592 .

They apply cleanly on HEAD and all tests pass (wiht darcs1 and darcs2
repositories).

Note that the issue raised by Ben in his mail [1] are created by the
first patch below.

[1] https://lists.osuosl.org/pipermail/darcs-devel/2017-May/018016.html

2 patches for repository http://darcs.net:

patch 0b44fbb1718bbb2b61724fc9eeed3ae2f4ebd583
Author: Ben Franksen <ben.franksen at online.de>
Date:   Thu Aug 31 17:17:28 -03 2017
  * clean up display of file names by separating display and storage of
patches

  Darcs has always used the same code to serialize patches for storage
on disk
  and for displaying them to the user. This makes sense in terms of code
  economy but until now led to strange issues when displaying non-ASCII
  filenames.

  This patch makes a few small changes at the bottom of the hierarchy of
  classes that make up the Patch API, but these small changes necessitate
  rather deep and far-reaching changes in many other places.

  The first change is to add a second parameter to showPatch and
  showContextPatch to indicate the intended use (ForDisplay |
ForStorage). The
  correct value for this parameter must be added everywhere these functions
  are used, which is tedious but mostly trivial.

  The second is to remove the instances of Darcs.Patch.Prim.V1.Prim for
  ShowPatchBasic and ShowPatch. The reason is that the Prim patch type is
  shared (as a type parameter) between RepoPatchV1 and RepoPatchV2, so it
  *cannot* know which file name encoding to use for storage. (This is why
  there are PrimShow and PrimRead classes that get the file name format
passed
  as a parameter.) Nevertheless, we *need* primitive patches to implement
  these classes! Half of the rest of the darcs code and large parts of the
  test harness rely on prim patches having the same API as full repo
patches.

  The dilemma is solved by adding yet another layer of types: V1 and V2 now
  each define their own newtype wrapper for the shared Prim type. This
wrapper
  has knowledge about how to render file names (and also patch lists) in the
  correct format and thus can implement ShowPatchBasic, ShowPatch, and
the now
  separate ShowContextPatch classes. This is the type that is now
returned by
  the PrimOf type function.

  Incidentally, this patch fixes a failure for darcs1 format of
  issue2382-mv-dir-to-file-confuses-darcs.sh that was causes by the
output of
  darcs record adding (legacy) braces around patch lists for display. We now
  use the ListFormatDefault (no braces) for all display so this problem just
  vanished. Similarly, the peculiar darcs-specific "white space
encoding" for
  filenames is now strictly limited to the on-disk format of patches
  (including patch bundles) and inventories and no longer affects the UI.

patch 1fe1c8617a2b6c8bc753f4baa3033168163ad3ae
Author: Ben Franksen <ben.franksen at online.de>
Date:   Thu Aug 31 17:20:21 -03 2017
  * use formatFileName UserFormat in Darcs.Patch.Summary

----------
files: clean-up-display-of-file-names-by-separating-display-and-storage-of-patches.dpatch
messages: 19635
nosy: gh
status: needs-screening
title: clean up display of file names by separating display and storage of patches (rebased from Ben's encoding branch)

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1593>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clean-up-display-of-file-names-by-separating-display-and-storage-of-patches.dpatch
Type: application/octet-stream
Size: 104004 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20170831/35fb2c1c/attachment-0001.obj>


More information about the darcs-devel mailing list