[svk-commit] r2212 - in trunk: lib/SVK t

nobody at bestpractical.com nobody at bestpractical.com
Fri Dec 1 16:24:37 EST 2006


Author: clkao
Date: Fri Dec  1 16:24:36 2006
New Revision: 2212

Modified:
   trunk/   (props changed)
   trunk/lib/SVK/Root.pm
   trunk/t/23commit-mirror.t

Log:
 r7371 at ubuntu (orig r2207):  clkao | 2006-12-01 11:21:03 +0000
 Only cleanup txn root in the same process if cleanup_pid is speicified.
 This fixes a warning after committing to mirror from a mixed-revision
 checkout.
 


Modified: trunk/lib/SVK/Root.pm
==============================================================================
--- trunk/lib/SVK/Root.pm	(original)
+++ trunk/lib/SVK/Root.pm	Fri Dec  1 16:24:36 2006
@@ -54,7 +54,7 @@
 
 use base qw{ Class::Accessor::Fast };
 
-__PACKAGE__->mk_accessors(qw(root txn pool));
+__PACKAGE__->mk_accessors(qw(root txn pool cleanup_pid));
 
 sub AUTOLOAD {
     my $func = our $AUTOLOAD;
@@ -76,12 +76,20 @@
     goto &$func;
 }
 
+sub new {
+    my $class = shift;
+    my $self = $class->SUPER::new(@_);
+    $self->{createdby} = join(' ', (caller(2))[0..2]);
+    return $self;
+}
+
 sub DESTROY {
     return unless $_[0]->txn;
     # if this destructor is called upon the pool cleanup which holds the
     # txn also, we need to use a new pool, otherwise it segfaults for
     # doing allocation in a pool that is being destroyed.
-    $_[0]->txn->abort(SVN::Pool->new) if $_[0]->txn;
+    $_[0]->txn->abort( SVN::Pool->new )
+        if $_[0]->txn && ( $_[0]->cleanup_pid || $$ ) == $$;
 }
 
 # return the root and path on the given revnum, the returned path is
@@ -96,7 +104,7 @@
 sub txn_root {
     my ($self, $pool) = @_;
     my $txn = $self->fs->begin_txn($self->revision_root_revision, $pool);
-    return $self->new({ txn => $txn, root => $txn->root($pool) });
+    return $self->new({ txn => $txn, root => $txn->root($pool), cleanup_pid => $$ });
 }
 
 sub same_root {

Modified: trunk/t/23commit-mirror.t
==============================================================================
--- trunk/t/23commit-mirror.t	(original)
+++ trunk/t/23commit-mirror.t	Fri Dec  1 16:24:36 2006
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 use SVK::Test;
-plan tests => 7;
+plan tests => 8;
 
 my ($xd, $svk) = build_test('test');
 
@@ -42,7 +42,16 @@
 
 append_file ("$copath/remote/A/direct-file", "modified on A\n");
 $svk->add ("$copath/remote/A/direct-file");
+$svk->up(-r6 => "$copath/local/A/be");
+is_output($svk, 'ci', [-m => 'commit from mixed-revision checkout', "$copath/remote"],
+	  ['Commit into mirrored path: merging back directly.',
+	   "Merging back to mirror source $uri.",
+	   'Merge back committed as revision 4.',
+	   "Syncing $uri",
+	   'Retrieving log information from 4 to 4',
+	   'Committed revision 8 from revision 4.']);
 
+append_file ("$copath/remote/A/direct-file", "more modification on A\n");
 # this ruins the mirror state
 is_output ($svk, 'commit', ['--direct', '-m', 'modify A directly', "$copath/remote"],
-	   ['Committed revision 8.']);
+	   ['Committed revision 9.']);


More information about the svk-commit mailing list