You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Eric S. Raymond" <es...@thyrsus.com> on 2019/10/11 09:41:01 UTC
Creating directory copy operations in a dump stream
After years of eyeballing Subversion dump streams as part of making
reposurgeon work, I have belatedly realized there is a dump stream
operation I don't know how to generate with the CLI. And I need to
to get good test load coverage.
If, in a normally-set up Subversion repository, I create and commit
three files under trunk and then do "svn copy trunk branches/stable",
what I see being generated into the dump is three file copies to
stable.
That's fine, but I also want to be able to generate a *directory* copy.
I see these in the dump files I get in bug reports. Here's an
example:
Node-path: tags/1.0rc1
Node-kind: dir
Node-action: add
Node-copyfrom-rev: 5
Node-copyfrom-path: tags/1.0
How do I generate this kind of operation from the CLI - that is, a copy of the
whole directory rather than a wildcarded copy of all of its files?
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
All governments are more or less combinations against the
people. . .and as rulers have no more virtue than the ruled. . .
the power of government can only be kept within its constituted
bounds by the display of a power equal to itself, the collected
sentiment of the people.
-- Benjamin Franklin Bache, in a Phildelphia Aurora editorial 1794
Re: Creating directory copy operations in a dump stream
Posted by "Eric S. Raymond" <es...@thyrsus.com>.
Johan Corveleyn <jc...@gmail.com>:
> - Just guessing here, but perhaps the problem with your test is that
> your working copy is "mixed-revision" after you added the three files.
> I.e. the 'trunk' directory is a revision behind, after you added the
> three files. See if it makes a difference if you do "svn up $wc_root"
> before performing the "svn copy trunk branches/stable".
That did the trick, thanks.
For your entertainment, here's how the test koad generator now looks:
----------------------------------------------------------------------------
## General test load for ancestry-chasing logic
dump=no
verbose=null
while getopts dv opt
do
case $opt in
d) dump=yes;;
v) verbose=stdout;;
esac
done
trap 'rm -fr test-repo test-checkout' 0 1 2 15
svnaction () {
filename=$1
content=$2
comment=$3
if [ ! -f $filename ]
then
if [ ! -d `dirname $filename` ]
then
mkdir `dirname $filename`
svn add `dirname $filename`
fi
echo "$content" >$filename
svn add $filename
else
echo "$content" >$filename
fi
svn commit -m "$comment" $filename
}
{
set -e
make svn-branchy
cd test-checkout
# Content operations start here
svnaction "trunk/foo.txt" "Now is the time." "More example content"
svnaction "trunk/bar.txt" "For all good men." "Example content in different file"
svnaction "trunk/baz.txt" "to come to the aid of their country." "And in yet another file"
svn up # Without this, the next copy does file copies. With it, a directory copy.
svn copy trunk branches/stable
svn commit -m "First directory copy"
svnaction "trunk/foo.txt" "Whether tis nobler in the mind." "Hamlet the Dane said this"
svnaction "trunk/bar.txt" "or to take arms against a sea of troubles" "He continued"
svnaction "trunk/baz.txt" "and by opposing end them" "The build-up"
svnaction "trunk/foo.txt" "to be," "Famous soliloquy begins"
svnaction "branches/foo.txt" "or not to be." "And continues"
svn up
svn copy trunk tags/1.0
svn commit -m "First tag copy"
# We're done
cd ..
} >/dev/$verbose 2>&1
if [ "$dump" = yes ]
then
svnadmin dump -q test-repo
fi
----------------------------------------------------------------------------
This will get longer and include the most perverse combinations of
deletes and copies I can dream up. The point, of course, is to
torture-test my Subversion dump analyzer.
I have a fairly nice gallmaufry of static stream dumps I've gathered
or made by hand over the years; being able to generate them easily
will be helpful.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
Re: Creating directory copy operations in a dump stream
Posted by Johan Corveleyn <jc...@gmail.com>.
On Fri, Oct 11, 2019 at 11:41 AM Eric S. Raymond <es...@thyrsus.com> wrote:
>
> After years of eyeballing Subversion dump streams as part of making
> reposurgeon work, I have belatedly realized there is a dump stream
> operation I don't know how to generate with the CLI. And I need to
> to get good test load coverage.
>
> If, in a normally-set up Subversion repository, I create and commit
> three files under trunk and then do "svn copy trunk branches/stable",
> what I see being generated into the dump is three file copies to
> stable.
>
> That's fine, but I also want to be able to generate a *directory* copy.
> I see these in the dump files I get in bug reports. Here's an
> example:
>
> Node-path: tags/1.0rc1
> Node-kind: dir
> Node-action: add
> Node-copyfrom-rev: 5
> Node-copyfrom-path: tags/1.0
>
> How do I generate this kind of operation from the CLI - that is, a copy of the
> whole directory rather than a wildcarded copy of all of its files?
I'd try two things:
- Just guessing here, but perhaps the problem with your test is that
your working copy is "mixed-revision" after you added the three files.
I.e. the 'trunk' directory is a revision behind, after you added the
three files. See if it makes a difference if you do "svn up $wc_root"
before performing the "svn copy trunk branches/stable".
- Maybe you can get what you want by performing a server-side copy,
instead of in your working copy and then committing. I.e. "svn copy
$url/trunk $url/branches/stable".
--
Johan