Index: subversion/libsvn_fs_fs/fs_fs.c =================================================================== --- subversion/libsvn_fs_fs/fs_fs.c (.../vendor-1.3) (revision 5) +++ subversion/libsvn_fs_fs/fs_fs.c (.../revdir) (revision 5) @@ -22,6 +22,10 @@ #include #include +#include +#include +#include + #include #include #include @@ -155,15 +159,70 @@ const char * svn_fs_fs__path_rev (svn_fs_t *fs, svn_revnum_t rev, apr_pool_t *pool) { + + char *oldstylepath; + struct stat statbuf; + char *rvsubdir; + + oldstylepath = svn_path_join_many (pool, fs->path, PATH_REVS_DIR, + apr_psprintf (pool, "%ld", rev), NULL); + + /* If there exists an "old style" path rev, we use that one */ + if (stat (oldstylepath, &statbuf) == 0) + if (S_ISREG(statbuf.st_mode)) + return oldstylepath; + + /* Otherwise, we return the new hotness */ + rvsubdir = svn_path_join_many (pool, fs->path, PATH_REVS_DIR, + apr_psprintf (pool, "%ld.d", + (rev >> 16) % 256), + apr_psprintf (pool, "%ld.d", + (rev >> 8) % 256), + NULL); + + /* Make directories unless they already exist */ + if (stat (rvsubdir, &statbuf) != 0) + svn_io_make_dir_recursively (rvsubdir, pool); + return svn_path_join_many (pool, fs->path, PATH_REVS_DIR, - apr_psprintf (pool, "%ld", rev), NULL); + apr_psprintf (pool, "%ld.d", (rev >> 16) % 256), + apr_psprintf (pool, "%ld.d", (rev >> 8) % 256), + apr_psprintf (pool, "%ld", rev), NULL); + } static const char * path_revprops (svn_fs_t *fs, svn_revnum_t rev, apr_pool_t *pool) { + char *oldstylepath; + struct stat statbuf; + char *rvsubdir; + + oldstylepath = svn_path_join_many (pool, fs->path, PATH_REVPROPS_DIR, + apr_psprintf (pool, "%ld", rev), NULL); + + /* If there exists an "old style" path rev, we use that one */ + if (stat (oldstylepath, &statbuf) == 0) + if (S_ISREG(statbuf.st_mode)) + return oldstylepath; + + /* Otherwise, we return the new hotness */ + rvsubdir = svn_path_join_many (pool, fs->path, PATH_REVPROPS_DIR, + apr_psprintf (pool, "%ld.d", + (rev >> 16) % 256), + apr_psprintf (pool, "%ld.d", + (rev >> 8) % 256), + NULL); + + /* Make directories unless they already exist */ + if (stat (rvsubdir, &statbuf) != 0) + svn_io_make_dir_recursively (rvsubdir, pool); + return svn_path_join_many (pool, fs->path, PATH_REVPROPS_DIR, - apr_psprintf (pool, "%ld", rev), NULL); + apr_psprintf (pool, "%ld.d", (rev >> 16) % 256), + apr_psprintf (pool, "%ld.d", (rev >> 8) % 256), + apr_psprintf (pool, "%ld", rev), NULL); + } static const char *