This file is indexed.

/usr/share/polymake/perllib/Polymake/SourceVersionControl.pm is in polymake-common 3.2r2-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#  Copyright (c) 1997-2018
#  Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
#  http://www.polymake.org
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the
#  Free Software Foundation; either version 2, or (at your option) any
#  later version: http://www.gnu.org/licenses/gpl.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#-------------------------------------------------------------------------------

require File::Path;
require File::Copy;

use namespaces;

package Polymake::SourceVersionControl;

sub new {
   my ($pkg, $dir)=@_;
   if (`svn info $dir 2>/dev/null` =~ /Revision:/) {
      bless \$dir, "$pkg\::SVN";
   } else {
      # @todo provide recognition and a module for git
      bless \$dir, "$pkg\::None";
   }
}

package _::SVN;

sub make_dir {
   my $self=shift;
   my $feedback=`cd $$self; svn mkdir --parents @_ 2>&1`;
   unless ($feedback =~ m{\A(?m:^A\s+\S+\n)+\Z}s) {
      None::make_dir($self, @_);
      warn_print( "svn mkdir --parents @_ failed:\n$feedback\n",
		  "The directories have been created, but not registered with svn.\n",
		  "Please investigate the reason of the failure and execute `svn add @_` manually." );
   }
}

sub add_file {
   my $self=shift;
   my $feedback=`cd $$self; svn add @_ 2>&1`;
   unless ($feedback =~ m{\A(?m:^A\s+\S+\n)+\Z}s) {
      warn_print( "svn add @_ failed:\n$feedback\n",
		  "Please investigate the reason of the failure and repeat the command manually." );
   }
}

sub copy_file {
   my $self=shift;
   my $feedback=`cd $$self; svn copy @_ 2>&1`;
   unless ($feedback =~ m{\A(?m:^A\s+\S+\n)+\Z}s) {
      None::copy_file($self, @_);
      warn_print( "svn copy @_ failed:\n$feedback\n",
		  "The file has been copied, but the copy has not been registered with svn.\n",
		  "Please investigate the reason of the failure and execute `svn add $_[-1]` manually." );
   }
}

sub rename_file {
   my $self=shift;
   my $feedback=`cd $$self; svn rename @_ 2>&1`;
   unless ($feedback =~ m{\A(?m:^[AD]\s+\S+\n)+\Z}s) {
      None::rename_file($self, @_);
      warn_print( "svn rename @_ failed:\n$feedback\n",
		  "The file has been renamed, but the new name has not been registered with svn.\n",
		  "Please investigate the reason of the failure and execute `svn add $_[-1]` manually.\n",
		  "Note that the old file $_[0] might reappear in the meanwhile with new contents!" );
   }
}

sub delete_file {
   my $self=shift;
   my $feedback=`cd $$self; svn delete @_ 2>&1`;
   unless ($feedback =~ m{\A(?m:^D\s+\S+\n)+\Z}s) {
      None::delete_file($self, @_);
      warn_print( "svn delete @_ failed:\n$feedback\n",
		  "The files have been deleted, but not registered with svn.\n",
		  "Please investigate the reason of the failure and execute `svn delete @_` manually." );
   }
}

sub set_ignored {
   my $self=shift;
   my %items=map { ("$_\n" => 1) } @_;
   my @ignored;
   foreach (`svn propget svn:ignore $$self 2>/dev/null`) {
      if (length($_)>1) {
	 push @ignored, $_;
	 delete $items{$_};
      }
   }
   if (keys %items) {
      open my $IGN, "| svn propset svn:ignore -F - $$self";
      print $IGN @ignored, keys %items;
      close $IGN;
      if ($?) {
	 warn_print( "Editing svn:ignore of directory $$self failed: svn propedit terminated with error.\n",
		     "Please investigate the reason and add the following items to the property svn:ignore:\n",
		     join(" ", keys %items) );
      }
   }
}

sub check_status {
   my $self=shift;
   my $response=`cd $$self; svn status -u @_ 2>&1`;
   if ($response =~ /^C /) {
      "conflict"
   } elsif ($response =~ /^\s*\* /) {
      "outdated"
   } elsif ($response =~ /^(?:[MA] |Status against revision:)/) {
      ""
   } else {
      $response
   }
}

package __::None;

sub new {
   my ($pkg, $dir)=@_;
   bless \$dir, $pkg;
}

sub make_dir {
   my $self=shift;
   File::Path::mkpath([ map { m{^/} ? $_ : "$$self/$_" } @_ ], 0, 0755);
}

sub copy_file {
   my $self=shift;
   File::Copy::copy(map { m{^/} ? $_ : "$$self/$_" } @_);
}

sub rename_file {
   my $self=shift;
   my ($from, $to)=map { m{^/} ? $_ : "$$self/$_" } @_;
   rename($from, $to) or die "rename @_ in $$self failed: $!\n";
}

sub delete_file {
   my $self=shift;
   unlink(map { m{^/} ? $_ : "$$self/$_" } @_) or die "unlink @_ in $$self failed: $!\n";
}

sub add_file {}
sub set_ignored {}
sub check_status { "" }

1;

# Local Variables:
# cperl-indent-level:3
# indent-tabs-mode:nil
# End: