You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2013/05/10 22:08:24 UTC
svn commit: r1481171 - /subversion/trunk/subversion/libsvn_repos/dump.c
Author: julianfoad
Date: Fri May 10 20:08:24 2013
New Revision: 1481171
URL: http://svn.apache.org/r1481171
Log:
Code simplification. No functional change.
* subversion/libsvn_repos/dump.c
(svn_repos_dump_fs3): Rename the revision loop variable from 'i' to 'rev'
and eliminate the 'to_rev' that exactly equalled it. Simplify the special-
casing of revision 0. Move the 'from_rev' variable into a tighter scope.
Modified:
subversion/trunk/subversion/libsvn_repos/dump.c
Modified: subversion/trunk/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/dump.c?rev=1481171&r1=1481170&r2=1481171&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/dump.c (original)
+++ subversion/trunk/subversion/libsvn_repos/dump.c Fri May 10 20:08:24 2013
@@ -1097,7 +1097,7 @@ svn_repos_dump_fs3(svn_repos_t *repos,
{
const svn_delta_editor_t *dump_editor;
void *dump_edit_baton = NULL;
- svn_revnum_t i;
+ svn_revnum_t rev;
svn_fs_t *fs = svn_repos_fs(repos);
apr_pool_t *subpool = svn_pool_create(pool);
svn_revnum_t youngest;
@@ -1129,10 +1129,6 @@ svn_repos_dump_fs3(svn_repos_t *repos,
_("End revision %ld is invalid "
"(youngest revision is %ld)"),
end_rev, youngest);
- if ((start_rev == 0) && incremental)
- incremental = FALSE; /* revision 0 looks the same regardless of
- whether or not this is an incremental
- dump, so just simplify things. */
/* Write out the UUID. */
SVN_ERR(svn_fs_get_uuid(fs, &uuid, pool));
@@ -1156,10 +1152,9 @@ svn_repos_dump_fs3(svn_repos_t *repos,
notify = svn_repos_notify_create(svn_repos_notify_dump_rev_end,
pool);
- /* Main loop: we're going to dump revision i. */
- for (i = start_rev; i <= end_rev; i++)
+ /* Main loop: we're going to dump revision REV. */
+ for (rev = start_rev; rev <= end_rev; rev++)
{
- svn_revnum_t from_rev, to_rev;
svn_fs_root_t *to_root;
svn_boolean_t use_deltas_for_rev;
@@ -1169,56 +1164,35 @@ svn_repos_dump_fs3(svn_repos_t *repos,
if (cancel_func)
SVN_ERR(cancel_func(cancel_baton));
- /* Special-case the initial revision dump: it needs to contain
- *all* nodes, because it's the foundation of all future
- revisions in the dumpfile. */
- if ((i == start_rev) && (! incremental))
- {
- /* Special-special-case a dump of revision 0. */
- if (i == 0)
- {
- /* Just write out the one revision 0 record and move on.
- The parser might want to use its properties. */
- SVN_ERR(write_revision_record(stream, fs, 0, subpool));
- to_rev = 0;
- goto loop_end;
- }
-
- /* Compare START_REV to revision 0, so that everything
- appears to be added. */
- from_rev = 0;
- to_rev = i;
- }
- else
- {
- /* In the normal case, we want to compare consecutive revs. */
- from_rev = i - 1;
- to_rev = i;
- }
-
/* Write the revision record. */
- SVN_ERR(write_revision_record(stream, fs, to_rev, subpool));
+ SVN_ERR(write_revision_record(stream, fs, rev, subpool));
+
+ /* When dumping revision 0, we just write out the revision record.
+ The parser might want to use its properties. */
+ if (rev == 0)
+ goto loop_end;
/* Fetch the editor which dumps nodes to a file. Regardless of
what we've been told, don't use deltas for the first rev of a
non-incremental dump. */
- use_deltas_for_rev = use_deltas && (incremental || i != start_rev);
- SVN_ERR(get_dump_editor(&dump_editor, &dump_edit_baton, fs, to_rev,
+ use_deltas_for_rev = use_deltas && (incremental || rev != start_rev);
+ SVN_ERR(get_dump_editor(&dump_editor, &dump_edit_baton, fs, rev,
"", stream, &found_old_reference,
&found_old_mergeinfo, NULL,
notify_func, notify_baton,
start_rev, use_deltas_for_rev, FALSE, subpool));
/* Drive the editor in one way or another. */
- SVN_ERR(svn_fs_revision_root(&to_root, fs, to_rev, subpool));
+ SVN_ERR(svn_fs_revision_root(&to_root, fs, rev, subpool));
/* If this is the first revision of a non-incremental dump,
we're in for a full tree dump. Otherwise, we want to simply
replay the revision. */
- if ((i == start_rev) && (! incremental))
+ if ((rev == start_rev) && (! incremental))
{
+ /* Compare against revision 0, so everything appears to be added. */
svn_fs_root_t *from_root;
- SVN_ERR(svn_fs_revision_root(&from_root, fs, from_rev, subpool));
+ SVN_ERR(svn_fs_revision_root(&from_root, fs, 0, subpool));
SVN_ERR(svn_repos_dir_delta2(from_root, "", "",
to_root, "",
dump_editor, dump_edit_baton,
@@ -1232,6 +1206,7 @@ svn_repos_dump_fs3(svn_repos_t *repos,
}
else
{
+ /* The normal case: compare consecutive revs. */
SVN_ERR(svn_repos_replay2(to_root, "", SVN_INVALID_REVNUM, FALSE,
dump_editor, dump_edit_baton,
NULL, NULL, subpool));
@@ -1244,7 +1219,7 @@ svn_repos_dump_fs3(svn_repos_t *repos,
loop_end:
if (notify_func)
{
- notify->revision = to_rev;
+ notify->revision = rev;
notify_func(notify_baton, notify, subpool);
}
}