You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Roger Lipscombe <ro...@1e.com> on 2008/07/04 09:01:29 UTC

RE: Pin Externals when tagging?

No responses?

I've done some further research, and found issues #1258 and #1336. #1336 comprises the support for relative externals, but doesn't address pinning them in a copy. #1258 appears to be the origin of svncopy.pl. So, let me simplify my question:

Can a *server-side* hook pin or unpin externals as part of a commit?

Cheers,
Roger.

-----Original Message-----
From: Roger Lipscombe
Sent: Mon 30 June 2008 11:36
To: 'users@subversion.tigris.org'
Subject: Pin Externals when tagging?

Now that SVN 1.5 has relative externals, we're looking at using it for our internal libraries. We've got several projects, each with its own trunk, tags and branches. Each project uses (some of) the same set of shared static libraries. Up to now, we've given each project its own copy, but this is a maintenance headache, because we have to periodically merge from each project back to the original libraries, and then bring down the updates into each project's trunk.

I thought that relative svn:externals might address this problem, because I could just use (e.g.) "svn:externals = ^/shared/Lib/Misc Lib/Misc" to bring the relevant shared libraries into each of the projects that use them.

(We've not used absolute svn:externals up to now, because the repos is made available externally on a different address (HTTPS) than the internal (HTTP) address).

The problem I'm having is that, when a user creates a tag or a branch, I'd like to be able to pin the externals to the current revision. There was some discussion on the TSVN list about this: http://svn.haxx.se/tsvn/archive-2007-04/0088.shtml (for example), and there's svncopy.pl in SVN's contrib/client-side directory. My problem is that all of my users use TSVN, and they'll not want to use a client-side script (let alone one that requires them to install Perl). Moreover, our continuous integration server (which tags each build automatically) uses SVNKit.

So, my question: in the absence of TSVN supporting a "pin-externals" option (as in the discussion I've linked), is there anything I can do in a server-side hook to pin the externals revisions when tagging or branching?

Alternatively, one of the ideas in the TSVN discussion was _always_ pinning the externals (and, presumably, jumping forward periodically). Is this a good idea? I'm not convinced, because I want a way for people editing a project trunk to be able to make changes to the externals and commit those as well.

Regards,
Roger.



DISCLAIMER: This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind 1E Ltd to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Pin Externals when tagging?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jul 4, 2008, at 04:21, Roger Lipscombe wrote:

> Thanks for that. Since we're on Windows, I'll probably have to  
> convert that to PowerShell to keep the IT bods happy, but it'll help.

Perl is an extremely popular scripting language which of course  
exists for Windows as well. Hopefully your IT staff is there to help  
you, in which case they should allow perl to be installed.


> On 04.07.2008, at 11:01, Roger Lipscombe wrote:
>
>> No responses?
>>
>> I've done some further research, and found issues #1258 and #1336.
>> #1336 comprises the support for relative externals, but doesn't
>> address pinning them in a copy. #1258 appears to be the origin of
>> svncopy.pl. So, let me simplify my question:
>>
>> Can a *server-side* hook pin or unpin externals as part of a commit?

A server-side hook cannot change the incoming transaction data in any  
way. (Well, it can change revision properties, but svn:externals is a  
file property, not a revision property, so it cannot change that.)  
The best you can do is commit a second revision after the fact to fix  
things that were incorrect in the initial revision. But that requires  
the server to deal with maintaining a working copy for this task and  
it can be complicated.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: Pin Externals when tagging?

Posted by Roger Lipscombe <ro...@1e.com>.
Thanks for that. Since we're on Windows, I'll probably have to convert that to PowerShell to keep the IT bods happy, but it'll help.

Cheers,
Roger.

-----Original Message-----
From: Christian Unger [mailto:christian.unger@mac.com]
Sent: Fri 04 July 2008 10:09
To: Roger Lipscombe
Cc: 'users@subversion.tigris.org'
Subject: Re: Pin Externals when tagging?

#!/usr/bin/env perl -w

use strict;
use Getopt::Long;
use Cwd;
use File::Basename;

my $parentDir = getcwd;
my @updatedExternalDefinitions;

our $logDirectory               = "/Library/Logs/revisionTagging/";
`/bin/mkdir -p $logDirectory`;
our $logFileName                = "tags.log";

chomp (my @svn = __pipeCommand('which', 'svn'));
chomp @svn;

GetOptions (
        'svn=s'                 =>      \@svn,
        'parent=s'              =>      \$parentDir,
        'tagURL=s'              =>      \my $tagURL,
);

die "No tag url provided" unless $tagURL;
chdir $parentDir || die "$!\n";

$tagURL =~/.*\/(.*?)$/;
my $tagName = $1;

my @parentInfo = __pipeCommand(@svn, 'info');
$parentInfo[2] =~/^Repository Root: (http.*?)$/;
chomp ( my $repositoryRoot =  $1 );

my @externals = __pipeCommand(@svn, 'propget', 'svn:externals', '.');
chomp @externals;

foreach (@externals) {
        if (/^(.*?)\s(http.*?)$/) {
                my $external = $1;
                my $url = $2;
                chdir $external;
                my @svnInfo = __pipeCommand(@svn, 'info');
                $svnInfo[8] =~/.*?(\d+)/;
                push @updatedExternalDefinitions, ($external . " -r " . $1 . " " .
$url . "\n");
                chdir $parentDir;
        }
}

# create a temporary working directory
chomp( my $random_number        = qx/uuidgen/);
my $tagTmpDir           = "/tmp/" . $random_number;
__pipeCommand('/bin/mkdir', '-p', $tagTmpDir);
chdir "$tagTmpDir";

__pipeCommand(@svn, 'co', '-N', $tagURL, $tagName);

my $tmpFilename = "updatedExternalDefinitions";

open( my $fh, ">$tmpFilename" ) ||
     die "can't create $tmpFilename $!" ;
print $fh @updatedExternalDefinitions ;

__pipeCommand(@svn, 'pset', 'svn:externals', '-F', $tmpFilename,
$tagName );
__pipeCommand(@svn, 'ci', $tagName, '-m"tagged last succsessful
build"');

sub __pipeCommand {
        __LOG("\n" . (scalar localtime) . "\n");
        __LOG(join(' ', @_));
        open (PIPE, "@_ 2>&1 |");
        my @returnValues = <PIPE>;
        close(PIPE);
        __LOG(@returnValues);
        return @returnValues;
}

sub __LOG {
        eval {
                open (my $log, ">>",$logDirectory . "/" . $logFileName);
                print $log @_;
                print $log "\n";
                print STDOUT @_;
                print STDOUT "\n";
        }
}

cu
christian unger




On 04.07.2008, at 11:01, Roger Lipscombe wrote:

> No responses?
>
> I've done some further research, and found issues #1258 and #1336.
> #1336 comprises the support for relative externals, but doesn't
> address pinning them in a copy. #1258 appears to be the origin of
> svncopy.pl. So, let me simplify my question:
>
> Can a *server-side* hook pin or unpin externals as part of a commit?
>
> Cheers,
> Roger.
>
> -----Original Message-----
> From: Roger Lipscombe
> Sent: Mon 30 June 2008 11:36
> To: 'users@subversion.tigris.org'
> Subject: Pin Externals when tagging?
>
> Now that SVN 1.5 has relative externals, we're looking at using it
> for our internal libraries. We've got several projects, each with
> its own trunk, tags and branches. Each project uses (some of) the
> same set of shared static libraries. Up to now, we've given each
> project its own copy, but this is a maintenance headache, because we
> have to periodically merge from each project back to the original
> libraries, and then bring down the updates into each project's trunk.
>
> I thought that relative svn:externals might address this problem,
> because I could just use (e.g.) "svn:externals = ^/shared/Lib/Misc
> Lib/Misc" to bring the relevant shared libraries into each of the
> projects that use them.
>
> (We've not used absolute svn:externals up to now, because the repos
> is made available externally on a different address (HTTPS) than the
> internal (HTTP) address).
>
> The problem I'm having is that, when a user creates a tag or a
> branch, I'd like to be able to pin the externals to the current
> revision. There was some discussion on the TSVN list about this: http://svn.haxx.se/tsvn/archive-2007-04/0088.shtml
>  (for example), and there's svncopy.pl in SVN's contrib/client-side
> directory. My problem is that all of my users use TSVN, and they'll
> not want to use a client-side script (let alone one that requires
> them to install Perl). Moreover, our continuous integration server
> (which tags each build automatically) uses SVNKit.
>
> So, my question: in the absence of TSVN supporting a "pin-externals"
> option (as in the discussion I've linked), is there anything I can
> do in a server-side hook to pin the externals revisions when tagging
> or branching?
>
> Alternatively, one of the ideas in the TSVN discussion was _always_
> pinning the externals (and, presumably, jumping forward
> periodically). Is this a good idea? I'm not convinced, because I
> want a way for people editing a project trunk to be able to make
> changes to the externals and commit those as well.
>
> Regards,
> Roger.
>
>
>
> DISCLAIMER: This is a PRIVATE message. If you are not the intended
> recipient, please delete without copying and kindly advise us by e-
> mail of the mistake in delivery. NOTE: Regardless of content, this e-
> mail shall not operate to bind 1E Ltd to any order or other contract
> unless pursuant to explicit written agreement or government
> initiative expressly permitting the use of e-mail for such purpose
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Pin Externals when tagging?

Posted by Christian Unger <ch...@mac.com>.
#!/usr/bin/env perl -w

use strict;
use Getopt::Long;
use Cwd;
use File::Basename;

my $parentDir = getcwd;
my @updatedExternalDefinitions;

our $logDirectory		= "/Library/Logs/revisionTagging/";
`/bin/mkdir -p $logDirectory`;
our $logFileName		= "tags.log";

chomp (my @svn = __pipeCommand('which', 'svn'));
chomp @svn;

GetOptions (
	'svn=s'			=>	\@svn,
	'parent=s'		=>	\$parentDir,
	'tagURL=s'		=>	\my $tagURL,
);

die "No tag url provided" unless $tagURL;
chdir $parentDir || die "$!\n";

$tagURL =~/.*\/(.*?)$/;
my $tagName = $1;

my @parentInfo = __pipeCommand(@svn, 'info');
$parentInfo[2] =~/^Repository Root: (http.*?)$/;
chomp ( my $repositoryRoot =  $1 );

my @externals = __pipeCommand(@svn, 'propget', 'svn:externals', '.');
chomp @externals;

foreach (@externals) {
	if (/^(.*?)\s(http.*?)$/) {
		my $external = $1;
		my $url = $2;
		chdir $external;
		my @svnInfo = __pipeCommand(@svn, 'info');
		$svnInfo[8] =~/.*?(\d+)/;
		push @updatedExternalDefinitions, ($external . " -r " . $1 . " " .  
$url . "\n");
		chdir $parentDir;
	}
}

# create a temporary working directory
chomp( my $random_number	= qx/uuidgen/);
my $tagTmpDir		= "/tmp/" . $random_number;
__pipeCommand('/bin/mkdir', '-p', $tagTmpDir);
chdir "$tagTmpDir";

__pipeCommand(@svn, 'co', '-N', $tagURL, $tagName);

my $tmpFilename = "updatedExternalDefinitions";

open( my $fh, ">$tmpFilename" ) ||
     die "can't create $tmpFilename $!" ;
print $fh @updatedExternalDefinitions ;

__pipeCommand(@svn, 'pset', 'svn:externals', '-F', $tmpFilename,  
$tagName );
__pipeCommand(@svn, 'ci', $tagName, '-m"tagged last succsessful  
build"');

sub __pipeCommand {
	__LOG("\n" . (scalar localtime) . "\n");
	__LOG(join(' ', @_));
	open (PIPE, "@_ 2>&1 |");
	my @returnValues = <PIPE>;
	close(PIPE);
	__LOG(@returnValues);
	return @returnValues;
}

sub __LOG {
	eval {
		open (my $log, ">>",$logDirectory . "/" . $logFileName);
		print $log @_;
		print $log "\n";
		print STDOUT @_;
		print STDOUT "\n";
	}
}

cu
christian unger




On 04.07.2008, at 11:01, Roger Lipscombe wrote:

> No responses?
>
> I've done some further research, and found issues #1258 and #1336.  
> #1336 comprises the support for relative externals, but doesn't  
> address pinning them in a copy. #1258 appears to be the origin of  
> svncopy.pl. So, let me simplify my question:
>
> Can a *server-side* hook pin or unpin externals as part of a commit?
>
> Cheers,
> Roger.
>
> -----Original Message-----
> From: Roger Lipscombe
> Sent: Mon 30 June 2008 11:36
> To: 'users@subversion.tigris.org'
> Subject: Pin Externals when tagging?
>
> Now that SVN 1.5 has relative externals, we're looking at using it  
> for our internal libraries. We've got several projects, each with  
> its own trunk, tags and branches. Each project uses (some of) the  
> same set of shared static libraries. Up to now, we've given each  
> project its own copy, but this is a maintenance headache, because we  
> have to periodically merge from each project back to the original  
> libraries, and then bring down the updates into each project's trunk.
>
> I thought that relative svn:externals might address this problem,  
> because I could just use (e.g.) "svn:externals = ^/shared/Lib/Misc  
> Lib/Misc" to bring the relevant shared libraries into each of the  
> projects that use them.
>
> (We've not used absolute svn:externals up to now, because the repos  
> is made available externally on a different address (HTTPS) than the  
> internal (HTTP) address).
>
> The problem I'm having is that, when a user creates a tag or a  
> branch, I'd like to be able to pin the externals to the current  
> revision. There was some discussion on the TSVN list about this: http://svn.haxx.se/tsvn/archive-2007-04/0088.shtml 
>  (for example), and there's svncopy.pl in SVN's contrib/client-side  
> directory. My problem is that all of my users use TSVN, and they'll  
> not want to use a client-side script (let alone one that requires  
> them to install Perl). Moreover, our continuous integration server  
> (which tags each build automatically) uses SVNKit.
>
> So, my question: in the absence of TSVN supporting a "pin-externals"  
> option (as in the discussion I've linked), is there anything I can  
> do in a server-side hook to pin the externals revisions when tagging  
> or branching?
>
> Alternatively, one of the ideas in the TSVN discussion was _always_  
> pinning the externals (and, presumably, jumping forward  
> periodically). Is this a good idea? I'm not convinced, because I  
> want a way for people editing a project trunk to be able to make  
> changes to the externals and commit those as well.
>
> Regards,
> Roger.
>
>
>
> DISCLAIMER: This is a PRIVATE message. If you are not the intended  
> recipient, please delete without copying and kindly advise us by e- 
> mail of the mistake in delivery. NOTE: Regardless of content, this e- 
> mail shall not operate to bind 1E Ltd to any order or other contract  
> unless pursuant to explicit written agreement or government  
> initiative expressly permitting the use of e-mail for such purpose
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org