~ubuntu-branches/ubuntu/utopic/gitolite3/utopic-proposed

« back to all changes in this revision

Viewing changes to src/syntactic-sugar/refex-expr

  • Committer: Package Import Robot
  • Author(s): David Bremner
  • Date: 2013-05-18 17:59:21 UTC
  • Revision ID: package-import@ubuntu.com-20130518175921-ac4xe6vd0jtxvjot
Tags: upstream-3.5.1+4
ImportĀ upstreamĀ versionĀ 3.5.1+4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: syn=perl:
 
2
 
 
3
# "sugar script" (syntactic sugar helper) for gitolite3
 
4
# ----------------------------------------------------------------------
 
5
# see src/VREF/refex-expr for instructions and WARNINGS!
 
6
 
 
7
my $perm = qr(-|R|RW\+?C?D?M?);
 
8
 
 
9
my $seq = 1;
 
10
sub sugar_script {
 
11
    my $lines = shift;
 
12
 
 
13
    # my @out  = ();
 
14
    for my $l (@$lines) {
 
15
        push @out, $l;
 
16
 
 
17
        # quick check
 
18
        next unless $l =~ /^($perm) /;
 
19
        # more detailed check
 
20
        next unless $l =~ /^($perm) (\S.*) = (\S.*)$/;
 
21
        my ($perm, $refexes, $users) = ($1, $2, $3);
 
22
        next unless $refexes =~ / (and|not|or|xor|\+|-|==|-lt|-gt|-eq|-le|-ge|-ne) /;
 
23
 
 
24
        print STDERR ">>>> $l\n";
 
25
        pop @out;   # we need to replace that last line
 
26
 
 
27
        push @out, "option refex-expr.sugar$seq = $refexes";
 
28
        push @out, "$perm VREF/refex-expr/sugar$seq = $users";
 
29
 
 
30
        $seq++;
 
31
    }
 
32
 
 
33
    return \@out;
 
34
}