⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svncopy.pl.in

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 IN
📖 第 1 页 / 共 3 页
字号:
      if ( SVNCall( 'log', '-r', 'HEAD', $r ) == 0 )        {          $repos_root_uri = $r;          last;        }    }      $verbose = $old_verbose;    if ($repos_root_uri)    {      info( "Determined that the svn root URL is $repos_root_uri.\n\n" );      return $repos_root_uri;    }  else    {      error( "$0: cannot determine root svn URL for '$URI'.\n" );      return;    }}#------------------------------------------------------------------------------# Function:    CreateSVNDirectories## Creates a directory in Subversion, including all intermediate directories.## Parameters:#       URI         directory path to create.#       message     commit message (optional).## Returns:     1 on success, 0 on error#------------------------------------------------------------------------------sub CreateSVNDirectories{  my ( $URI, $message ) = @_;  my $r = $URI->clone;  my @path_segments = grep { length($_) } $r->path_segments;  my @r_path_segments;  unshift(@path_segments, '');  $r->path('');  my $found_root = 0;  my $found_tail = 0;  # Prepare a file containing the message  my ($handle, $messagefile) = tempfile( DIR => $temp_dir );  print $handle $message;  close($handle);  my @msgcmd = ( "--file", $messagefile );  # We're going to get errors while we do this.  Don't show the user.  my $old_verbose = $verbose;  $verbose = 0;  # Find the repository root  while (@path_segments)    {      my $segment = shift @path_segments;      push( @r_path_segments, $segment );      $r->path_segments( @r_path_segments );      if ( !$found_root )        {          if ( SVNCall( 'log', '-r', 'HEAD', $r ) == 0 )            {              # We've found the root of the repository.              $found_root = 1;            }        }      elsif ( !$found_tail )        {          if ( SVNCall( 'log', '-r', 'HEAD', $r ) != 0 )            {              # We've found the first directory which doesn't exist.              $found_tail = 1;            }        }              if ( $found_tail )        {          # We're creating directories          $verbose = $old_verbose;          if ( 0 != SVNCall( 'mkdir', @msgcmd, $r ) )            {              error( "Couldn't create directory '$r'" );              return 0;            }        }    }  $verbose = $old_verbose;    return 1;}#------------------------------------------------------------------------------# Function:    info## Prints out an informational message in verbose mode## Parameters:#       @_     The message(s) to print## Returns:     none#------------------------------------------------------------------------------sub info{  if ( $verbose )    {      print @_;    }}#------------------------------------------------------------------------------# Function:    error## Prints out and logs an error message## Parameters:#       @_     The error messages## Returns:     none#------------------------------------------------------------------------------sub error{  my $error;      # This is used during testing  if ( $hideerrors )    {      return;    }      # Now print out each error message and add it to the list.  foreach $error ( @_ )    {      my $text = "svncopy.pl: $error\n";      push( @errors, $text );      if ( $verbose )        {          print $text;        }    }}#------------------------------------------------------------------------------# Function:    Usage## Prints out usage information.## Parameters:#       optional error message## Returns:     none#------------------------------------------------------------------------------sub Usage{  my $msg;  $msg = "\n*** $_[0] ***\n" if $_[0];      pod2usage( { -message => $msg,               -verbose => 0 } );}#------------------------------------------------------------------------------# This package exists just to delete the temporary directory.#------------------------------------------------------------------------------package Temp::Delete;use File::Temp   0.12   qw(tempdir);sub new{  my $this = shift;  my $class = ref($this) || $this;  my $self = {};  bless $self, $class;  my $temp_dir = tempdir("svncopy_XXXXXXXXXX", TMPDIR => 1);    $self->{tempdir} = $temp_dir;    return $self;}sub temp_dir{  my $self = shift;  return $self->{tempdir};}sub DESTROY{  my $self = shift;  my $temp_dir = $self->{tempdir};  if ( scalar( @errors ) )  {    print "Leaving $temp_dir for inspection\n";  }  else  {    info( "Cleaning up $temp_dir\n" );    File::Path::rmtree([$temp_dir], 0, 0);  }}#------------------------------------------------------------------------------# Documentation follows, in pod format.#------------------------------------------------------------------------------__END__=head1 NAMEB<svncopy> - extended form of B<svn copy>=head1 SYNOPSISB<svncopy.pl> [option ...] source [source ...] destinationThis script copies one Subversion location or set of locations to another,in the same way as B<svn copy>.  Using the script allows more advanced operations,in particular allowing svn:externals to be dealt with properly for branchingor tagging. Parameters:  source         Subversion item to copy from.                 Multiple sources can be given.  destination    Destination to copy to. Options:  -t [--tag]             : set svn:externals to current version     [--pin-externals ]  -b [--branch]          : update fully contained svn:externals     [--update-externals]  -m [--message] arg     : specify commit message ARG  -F [--file] arg        : read data from file ARG  -r [--revision] arg    : ARG (some commands also take ARG1:ARG2 range)                           A revision argument can be one of:                             NUMBER       revision number                             "{" DATE "}" revision at start of the date                             "HEAD"       latest in repository                             "BASE"       base rev of item's working copy                             "COMMITTED"  last commit at or before BASE                             "PREV"       revision just before COMMITTED  -q [--quiet]           : print as little as possible  --username arg         : specify a username ARG  --password arg         : specify a password ARG  --no-auth-cache        : do not cache authentication tokens  --force-log            : force validity of log message source  --encoding arg         : treat value as being in charset encoding ARG  --config-dir arg       : read user config files from directory ARG  --[no]verbose          : sets the script to give lots of output=head1 PARAMETERS=over=item B<source>The subversion item or items to copy from.=item B<destination>The destination URL to copy to.=back=head1 OPTIONS=over=item B<-t [--pin-externals or --tag]>Update any svn:externals to ensure they have a version number,using the current destination version if none is already specified.Useful for tagging operations.=item B<-b [--update-externals or --branch]>Update any unversioned svn:externals which point to a locationwithin one of the sources so that they point to the correspondinglocation within the destination.Note: --pin-externals and --update-externals are mutually exclusive.=item B<-m [--message] arg>Specify commit message ARG=item B<-F [--file] arg>Read data from file ARG=item B<-r [--revision] arg>ARG (some commands also take ARG1:ARG2 range)A revision argument can be one of:    NUMBER       revision number    "{" DATE "}" revision at start of the date    "HEAD"       latest in repository    "BASE"       base rev of item's working copy    "COMMITTED"  last commit at or before BASE    "PREV"       revision just before COMMITTED=item B<-q [--quiet]>Print as little as possible=item B<--username arg>Specify a username ARG=item B<--password arg>Specify a password ARG=item B<--no-auth-cache>Do not cache authentication tokens=item B<--force-log>Force validity of log message source=item B<--encoding arg>Treat value as being in charset encoding ARG=item B<--config-dir arg>Read user configuration files from directory ARG=item B<--[no]verbose>Sets the script to give lots of output when it runs.=item B<--help>Print a brief help message and exits.=back=head1 DESCRIPTIONThis script performs an B<svn copy> command.  It allows extra processing to getaround the following limitations of B<svn copy>:svn:externals definitions are (in Subversion 1.0 and 1.1 at least) absolute paths.This means that an B<svn copy> used as a branch or tag operation on a tree withembedded svn:externals will not do what is expected.  The svn:externalswill still point at the original location and will not be pinned down.B<svncopy --update-externals> (or B<svncopy --branch>) will update anyunversioned svn:externals in the destination tree which point at locationswithin one of the source trees so that they point to the corresponding locationswithin the destination tree instead.  This effectively updates the reference topoint to the destination tree, and is the behaviour you want for branching.B<svncopy --pin-externals> (or B<svncopy --tag>) will update any unversionedsvn:externals in the destination tree to contain the current version of thedirectory listed in the svn:externals definition.  This effectively pinsthe reference to the current version, and is the behaviour you want for tagging.Note: both forms of the command leave unchanged any svn:externals whichalready contain a version number.=cut#------------------------------- END OF FILE ----------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -