[svk-commit] r2580 - in trunk: inc/Module inc/Module/Install
lib/SVK/Command lib/SVK/Editor t
nobody at bestpractical.com
nobody at bestpractical.com
Wed Oct 31 06:29:07 EDT 2007
Author: clkao
Date: Wed Oct 31 06:28:48 2007
New Revision: 2580
Modified:
trunk/inc/Module/Install.pm
trunk/inc/Module/Install/AutoInstall.pm
trunk/inc/Module/Install/Base.pm
trunk/inc/Module/Install/Can.pm
trunk/inc/Module/Install/Fetch.pm
trunk/inc/Module/Install/Include.pm
trunk/inc/Module/Install/Makefile.pm
trunk/inc/Module/Install/Metadata.pm
trunk/inc/Module/Install/Scripts.pm
trunk/inc/Module/Install/Win32.pm
trunk/inc/Module/Install/WriteAll.pm
trunk/lib/SVK/Command/Patch.pm
trunk/lib/SVK/Editor/Merge.pm
trunk/lib/SVK/Merge.pm
trunk/lib/SVK/Patch.pm
trunk/t/07smerge-bidi-inc.t
trunk/t/36push-pull.t
Log:
Port ticket-bug branch to trunk.
r10577 at ubuntu (orig r2542): clkao | 2007-10-16 22:17:13 +0800
branch for fixing ticket bug.
r10580 at ubuntu (orig r2545): clkao | 2007-10-16 22:32:04 +0800
First cut of ticket overwriting fixes. The problem is caused
by repos_commit in svn checking directory update-ness with
node_created_rev. However when we are setting the merge ticket,
we have already modified the content of the directory henec it
is always fresh.
* split get_new_ticket and print_new_ticket
* split set_ticket from cb_merged and call it upon opening
of the target node.
r10681 at ubuntu (orig r2556): clsung | 2007-10-22 10:11:31 +0800
- workaround before we implement
- less strict mode on server side
r10682 at ubuntu (orig r2557): clsung | 2007-10-22 10:31:14 +0800
- workaround before we implement
- less strict mode on server side
Modified: trunk/inc/Module/Install.pm
==============================================================================
--- trunk/inc/Module/Install.pm (original)
+++ trunk/inc/Module/Install.pm Wed Oct 31 06:28:48 2007
@@ -28,7 +28,7 @@
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '0.64';
+ $VERSION = '0.67';
}
# Whether or not inc::Module::Install is actually loaded, the
@@ -86,7 +86,7 @@
# delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
- $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
+ $$sym =~ /([^:]+)$/ or Carp::confess "Cannot autoload $who - $sym";
unshift @_, ($self, $1);
goto &{$self->can('call')} unless uc($1) eq $1;
};
Modified: trunk/inc/Module/Install/AutoInstall.pm
==============================================================================
--- trunk/inc/Module/Install/AutoInstall.pm (original)
+++ trunk/inc/Module/Install/AutoInstall.pm Wed Oct 31 06:28:48 2007
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.67';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: trunk/inc/Module/Install/Base.pm
==============================================================================
--- trunk/inc/Module/Install/Base.pm (original)
+++ trunk/inc/Module/Install/Base.pm Wed Oct 31 06:28:48 2007
@@ -1,7 +1,7 @@
#line 1
package Module::Install::Base;
-$VERSION = '0.64';
+$VERSION = '0.67';
# Suspend handler for "redefined" warnings
BEGIN {
Modified: trunk/inc/Module/Install/Can.pm
==============================================================================
--- trunk/inc/Module/Install/Can.pm (original)
+++ trunk/inc/Module/Install/Can.pm Wed Oct 31 06:28:48 2007
@@ -11,7 +11,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.67';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: trunk/inc/Module/Install/Fetch.pm
==============================================================================
--- trunk/inc/Module/Install/Fetch.pm (original)
+++ trunk/inc/Module/Install/Fetch.pm Wed Oct 31 06:28:48 2007
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.67';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: trunk/inc/Module/Install/Include.pm
==============================================================================
--- trunk/inc/Module/Install/Include.pm (original)
+++ trunk/inc/Module/Install/Include.pm Wed Oct 31 06:28:48 2007
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.67';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: trunk/inc/Module/Install/Makefile.pm
==============================================================================
--- trunk/inc/Module/Install/Makefile.pm (original)
+++ trunk/inc/Module/Install/Makefile.pm Wed Oct 31 06:28:48 2007
@@ -7,7 +7,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.67';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
@@ -17,192 +17,221 @@
my %seen = ();
sub prompt {
- shift;
+ shift;
- # Infinite loop protection
- my @c = caller();
- if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
- die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
- }
-
- # In automated testing, always use defaults
- if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
- local $ENV{PERL_MM_USE_DEFAULT} = 1;
- goto &ExtUtils::MakeMaker::prompt;
- } else {
- goto &ExtUtils::MakeMaker::prompt;
- }
+ # Infinite loop protection
+ my @c = caller();
+ if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
+ die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
+ }
+
+ # In automated testing, always use defaults
+ if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
+ local $ENV{PERL_MM_USE_DEFAULT} = 1;
+ goto &ExtUtils::MakeMaker::prompt;
+ } else {
+ goto &ExtUtils::MakeMaker::prompt;
+ }
}
sub makemaker_args {
- my $self = shift;
- my $args = ($self->{makemaker_args} ||= {});
- %$args = ( %$args, @_ ) if @_;
- $args;
+ my $self = shift;
+ my $args = ($self->{makemaker_args} ||= {});
+ %$args = ( %$args, @_ ) if @_;
+ $args;
}
# For mm args that take multiple space-seperated args,
# append an argument to the current list.
sub makemaker_append {
- my $self = shift;
- my $name = shift;
- my $args = $self->makemaker_args;
- $args->{name} = defined $args->{$name}
- ? join( ' ', $args->{name}, @_ )
- : join( ' ', @_ );
+ my $self = sShift;
+ my $name = shift;
+ my $args = $self->makemaker_args;
+ $args->{name} = defined $args->{$name}
+ ? join( ' ', $args->{name}, @_ )
+ : join( ' ', @_ );
}
sub build_subdirs {
- my $self = shift;
- my $subdirs = $self->makemaker_args->{DIR} ||= [];
- for my $subdir (@_) {
- push @$subdirs, $subdir;
- }
+ my $self = shift;
+ my $subdirs = $self->makemaker_args->{DIR} ||= [];
+ for my $subdir (@_) {
+ push @$subdirs, $subdir;
+ }
}
sub clean_files {
- my $self = shift;
- my $clean = $self->makemaker_args->{clean} ||= {};
- %$clean = (
- %$clean,
- FILES => join(' ', grep length, $clean->{FILES}, @_),
- );
+ my $self = shift;
+ my $clean = $self->makemaker_args->{clean} ||= {};
+ %$clean = (
+ %$clean,
+ FILES => join(' ', grep length, $clean->{FILES}, @_),
+ );
}
sub realclean_files {
- my $self = shift;
- my $realclean = $self->makemaker_args->{realclean} ||= {};
- %$realclean = (
- %$realclean,
- FILES => join(' ', grep length, $realclean->{FILES}, @_),
- );
+ my $self = shift;
+ my $realclean = $self->makemaker_args->{realclean} ||= {};
+ %$realclean = (
+ %$realclean,
+ FILES => join(' ', grep length, $realclean->{FILES}, @_),
+ );
}
sub libs {
- my $self = shift;
- my $libs = ref $_[0] ? shift : [ shift ];
- $self->makemaker_args( LIBS => $libs );
+ my $self = shift;
+ my $libs = ref $_[0] ? shift : [ shift ];
+ $self->makemaker_args( LIBS => $libs );
}
sub inc {
- my $self = shift;
- $self->makemaker_args( INC => shift );
+ my $self = shift;
+ $self->makemaker_args( INC => shift );
+}
+
+my %test_dir = ();
+
+sub _wanted_t {
+ /\.t$/ and -f $_ and $test_dir{$File::Find::dir} = 1;
+}
+
+sub tests_recursive {
+ my $self = shift;
+ if ( $self->tests ) {
+ die "tests_recursive will not work if tests are already defined";
+ }
+ my $dir = shift || 't';
+ unless ( -d $dir ) {
+ die "tests_recursive dir '$dir' does not exist";
+ }
+ require File::Find;
+ %test_dir = ();
+ File::Find::find( \&_wanted_t, $dir );
+ $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir );
}
sub write {
- my $self = shift;
- die "&Makefile->write() takes no arguments\n" if @_;
+ my $self = shift;
+ die "&Makefile->write() takes no arguments\n" if @_;
- my $args = $self->makemaker_args;
- $args->{DISTNAME} = $self->name;
- $args->{NAME} = $self->module_name || $self->name || $self->determine_NAME($args);
- $args->{VERSION} = $self->version || $self->determine_VERSION($args);
- $args->{NAME} =~ s/-/::/g;
- if ( $self->tests ) {
- $args->{test} = { TESTS => $self->tests };
- }
- if ($] >= 5.005) {
- $args->{ABSTRACT} = $self->abstract;
- $args->{AUTHOR} = $self->author;
- }
- if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) {
- $args->{NO_META} = 1;
- }
- if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) {
- $args->{SIGN} = 1;
- }
- unless ( $self->is_admin ) {
- delete $args->{SIGN};
- }
-
- # merge both kinds of requires into prereq_pm
- my $prereq = ($args->{PREREQ_PM} ||= {});
- %$prereq = ( %$prereq, map { @$_ } map { @$_ } grep $_,
- ($self->build_requires, $self->requires) );
-
- # merge both kinds of requires into prereq_pm
- my $subdirs = ($args->{DIR} ||= []);
- if ($self->bundles) {
- foreach my $bundle (@{ $self->bundles }) {
- my ($file, $dir) = @$bundle;
- push @$subdirs, $dir if -d $dir;
- delete $prereq->{$file};
- }
- }
-
- if ( my $perl_version = $self->perl_version ) {
- eval "use $perl_version; 1"
- or die "ERROR: perl: Version $] is installed, "
- . "but we need version >= $perl_version";
- }
-
- my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args;
- if ($self->admin->preop) {
- $args{dist} = $self->admin->preop;
- }
+ my $args = $self->makemaker_args;
+ $args->{DISTNAME} = $self->name;
+ $args->{NAME} = $self->module_name || $self->name || $self->determine_NAME($args);
+ $args->{VERSION} = $self->version || $self->determine_VERSION($args);
+ $args->{NAME} =~ s/-/::/g;
+ if ( $self->tests ) {
+ $args->{test} = { TESTS => $self->tests };
+ }
+ if ($] >= 5.005) {
+ $args->{ABSTRACT} = $self->abstract;
+ $args->{AUTHOR} = $self->author;
+ }
+ if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) {
+ $args->{NO_META} = 1;
+ }
+ if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) {
+ $args->{SIGN} = 1;
+ }
+ unless ( $self->is_admin ) {
+ delete $args->{SIGN};
+ }
+
+ # merge both kinds of requires into prereq_pm
+ my $prereq = ($args->{PREREQ_PM} ||= {});
+ %$prereq = ( %$prereq,
+ map { @$_ }
+ map { @$_ }
+ grep $_,
+ ($self->build_requires, $self->requires)
+ );
+
+ # merge both kinds of requires into prereq_pm
+ my $subdirs = ($args->{DIR} ||= []);
+ if ($self->bundles) {
+ foreach my $bundle (@{ $self->bundles }) {
+ my ($file, $dir) = @$bundle;
+ push @$subdirs, $dir if -d $dir;
+ delete $prereq->{$file};
+ }
+ }
+
+ if ( my $perl_version = $self->perl_version ) {
+ eval "use $perl_version; 1"
+ or die "ERROR: perl: Version $] is installed, "
+ . "but we need version >= $perl_version";
+ }
+
+ $args->{INSTALLDIRS} = $self->installdirs;
+
+ my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args;
+
+ my $user_preop = delete $args{dist}->{PREOP};
+ if (my $preop = $self->admin->preop($user_preop)) {
+ $args{dist} = $preop;
+ }
- my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
- $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile');
+ my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
+ $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile');
}
sub fix_up_makefile {
- my $self = shift;
- my $makefile_name = shift;
- my $top_class = ref($self->_top) || '';
- my $top_version = $self->_top->VERSION || '';
-
- my $preamble = $self->preamble
- ? "# Preamble by $top_class $top_version\n"
- . $self->preamble
- : '';
- my $postamble = "# Postamble by $top_class $top_version\n"
- . ($self->postamble || '');
-
- local *MAKEFILE;
- open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
- my $makefile = do { local $/; <MAKEFILE> };
- close MAKEFILE or die $!;
-
- $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
- $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
- $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
- $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;
- $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m;
-
- # Module::Install will never be used to build the Core Perl
- # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks
- # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist
- $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
- #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
-
- # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
- $makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g;
-
- # XXX - This is currently unused; not sure if it breaks other MM-users
- # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
-
- open MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
- print MAKEFILE "$preamble$makefile$postamble" or die $!;
- close MAKEFILE or die $!;
+ my $self = shift;
+ my $makefile_name = shift;
+ my $top_class = ref($self->_top) || '';
+ my $top_version = $self->_top->VERSION || '';
+
+ my $preamble = $self->preamble
+ ? "# Preamble by $top_class $top_version\n"
+ . $self->preamble
+ : '';
+ my $postamble = "# Postamble by $top_class $top_version\n"
+ . ($self->postamble || '');
+
+ local *MAKEFILE;
+ open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+ my $makefile = do { local $/; <MAKEFILE> };
+ close MAKEFILE or die $!;
+
+ $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
+ $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
+ $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
+ $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;
+ $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m;
+
+ # Module::Install will never be used to build the Core Perl
+ # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks
+ # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist
+ $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
+ #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
+
+ # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
+ $makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g;
+
+ # XXX - This is currently unused; not sure if it breaks other MM-users
+ # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
+
+ open MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+ print MAKEFILE "$preamble$makefile$postamble" or die $!;
+ close MAKEFILE or die $!;
- 1;
+ 1;
}
sub preamble {
- my ($self, $text) = @_;
- $self->{preamble} = $text . $self->{preamble} if defined $text;
- $self->{preamble};
+ my ($self, $text) = @_;
+ $self->{preamble} = $text . $self->{preamble} if defined $text;
+ $self->{preamble};
}
sub postamble {
- my ($self, $text) = @_;
- $self->{postamble} ||= $self->admin->postamble;
- $self->{postamble} .= $text if defined $text;
- $self->{postamble}
+ my ($self, $text) = @_;
+ $self->{postamble} ||= $self->admin->postamble;
+ $self->{postamble} .= $text if defined $text;
+ $self->{postamble}
}
1;
__END__
-#line 334
+#line 363
Modified: trunk/inc/Module/Install/Metadata.pm
==============================================================================
--- trunk/inc/Module/Install/Metadata.pm (original)
+++ trunk/inc/Module/Install/Metadata.pm Wed Oct 31 06:28:48 2007
@@ -6,14 +6,14 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.67';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
my @scalar_keys = qw{
name module_name abstract author version license
- distribution_type perl_version tests
+ distribution_type perl_version tests installdirs
};
my @tuple_keys = qw{
@@ -56,9 +56,23 @@
};
}
+# configure_requires is currently a null-op
+sub configure_requires { 1 }
+
+# Aliases for build_requires that will have alternative
+# meanings in some future version of META.yml.
+sub test_requires { shift->build_requires(@_) }
+sub install_requires { shift->build_requires(@_) }
+
+# Aliases for installdirs options
+sub install_as_core { $_[0]->installdirs('perl') }
+sub install_as_cpan { $_[0]->installdirs('site') }
+sub install_as_site { $_[0]->installdirs('site') }
+sub install_as_vendor { $_[0]->installdirs('vendor') }
+
sub sign {
my $self = shift;
- return $self->{'values'}{'sign'} if defined wantarray and !@_;
+ return $self->{'values'}{'sign'} if defined wantarray and ! @_;
$self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 );
return $self;
}
@@ -279,9 +293,11 @@
if (
$self->_slurp($file) =~ m/
- =head \d \s+
- (?:licen[cs]e|licensing|copyright|legal)\b
- (.*?)
+ (
+ =head \d \s+
+ (?:licen[cs]e|licensing|copyright|legal)\b
+ .*?
+ )
(=head\\d.*|=cut.*|)
\z
/ixms
@@ -289,19 +305,24 @@
{
my $license_text = $1;
my @phrases = (
- 'under the same (?:terms|license) as perl itself' => 'perl',
- 'GNU public license' => 'gpl',
- 'GNU lesser public license' => 'gpl',
- 'BSD license' => 'bsd',
- 'Artistic license' => 'artistic',
- 'GPL' => 'gpl',
- 'LGPL' => 'lgpl',
- 'BSD' => 'bsd',
- 'Artistic' => 'artistic',
+ 'under the same (?:terms|license) as perl itself' => 'perl', 1,
+ 'GNU public license' => 'gpl', 1,
+ 'GNU lesser public license' => 'gpl', 1,
+ 'BSD license' => 'bsd', 1,
+ 'Artistic license' => 'artistic', 1,
+ 'GPL' => 'gpl', 1,
+ 'LGPL' => 'lgpl', 1,
+ 'BSD' => 'bsd', 1,
+ 'Artistic' => 'artistic', 1,
+ 'MIT' => 'mit', 1,
+ 'proprietary' => 'proprietary', 0,
);
- while ( my ( $pattern, $license ) = splice( @phrases, 0, 2 ) ) {
+ while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
+ if ( $osi and $license_text =~ /All rights reserved/i ) {
+ warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it.";
+ }
$self->license($license);
return 1;
}
Modified: trunk/inc/Module/Install/Scripts.pm
==============================================================================
--- trunk/inc/Module/Install/Scripts.pm (original)
+++ trunk/inc/Module/Install/Scripts.pm Wed Oct 31 06:28:48 2007
@@ -7,7 +7,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.67';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: trunk/inc/Module/Install/Win32.pm
==============================================================================
--- trunk/inc/Module/Install/Win32.pm (original)
+++ trunk/inc/Module/Install/Win32.pm Wed Oct 31 06:28:48 2007
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.67';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: trunk/inc/Module/Install/WriteAll.pm
==============================================================================
--- trunk/inc/Module/Install/WriteAll.pm (original)
+++ trunk/inc/Module/Install/WriteAll.pm Wed Oct 31 06:28:48 2007
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.67';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: trunk/lib/SVK/Command/Patch.pm
==============================================================================
--- trunk/lib/SVK/Command/Patch.pm (original)
+++ trunk/lib/SVK/Command/Patch.pm Wed Oct 31 06:28:48 2007
@@ -239,11 +239,13 @@
$mergecmd->get_commit_message ($patch->{log})
unless $dst->isa('SVK::Path::Checkout');
my $merge = SVK::Merge->new (%$mergecmd, dst => $dst, repos => $dst->repos);
- $ticket = sub { $merge->get_new_ticket (SVK::Merge::Info->new ($patch->{ticket})) }
+ my $dstinfo = $merge->merge_info($dst);
+ $ticket = $merge->_get_new_ticket (SVK::Merge::Info->new ($patch->{ticket}))
if $patch->{ticket} && $dst->universal->same_resource ($patch->{target});
$patch->apply_to ($dst, $mergecmd->get_editor ($dst),
resolve => $merge->resolver,
- ticket => $ticket);
+ ticket => $ticket,
+ dstinfo => $dstinfo);
delete $mergecmd->{save_message};
return;
}
Modified: trunk/lib/SVK/Editor/Merge.pm
==============================================================================
--- trunk/lib/SVK/Editor/Merge.pm (original)
+++ trunk/lib/SVK/Editor/Merge.pm Wed Oct 31 06:28:48 2007
@@ -58,7 +58,7 @@
use autouse 'SVK::Util'
=> qw( slurp_fh md5_fh tmpfile devnull abs2rel );
-__PACKAGE__->mk_accessors(qw(inspector notify storage));
+__PACKAGE__->mk_accessors(qw(inspector notify storage ticket cb_merged));
use Class::Autouse qw(SVK::Inspector::Root SVK::Notify
Data::Hierarchy IO::Digest);
@@ -227,21 +227,27 @@
$self->{storage}->set_target_revision ($revision);
}
+sub set_ticket {
+ my ($self, $baton, $type, $pool) = @_;
+
+ my $func = "change_${type}_prop";
+
+ $self->{storage}->$func( $baton, 'svk:merge', $self->ticket->as_string, $pool );
+
+}
+
sub open_root {
- my ($self, $baserev) = @_;
+ my ($self, $baserev, $pool) = @_;
$self->{baserev} = $baserev;
$self->{notify} ||= SVK::Notify->new_with_report ($self->{report}, $self->{target});
$self->{storage_baton}{''} =
$self->{storage}->open_root ($self->{cb_rev}->($self->{target}||''));
$self->{notify}->node_status ('', '');
- my $ticket = $self->{ticket};
$self->{dh} = Data::Hierarchy->new;
- $self->{cb_merged} =
- sub { my ($editor, $baton, $type, $pool) = @_;
- my $func = "change_${type}_prop";
- $editor->$func ($baton, 'svk:merge', $ticket->(), $pool);
- } if $ticket;
+
+ $self->set_ticket($self->{storage_baton}{''}, 'dir', $pool)
+ if !length $self->{target} && $self->ticket;
return '';
}
@@ -329,7 +335,10 @@
$self->{storage}->open_file ($path, $self->{storage_baton}{$pdir},
$self->{cb_rev}->($path), $pool);
++$self->{changes};
- delete $self->{info}{$path}{open};
+ delete $self->{info}{$path}{open}; #
+
+ $self->set_ticket( $self->{storage_baton}{$path}, 'file', $pool )
+ if $path eq $self->{target} && $self->ticket;
}
sub ensure_close {
@@ -340,9 +349,9 @@
$self->{cb_closed}->($path, $checksum, $pool)
if $self->{cb_closed};
- if ($path eq $self->{target} && $self->{changes} && $self->{cb_merged}) {
+ if ($path eq $self->{target} && $self->cb_merged) {
$self->ensure_open ($path);
- $self->{cb_merged}->($self->{storage}, $self->{storage_baton}{$path}, 'file', $pool);
+ $self->cb_merged->($self->{changes},'file', $self->{ticket});
}
if (my $baton = $self->{storage_baton}{$path}) {
@@ -669,9 +678,12 @@
}
}
$self->{notify}->node_status ($path, '');
- $self->{storage_baton}{$path} =
+ my $baton = $self->{storage_baton}{$path} =
$self->{storage}->open_directory ($path, $self->{storage_baton}{$pdir},
$self->{cb_rev}->($path), @arg);
+ $self->set_ticket->($baton, 'dir', $pool)
+ if $path eq $self->{target} && $self->ticket;
+
return $path;
}
@@ -684,8 +696,9 @@
$self->{notify}->flush_dir ($path);
my $baton = $self->{storage_baton}{$path};
- $self->{cb_merged}->($self->{storage}, $baton, 'dir', $pool)
- if $path eq $self->{target} && $self->{changes} && $self->{cb_merged};
+ $self->cb_merged->( $self->{changes}, 'dir', $self->{ticket})
+ if $path eq $self->{target} && $self->cb_merged;
+
$self->{storage}->close_directory ($baton, $pool);
delete $self->{storage_baton}{$path}
Modified: trunk/lib/SVK/Merge.pm
==============================================================================
--- trunk/lib/SVK/Merge.pm (original)
+++ trunk/lib/SVK/Merge.pm Wed Oct 31 06:28:48 2007
@@ -346,20 +346,29 @@
return $minfo;
}
-sub get_new_ticket {
+sub _get_new_ticket {
my ($self, $srcinfo) = @_;
- my $dstinfo = $self->merge_info ($self->{dst});
+ my $dstinfo = $self->merge_info($self->{dst});
# We want the ticket representing src, but not dst.
- my $newinfo = $dstinfo->union ($srcinfo)->del_target ($self->{dst});
- unless ($self->{quiet}) {
- for (sort keys %$newinfo) {
- $logger->info(loc("New merge ticket: %1:%2", $_, $newinfo->{$_}{rev}))
- if !$dstinfo->{$_} || $newinfo->{$_}{rev} > $dstinfo->{$_}{rev};
- }
- }
+ return $dstinfo->union ($srcinfo)->del_target($self->{dst});
+}
+
+# deprecated
+sub get_new_ticket {
+ my ($self, $srcinfo) = @_;
+ my $newinfo = $self->_get_new_ticket($srcinfo);
+ $self->print_new_ticket($newinfo);
return $newinfo->as_string;
}
+sub print_new_ticket {
+ my ($self, $dstinfo, $newinfo) = @_;
+ for (sort keys %$newinfo) {
+ $logger->info(loc("New merge ticket: %1:%2", $_, $newinfo->{$_}{rev}))
+ if !$dstinfo->{$_} || $newinfo->{$_}{rev} > $dstinfo->{$_}{rev};
+ }
+}
+
sub log {
my ($self, $no_separator) = @_;
open my $buf, '>', \ (my $tmp = '');
@@ -529,6 +538,8 @@
# $cb{inspector} = $self->{dst}->inspector
# unless ref($cb{inspector}) eq 'SVK::Inspector::Compat' ;
+ my $dstinfo = $self->merge_info($self->{dst});
+
my $meditor = SVK::Editor::Merge->new
( anchor => $src->path_anchor,
repospath => $src->repospath, # for stupid copyfrom url
@@ -555,8 +566,18 @@
(SVK::Merge::Info->new ($prop->{local}))->as_string);
}
},
- ticket =>
- sub { $self->get_new_ticket ($self->merge_info_with_copy ($src)->add_target ($src)) }
+ ticket =>
+ $self->_get_new_ticket($self->merge_info_with_copy($src)->add_target($src)),
+ cb_merged => sub {
+ my ($changes, $type, $ticket) = @_;
+ if (!$changes) { # rollback all ticket
+ my $func = "change_${type}_prop";
+ my $baton = $storage->open_root ($cb{cb_rev}->($cb{target}||''));
+ $storage->$func( $baton, 'svk:merge', undef );
+ return;
+ }
+ $self->print_new_ticket( $dstinfo, $ticket ) unless $self->{quiet};
+ }
) :
( prop_resolver => { 'svk:merge' => sub { ('G', undef, 1)} # skip
}),
Modified: trunk/lib/SVK/Patch.pm
==============================================================================
--- trunk/lib/SVK/Patch.pm (original)
+++ trunk/lib/SVK/Patch.pm Wed Oct 31 06:28:48 2007
@@ -292,6 +292,16 @@
: ()
),
%cb,
+ cb_merged => sub {
+ my ($changes, $type, $ticket) = @_;
+ if (!$changes) { # rollback all ticket
+ my $func = "change_${type}_prop";
+ my $baton = $storage->open_root ($cb{cb_rev}->($cb{target}||''));
+ $storage->$func( $baton, 'svk:merge', undef );
+ return;
+ }
+ SVK::Merge->print_new_ticket( $cb{dstinfo}, $ticket );
+ }
);
$self->{editor}->drive ($editor);
return $editor->{conflicts};
Modified: trunk/t/07smerge-bidi-inc.t
==============================================================================
--- trunk/t/07smerge-bidi-inc.t (original)
+++ trunk/t/07smerge-bidi-inc.t Wed Oct 31 06:28:48 2007
@@ -5,7 +5,7 @@
use File::Path;
use SVK::Test;
-plan tests => 6;
+plan tests => 7;
# These tests actually use push and pull, in the hope that I'll get less
# confused. This should be okay, because other tests demonstrate that
@@ -110,6 +110,16 @@
$svk->commit ('-m', 'more changes in remote depot', "$corpath_test");
chdir ($corpath_default);
+# server should be less strict
+is_output ($svk, 'push', [], [
+ "Auto-merging (10, 12) /l to /m (base /l:10).",
+ "===> Auto-merging (10, 12) /l to /m (base /l:10).",
+ "Merging back to mirror source $uri/A.",
+ qr"Transaction is out of date: Out of date: '/A' in transaction '.*'",
+ 'Please sync mirrored path /m first.']);
+
+$svk->sync('//m');
+
is_output ($svk, 'push', [], [
"Auto-merging (10, 12) /l to /m (base /l:10).",
"===> Auto-merging (10, 12) /l to /m (base /l:10).",
@@ -118,9 +128,7 @@
"New merge ticket: $default_uuid:/l:12",
"Merge back committed as revision 8.",
"Syncing $uri/A",
- "Retrieving log information from 6 to 8",
- "Committed revision 13 from revision 6.",
- "Committed revision 14 from revision 7.",
+ "Retrieving log information from 8 to 8",
"Committed revision 15 from revision 8."]);
append_file ("$corpath_default/be", "and more content\n");
Modified: trunk/t/36push-pull.t
==============================================================================
--- trunk/t/36push-pull.t (original)
+++ trunk/t/36push-pull.t Wed Oct 31 06:28:48 2007
@@ -5,7 +5,7 @@
use File::Path;
use SVK::Test;
-plan tests => 15;
+plan tests => 18;
my $initial_cwd = getcwd;
@@ -195,6 +195,23 @@
chdir ($corpath_second);
our $output;
+# Server should be less strict, before that we need sync first
+# so we first expect it is bzz here
+# These added tests should be removed after server side less strict
+is_output ($svk, 'push', [],
+ ['Auto-merging (0, 25) /l2 to /m (base /m:16).',
+ '===> Auto-merging (0, 18) /l2 to /m (base /m:16).',
+ "Merging back to mirror source $uri/A.",
+ qr"Transaction is out of date: Out of date: '/A' in transaction '.*'",
+ 'Please sync mirrored path /m first.']);
+
+# syncing
+is_output ($svk, "sync", ['//m'], [
+ "Syncing $uri/A",
+ "Retrieving log information from 11 to 11",
+ "Committed revision 26 from revision 11."]);
+
+# expect it is
is_output ($svk, 'push', [],
['Auto-merging (0, 25) /l2 to /m (base /m:16).',
'===> Auto-merging (0, 18) /l2 to /m (base /m:16).',
@@ -202,8 +219,8 @@
'Empty merge.',
'===> Auto-merging (18, 25) /l2 to /m (base /m:16).',
"Merging back to mirror source $uri/A.",
- qr"Transaction is out of date: Out of date: '/A/Q/qz' in transaction '.*'",
- 'Please sync mirrored path /m first.']);
+ "g Q/qz",
+ 'Empty merge.']);
overwrite_file ("$corpath_test/push-newfile", "sync and not merged immediately\n");
$svk->add("$corpath_test/push-newfile");
@@ -230,6 +247,17 @@
append_file("$corpath_test/new-file", "more modification that will get overwritten if using wrong merge base\n");
$svk->commit (-m => 'change something', $corpath_test);
+# Server should be less strict, before that we need sync first
+# so we first expect it is bzz here
+is_output($svk, 'push', [],
+ ['Auto-merging (0, 29) /l2 to /m (base /m:27).',
+ '===> Auto-merging (0, 18) /l2 to /m (base /m:16).',
+ "Merging back to mirror source $uri/A.",
+ qr"Transaction is out of date: Out of date: '/A' in transaction '.*'",
+ 'Please sync mirrored path /m first.']);
+# syncing
+$svk->sync('//m');
+
is_output($svk, 'push', [],
['Auto-merging (0, 29) /l2 to /m (base /m:27).',
'===> Auto-merging (0, 18) /l2 to /m (base /m:16).',
@@ -246,8 +274,7 @@
qr'New merge ticket: .*:/l2:28',
'Merge back committed as revision 14.',
"Syncing $uri/A",
- 'Retrieving log information from 13 to 14',
- 'Committed revision 30 from revision 13.',
+ 'Retrieving log information from 14 to 14',
'Committed revision 31 from revision 14.',
'===> Auto-merging (28, 29) /l2 to /m (base */l2:28).',
"Merging back to mirror source $uri/A.",
More information about the svk-commit
mailing list