SVN-S4

 view release on metacpan or  search on metacpan

s4  view on Meta::CPAN

    }
}

sub cmd_fixprop {
    DEBUG "cmd_fixprop ",join(' ',@Opt_CmdParams),"\n"  if is_debug;
    !$opts{unknown} or die "%Error: s4 fixprop: Unknown argument: $opts{unknown}[0]\n";

    $opts{path} or die "%Error: s4 fixprop: File path is required\n";
    foreach my $filename (@{$opts{path}}) {
	$s4->fixprops(filename=>_clean_path($filename),
		      # --recursive is default, so only check for non-recursive
		      recurse=>(!$opts{"--non-recursive"}),
		      personal=>$opts{"--personal"},
		      autoprops=>(!$opts{"--no-autoprops"}),
		      ignores=>(!$opts{"--no-ignores"}),
		      keywords=>(!$opts{"--no-keywords"}),);
    }
}

sub cmd_info_switches {
    !$opts{unknown} or die "%Error: s4 info-switches: Unknown argument: $opts{unknown}[0]\n";
    # If no paths specified, update the current directory.
    my @paths;
    @paths = @{$opts{path}} if $opts{path};
    push @paths, '.' if !@paths;
    $s4->info_switches (paths => \@paths);
}

sub cmd_update {
    DEBUG "cmd_update ",join(' ',@Opt_CmdParams),"\n"  if is_debug;
    !$opts{unknown} or die "%Error: s4 update: Unknown argument: $opts{unknown}[0]\n";
    @Opt_CmdParams = $SvnOpt->stripOneArg('--top',@Opt_CmdParams);
    # If no paths specified, update the current directory.
    ($opts{"--top"} && $opts{path}[0])
	and die "s4: %Error: s4 update with both path and --top is contradictory\n";
    $s4->update (revision=>($opts{revision}[0]||$opts{pathrev}[0]),
		 paths=>_clean_path($opts{path}),
		 top => $opts{"--top"},
		 fallback_cmd=>raw_svn_command());
}

sub cmd_status {
    DEBUG "cmd_status ",join(' ',@Opt_CmdParams),"\n"  if is_debug;
    !$opts{unknown} or die "%Error: s4 status: Unknown argument: $opts{unknown}[0]\n";
    @Opt_CmdParams = $SvnOpt->stripOneArg('--top',@Opt_CmdParams);
    # If no paths specified, update the current directory.
    if ($opts{"--top"}) {
	$opts{path}[0] and die "s4: %Error: s4 update with both path and --top is contradictory\n";
        my $dir = $s4->dir_top_svn(".");
	push @{$opts{path}}, $dir;
	push @Opt_CmdParams, $dir;
    }
    cmd_svn();
}

sub cmd_switch {
    DEBUG "cmd_switch ",join(' ',@Opt_CmdParams),"\n"  if is_debug;
    !$opts{unknown} or die "%Error: s4 switch: Unknown argument: $opts{unknown}[0]\n";
    DEBUG "  opts = ", Dumper(\%opts), "\n" if is_debug;
    # Goal: Add ability to create switchpoints.
    # Use standard svn if they used "--relocate" syntax.
    if ($opts{'--relocate'}) {
        cmd_svn();
	return; # no viewspec checking
    }
    # Now we know that arg array means "URL PATH";
    my ($url,$path) = @{$opts{arg}};
    $url = _clean_path($url);
    $path = "." if !defined $path;
    if (!defined $url || !defined $path) {
        return cmd_svn();  # no viewspec checking
    }
    my $rev = ($opts{revision}[0]||$opts{argrev}[0]);

    # FIXME: great potential for performance improvement here.  If a viewspec
    # will be present after the switch, do nonrecursive switch first and then
    # parse viewspec, and let that inform how we proceed.
    #
    # See if the directory they tried to switch exists. If so, nothing to do.
    if (-d $path) {
        cmd_svn();
	$s4->clear_viewspec_state (path=>$path);  # switch wipes out switches
	return check_viewspec_after_svn_cmd(path=>$path, revision=>$rev);
    }
    # Aha, now we can help out by making the switchpoint at $path.
    # Identify the lowest-level directory that is a working copy, and
    # start building switchpoints until you reach path.
    my @basedirs = File::Spec->splitdir ($path);
    my @reldirs;
    my $basedir;
    while (@basedirs) {
	unshift @reldirs, (pop @basedirs);  # start at parent of $path.
        my $candidate = File::Spec->catdir (@basedirs);
	last if ($candidate eq '/');  # please don't touch the root!
	$candidate = "." if length $candidate < 1;
	DEBUG "Is $candidate a working copy?\n" if is_debug;
	if (-d $candidate && -d "$candidate/.svn") {
	    $basedir = $candidate;
	    last;
	}
    }
    if (!defined $basedir) {
        DEBUG "Cannot find working copy at any point above $path. Run normal command.\n" if is_debug;
        cmd_svn();
	$s4->clear_viewspec_state (path=>$path);  # switch wipes out switches
	return check_viewspec_after_svn_cmd (path=>$path, revision=>$rev);

    }
    print "s4: Creating empty directory to switch into: $path\n";
    my $reldir = File::Spec->catdir (@reldirs);
    #die "create_switchpoint_hierarchical with basedir=$basedir, reldir=$reldir";
    $s4->create_switchpoint_hierarchical ($basedir, $reldir);
    # Now that we made the switchpoint, run the normal command.
    cmd_svn ();
    $s4->clear_viewspec_state (path=>$path);  # switch wipes out switches
    check_viewspec_after_svn_cmd (path=>$path, revision=>$rev);
}

sub check_viewspec_after_svn_cmd {
    my %params = (#path=>,
                  #revision=>,
                  @_);



( run in 0.415 second using v1.01-cache-2.11-cpan-5511b514fd6 )