Differences between WC->WC copy, URL->URL copy, and $dirent->created_rev()
From: Nik Clayton <nik_at_ngo.org.uk>
Date: 2006-01-28 11:07:50 CET
[ Originally sent to users@, members of #svn-dev suggested I send it here. ]
Hello,
I'm not (yet) subscribed to this list -- I'd be grateful for a cc: on any
I've run in to an anomaly in the way SVN handles copies when they're WC ->
I'm looking at converting an application that currently uses SVN::Repos (and
One of the things the app needs to do is, given a repo, a filename, and
With SVN::Repos I do this:
my $path = '/path/in/repo';
$hist = $hist->prev(0);
With SVN::Ra I was trying this approach.
my $path = '/path/in/repo';
$irev = $ent->created_rev();
Which seems to work in most cases.
However, there's a case where it doesn't work.
Suppose your repo looks like this:
Entry Created in
/trunk/foo 2
/branches/test1 3 Copied from trunk:2, WC -> WC
/branches/test1/bar 4 Modified, and committed
/branches/test2 5 Copied from trunk:4, URL -> URL
/branches/test2/bar 6 Modified, and committed
In this case, and given the code above, you would expect both approaches to
That's only the case with WC -> WC copy. Both approaches agree that the
However, with a URL -> URL copy, they differ.
Using SVN::Repos, it tells me that the youngest interesting revision for
Using SVN::Ra, it tells me that the youngest interesting revision for
This difference is also reflected in the 'svn log' output.
With the WC -> WC copy you see this from 'svn log'
...
With the URL -> URL copy you see this:
...
Notice that there's no 'A' line for /branches/test2/bar or /branches/test2/foo.
This situation persists until the file is affected by a later commit. At
This doesn't seem right. Is this a bug, or am I using the API incorrectly?
Attached are two files.
mkrepo.sh is a shell script that, given a path, will create a repo in that
sh mkrepo.sh /tmp/repo
for example. test.pl is a small Perl program that uses SVN::Ra and
perl test.pl /tmp/repo
I get this output:
1..7
As you can see, for /branches/test2/foo ::Ra says the youngest interesting
Any advice gratefully received.
N
#!/bin/sh
repo=file://$1
if [ "$1x" = "x" ]; then
# Blow away repo directory, and WC
# Create new repo, check it out, cd(1) to it.
# Create trunk/ and branches/
# Create two files in trunk/
# Copy trunk/ to branches/test1/, using a WC -> WC copy, and ::Ra and
# Make a change to branches/test1/bar and commit.
# Copy trunk/ to branches/test2/, using a URL -> URL copy. ::Ra wil have
# Make a change to branches/test2/bar, and commit. ::Ra and ::Repos will now
echo Now run:
#!/usr/bin/perl
use warnings;
use Test::More tests => 7;
use SVN::Core;
my $repo_path = shift;
die "usage: $0 /path/to/repo\n" if ! defined $repo_path;
my $ra = SVN::Ra->new("file://$repo_path");
my $latest_rev_ra = $ra->get_latest_revnum();
is($latest_rev_ra, $latest_rev_repo, 'ra/repos agree on youngest rev');
foreach my $file (qw(/trunk/foo /trunk/bar
is(check_ra($file, $latest_rev_ra), check_repos($file, $latest_rev_repo),
# Both functions return the youngest interesting rev for $path that
my $ent = $ra->stat($path, $rev);
sub check_repos {
my $root = $fs->revision_root($rev);
$hist = $hist->prev(0);
---------------------------------------------------------------------
|
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.