svn-find-native-eols.pl 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/perl
  2. #
  3. # This script produces the list of all files using native svn:eol-style.
  4. #
  5. # It's used as a helper for distribution creation as this is also the
  6. # list of files which need to have their line endings converted for
  7. # the use on the platform other than the current one.
  8. #
  9. # Notice that the script requires Perl 5.10 (which could be easily avoided but
  10. # as this is for my personal use mostly so far, I didn't bother) and Perl svn
  11. # bindings.
  12. use 5.10.0;
  13. use strict;
  14. use warnings;
  15. use SVN::Client;
  16. # Normally we get the list directly from the server but this is slow,
  17. # so if you already have an (up to date!) svn checkout, you can also
  18. # pass a path to it here, the script will work much faster then.
  19. my $root = $ARGV[0] // 'https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk';
  20. my $ctx = SVN::Client->new
  21. or die "Failed to create svn context, do you have svn auth stored?\n";
  22. my $props = $ctx->proplist($root, undef, 1)
  23. or die "Failed to list properties for files under $root.\n";
  24. foreach my $prop (@$props) {
  25. my $eol = ${$prop->prop_hash()}{'svn:eol-style'};
  26. if ( defined $eol && ($eol eq 'native') ) {
  27. my $rel = $prop->node_name();
  28. substr($rel, 0, length($root) + 1, ''); # +1 for leading slash
  29. say $rel;
  30. }
  31. }