File: Cleanup.pm

package info (click to toggle)
svk 1.08-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,480 kB
  • ctags: 960
  • sloc: perl: 18,811; lisp: 63; makefile: 43; sh: 10
file content (70 lines) | stat: -rw-r--r-- 1,369 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package SVK::Command::Cleanup;
use strict;
use SVK::Version;  our $VERSION = $SVK::VERSION;

use base qw( SVK::Command );
use SVK::I18N;

sub options {
    ('a|all' => 'all');
}

sub parse_arg {
    my ($self, @arg) = @_;
    ++$self->{hold_giant};
    return undef if $self->{all};
    @arg = ('') if $#arg < 0;
    return map {$self->arg_copath ($_)} @arg;
}

sub run {
    my ($self, @arg) = @_;

    if ($self->{all}) {
        $self->{xd}{checkout}->store_recursively ('', {lock => undef});
        print loc("Cleaned up all stalled locks.\n");
        return;
    }

    for (@arg) {
	if ($self->{xd}{checkout}->get ($_->{copath})->{lock}) {
	    print loc("Cleaned up stalled lock on %1.\n", $_->{copath});
	    $self->{xd}{checkout}->store ($_->{copath}, {lock => undef});
	}
        else {
	    print loc("Path %1 was not locked.\n", $_->{copath});
	}
    }
    return;
}

1;

__DATA__

=head1 NAME

SVK::Command::Cleanup - Remove stalled locks

=head1 SYNOPSIS

 cleanup [PATH...]

=head1 OPTIONS

 -a [--all]             : remove all stalled locks

=head1 AUTHORS

Chia-liang Kao E<lt>clkao@clkao.orgE<gt>

=head1 COPYRIGHT

Copyright 2003-2005 by Chia-liang Kao E<lt>clkao@clkao.orgE<gt>.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

See L<http://www.perl.com/perl/misc/Artistic.html>

=cut