[darcs-users] Supporting XML rather than line-based diffs/patches

Eric Y. Kow eric.kow at gmail.com
Tue Sep 18 20:07:25 UTC 2007


Hi Rocky,

> Any pointers on how to approach this problem (e.g. which modules
> control the diff/patch, major difficulties, etc)?

Short answer
------------
Here are some files which you would probably want to start with
    # core stuff
    src/Darcs/Patch/Core.lhs
    src/Darcs/Diff.lhs
    src/Darcs/Patch/Commute.lhs

    # reading and writing patches
    src/Darcs/Patch/Read.lhs
    src/Darcs/Patch/Show.lhs

    # user interface
    src/Darcs/Repository/Prefs.lhs
    src/Darcs/Repository/Format.lhs

This is off the darcs-unstable repo;
   darcs get http://darcs.net/repos/unstable

Long answer
-----------
You might be pleased to note that the darcs is already designed around
the idea that there are different kinds of patches, so the underlying
framework you will need to make this work is already in place.  Here are
the basic patch types that darcs uses now:
  - remove file
  - add file
  - remove dir
  - add dir
  - move file/dir
  - modify binary file
  - add/remove hunk (line based diff)
  - replace token (replace all 'foo' in a given file by 'bar'

Extending darcs essentially consists of
  1. defining the new patch type (Darcs.Patch.Core)
  2. extending the diff algorithm (Darcs.Diff)
  3. specifying how this patch should interact with other patches (Darcs.Patch.Commute)
The underlying patch algebra takes care of the rest, ensuring that
merging and conflict resolution happen nicely.

If you are interested, some other new patch types have also been
proposed: 'unindent/indent' patches http://bugs.darcs.net/issue311 ,
character-based diffs (as opposed to line-based ones), and text
displacement patches (for moving blocks of code around).  Sadly, there
is nobody to work on them yet.

Hope this helps! If not, I hope David can give you a more official
answer.

-- 
Eric Kow                     http://www.loria.fr/~kow
PGP Key ID: 08AC04F9         Merci de corriger mon français.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20070918/d7cbe3f0/attachment.pgp 


More information about the darcs-users mailing list