Re: Adjust revision in new repository

Yasuhito FUTATSUKI <[email protected]>
Newsgroups gmane.comp.version-control.subversion.user
Message-ID <[email protected]>
Hello,

On 2023/09/01 18:04, Magnus Lyrberg wrote:
> Unfortunately 'svnadmin load' ignores the revision information in the dump
> file. If the new repository is empty it will start with revision 1
> regardless of
> what the dump file says.
> 
> I made a quick test to verify this:
> 
> svnadmin load /var/svn/repo2 < partial_dump.dump
> <<< Started new transaction, based on original revision 7
>       * adding path : test.txt ... done.
> 
> ------- Committed new rev 1 (loaded from original rev 7) >>>
> 
> <<< Started new transaction, based on original revision 8
>       * editing path : test.txt ... done.
> 
> ------- Committed new rev 2 (loaded from original rev 8) >>>
> 
> I want to achieve the new repository ending up at revision 8 (or even slightly
> above 8), where my old repository was. But as not all revisions are in the
> dump file it ended up on revision 2.

Although it makes a bunch of dummy empty commit, a dump file contains
empty revisions can increase youngest revision number keeping content
of the tree empty.

e.g. A shell script to make a repositoy contains
10 empty revisions:
[[[
#!/bin/sh

repos_uuid='c68ffc52-e6c1-4053-9b3b-6e67a0e223f2'
rev0_date='2023-09-01T10:22:50.036256Z' # This should be just 27 letters.
number_of_commits=10

produce_dump()
{
cat <<DUMP_HEAD_END
SVN-fs-dump-format-version: 2

UUID: ${repos_uuid}

Revision-number: 0
Prop-content-length: 56
Content-length: 56

K 8
svn:date
V 27
${rev0_date}
PROPS-END

DUMP_HEAD_END

rev=0
while [ $rev -lt $1 ]; do
rev=$(($rev+1))
cat <<REV_END
Revision-number: $rev
Prop-content-length: 10
Content-length: 10

PROPS-END

REV_END
done
}

svnadmin create new_repo
produce_dump "${number_of_commits}" | svnadmin load -q new_repo
svnadmin info new_repo
]]]

Cheers,
-- 
Yasuhito FUTATSUKI <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.