[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

A different option for a new XML delta format

From: Greg Hudson <ghudson_at_mit.edu>
Date: 2000-10-03 19:34:46 CEST

(Sorry to flood people's inboxes... I'm a little verbose when it comes
to design issues.)

After thinking about the general unreadability of my proposed format,
I thought I would go through and make a DTD and sample delta for Greg
Stein's XML format proposal. If you go to the end of this message and
look at the sample, you can see that it's considerably more readable,
although it's maybe less clear to the uninitiated that you need to
"add-file" or "replace-file" before you can "text-delta".

except that the lookup strings for file and directory batons are parts
of the pathnames. For instance, when the parser runs into something

        <add-dir path="/A/B/C"/>

it will rip apart the path into a parent directory "/A/B" and a new
directory name "C". "/A/B" will be used to look up the parent
directory baton. For file-editing calls like text-delta, the entire
path gets used as a lookup string for the file baton.


        * Greg Stein's approach is more readable.

        * Greg Stein's approach becomes really verbose when directory
          names get long. My approach doesn't have this problem
          because IDs can be a lot shorter than pathnames.

        * My approach makes the constraints clearer, since you can't
          try to <text-delta> a file before you specify an ID for it.

        * My approach is a little cleaner from an implementation point
          of view since you don't have to rip apart paths. (But there
          is a middle-ground approach where you specify the parent
          path and directory element in separate attributes, so if
          this is a real issue it only requires a tweak to my
          rendition of Greg Stein's proposal.)

So, opinions? At the moment I'm leaning in favor of Greg Stein's
approach, long directory names be damned. But I'll take a break for a
few hours and let people catch up before I start trying to crank out
an implementation.

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML DTD for Subversion's delta packages. -->

<!ELEMENT delta-pkg (delete | add-dir | replace-dir | change-dir-prop
                     | change-dirent-prop | close-dir | add-file
                     | replace-file | text-delta | change-file-prop
                     | close-file)*>

<!-- delete-dirent: delete a directory entry -->
<!ELEMENT delete-dirent>
<!ATTLIST delete-dirent

<!-- add-dir: Create a new directory -->
<!ELEMENT add-dir>
<!ATTLIST add-dir
 ancestor CDATA #IMPLIED

<!-- replace-dir: Modify a directory -->
<!ELEMENT replace-dir>
<!ATTLIST replace-dir
 ancestor CDATA #IMPLIED

<!-- change-dir-prop: Edit the properties of a directory -->
<!ELEMENT change-dir-prop (set | delete)+>
<!ATTLIST change-dir-prop

<!-- change-dirent-prop: Edit the properties of a directory entry -->
<!ELEMENT change-dirent-prop (set | delete)+>
<!ATTLIST change-dirent-prop

<!-- close-dir: Indicate that we are done with a directory -->
<!ELEMENT close-dir>
<!ATTLIST close-dir

<!-- add-file: Create a new file -->
<!ELEMENT add-file>
<!ATTLIST add-file
 ancestor CDATA #IMPLIED

<!-- replace-file: Modify a file -->
<!ELEMENT replace-file>
<!ATTLIST replace-file
 ancestor CDATA #IMPLIED

<!-- text-delta: Edit the text of a file -->
<!ELEMENT text-delta (#PCDATA)>
<!ATTLIST text-delta

<!-- change-file-prop: Edit the properties of a file -->
<!ELEMENT change-file-prop (set | delete)+>
<!ATTLIST change-file-prop

<!-- close-file: Indicate that we are done with a file -->
<!ELEMENT close-file>
<!ATTLIST close-file

<!-- set: Set a property's value -->

<!-- delete: Delete a property -->
<!ATTLIST delete

<?xml version="1.0" encoding="UTF-8"?>
  <add-dir path="/A" ancestor="/A" ancver="1"/>
  <add-file path="/A/mu" ancestor="/A/mu"/>
  <text-delta path="/A/mu">This is the file 'mu'.</text-delta>
  <close-file path="/A/mu"/>
  <add-dir path="/A/B" ancestor="/A/B"/>
  <add-file path="/A/B/lambda" ancestor="/A/B/lambda"/>
  <text-delta path="/A/B/lambda">This is the file 'lambda'.</text-delta>
  <close-file path="/A/B/lambda"/>
  <add-dir path="/A/B/E" ancestor="/A/B/E"/>
  <change-dir-prop path="/A/B/E">
    <set name="car">buick</set>
  <close-dir path="/A/B/E"/>
  <add-dir path="/A/B/F" ancestor="/A/B/F"/>
  <change-dir-prop path="/A/B/F">
    <delete name="glub"/>
  <close-dir path="/A/B/F"/>
  <close-dir path="/A/B"/>
  <add-dir path="/A/C" ancestor="/A/C"/>
  <close-dir path="/A/C"/>
  <add-dir path="/A/D"/>
  <add-file path="/A/D/gamma" ancestor="/A/D/gamma"/>
  <change-file-prop path="/A/D/gamma">
    <set name="banana">yellow</set>
    <delete name="lemon"/>
    <set name="crabgrass">epistemological</set>
  <text-delta path="/A/D/gamma">This is the file 'gamma'.</text-delta>
  <close-file path="/A/D/gamma"/>
  <close-dir dir-id="/A/D"/>
  <close-dir dir-id="/A"/>
Received on Sat Oct 21 14:36:10 2006

This is an archived mail posted to the Subversion Dev mailing list.