[svk-devel] better argument handling

Mark Eichin eichin at metacarta.com
Wed Feb 13 14:19:35 EST 2008


> + SVKLOGLEVEL=DEBUG
> + svk smerge --track-rename --log --remoterev --incremental --base file:///dev/shm/svk/test_repos/trunk:6 --check-only //mirror/test_mirror/branches/dev2 //mirror/test_mirror/branches/practice1
> Auto-merging (///dev/shm/svk/test_repos/trunk, 12) /mirror/test_mirror/branches/dev2 to /mirror/test_mirror/branches/practice1 (base file:///dev/shm/svk/test_repos/trunk).
> Argument "///dev/shm/svk/test_repos/trunk" isn't numeric in numeric eq (==) at /usr/share/perl5/SVK/Command/Merge.pm line 191.
> ===> Auto-merging (///dev/shm/svk/test_repos/trunk, 11) /mirror/test_mirror/branches/dev2 to /mirror/test_mirror/branches/practice1 (base file:///dev/shm/svk/test_repos/trunk).
> Argument "///dev/shm/svk/test_repos/trunk" isn't numeric in addition (+) at /usr/share/perl5/SVK/Merge.pm line 426.
> TypeError in method 'svn_fs_revision_root', argument 3 of type 'svn_revnum_t'

The mistake here is that I used the upstream svn url instead of the
svk one; the code failure is that find_merge_base takes

  file:///dev/shm/svk/test_repos/trunk:6

and splits it up
    my ($merge_base, $merge_baserev) = $self->{merge_base} ? split(/:/, $self->{merge_base}) : ('', undef);
    ($merge_base, $merge_baserev) = (undef, $merge_base)
        if $merge_base =~ /^\d+$/;

so $merge_base is "file" and $merge_baserev is
"///dev/shm/svk/test_repos/trunk" and the 6 is silently discarded.

Something as simple as a

 die "$self->{merge_base} not valid" if $merge_baserev && $merge_baserev !~ /^\d+$/;

right after the arg splitting lines quoted above would be a good choice...


More information about the svk-devel mailing list