~ubuntu-branches/ubuntu/vivid/gitolite3/vivid-proposed

« back to all changes in this revision

Viewing changes to src/lib/Gitolite/Common.pm

  • Committer: Package Import Robot
  • Author(s): David Bremner
  • Date: 2014-05-25 20:09:36 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20140525200936-el6hezd1fym50pxh
Tags: 3.6-1
* New upstream release
* Depend on ssh-server instead of openssh-server (Closes: #735176).

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    return unless defined( $ENV{D} );
49
49
 
50
50
    my $level = shift; return if $ENV{D} < $level;
51
 
    my $args = ''; $args = join( ", ", @_ ) if @_;
52
51
    my $sub = ( caller 1 )[3] || ''; $sub =~ s/.*://;
53
52
    if ( not $sub ) {
54
53
        $sub = (caller)[1];
55
54
        $sub =~ s(.*/(.*))(($1));
56
55
    }
57
 
    $sub .= ' ' x ( 32 - length($sub) );
58
 
    say2 "TRACE $level $sub", ( @_ ? shift : () );
59
 
    say2( "TRACE $level " . ( " " x 32 ), $_ ) for @_;
 
56
    $sub .= ' ' x ( 31 - length($sub) );
 
57
    say2 "$level\t$sub\t", join( "\t", @_ );
60
58
}
61
59
 
62
60
sub dbg {
73
71
}
74
72
 
75
73
{
76
 
    use Time::HiRes;
77
74
    my %start_times;
78
75
 
 
76
    eval "require Time::HiRes";
 
77
    # we just ignore any errors from this; nothing needs to be done as long as
 
78
    # no code *calls* either of the next two functions.
 
79
 
79
80
    sub t_start {
80
81
        my $name = shift || 'default';
81
82
        $start_times{$name} = [ Time::HiRes::gettimeofday() ];
204
205
 
205
206
sub cleanup_conf_line {
206
207
    my $line = shift;
 
208
    return $line if $line =~ /^# \S+ \d+$/;
207
209
 
208
210
    # kill comments, but take care of "#" inside *simple* strings
209
211
    $line =~ s/^((".*?"|[^#"])*)#.*/$1/;
228
230
            $repo =~ s(\./(.*)\.git$)($1);
229
231
            push @phy_repos, $repo;
230
232
        }
231
 
        trace( 2, scalar(@phy_repos) . " physical repos found" );
 
233
        trace( 3, scalar(@phy_repos) . " physical repos found" );
232
234
        return sort_u( \@phy_repos );
233
235
    }
234
236
}
284
286
 
285
287
sub logger_plus_stderr {
286
288
    open my $fh, "|-", "logger" or confess "it's really not my day is it...?\n";
287
 
    for ( @_ ) {
 
289
    for (@_) {
288
290
        print STDERR "FATAL: $_\n";
289
291
        print $fh "FATAL: $_\n";
290
292
    }