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

Re: svn commit: r1604421 - in /subversion/trunk: subversion/libsvn_fs_fs/ subversion/tests/cmdline/ subversion/tests/libsvn_fs_fs/ tools/server-side/svnfsfs/

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Wed, 25 Jun 2014 17:19:24 +0100

Stefan Fuhrmann wrote:

> Ivan Zhakov wrote:
>> @@ -1449,15 +1449,35 @@ write_revision_zero(svn_fs_t *fs)
>>>+    SVN_ERR(svn_io_file_create_binary(path_revision_zero,
>>>+                  "PLAIN\nEND\nENDREP\n"
>>>+                  "id: 0.0.r0/2\n"
>>>+                  "type: dir\n"
>>>+                  "count: 0\n"
>>>+                  "text: 0 3 4 4 "
>>>+                  "2d2977d1c96f487abe4a1e202dd03b4e\n"
>>>+                  "cpath: /\n"
>>>+                  "\n\n"
>>>+
>>>+                  /* L2P index */
>>>+                  "\0\x80\x40"          /* rev 0, 8k entries per page */
>>>+                  "\1\1\1"              /* 1 rev, 1 page, 1 page in 1st rev */
>>>+                  "\6\4"                /* page size: bytes, count */
>>>+                  "\0\xd6\1\xb1\1\x21"  /* phys offsets + 1 */
>>>+
>>>+                  /* P2L index */
>>>+                  "\0\x6b"              /* start rev, rev file size */
>>>+                  "\x80\x80\4\1\x1D"    /* 64k pages, 1 page using 29 bytes */
>>>+                  "\0"                  /* offset entry 0 page 1 */
>>>+                                        /* len, item & type, rev, checksum */
>>>+                  "\x11\x34\0\xf5\xd6\x8c\x81\x06"
>>>+                  "\x59\x09\0\xc8\xfc\xf6\x81\x04"
>>>+                  "\1\x0d\0\x9d\x9e\xa9\x94\x0f"
>>>+                  "\x95\xff\3\x1b\0\0"  /* last entry fills up 64k page */
>>>+
>>>+                  /* Footer */
>>>+                  "107 121\7",
>>>+                  107 + 14 + 38 + 7 + 1, fs->pool));
>>
>> This constant makes code unreadable, unmaintainable and very error prone.
>
> How?

"How?" Really? REALLY? I don't know if Ivan was referring to the numeric constant or the string constant or both, but I take issue with the string constant. Among everything you've written do you really have no code that could help to generate and write the indexes without having to spell it all out bit-for-bit by hand? I won't believe it if you say "no".

[...]

> Changing the rev 0 template has never been a fun
> activity and wont become one in the foreseeable
> future.

In 1.8.x it looked like this:

  SVN_ERR(svn_io_file_create(path_revision_zero,
                             "PLAIN\nEND\nENDREP\n"
                             "id: 0.0.r0/17\n"
                             "type: dir\n"
                             "count: 0\n"
                             "text: 0 0 4 4 "
                             "2d2977d1c96f487abe4a1e202dd03b4e\n"
                             "cpath: /\n"
                             "\n\n17 107\n", fs->pool));

Yes it contained a few magic constants, some of which probably should have been generated, but still it was *much* simpler.

- Julian
Received on 2014-06-25 18:19:56 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.