summaryrefslogtreecommitdiff
path: root/bin/ChangeLogEditor/SVNFileLocator.pm
blob: 246b9dc9c7f21c5ab4fbc07a609e8cb6e7a7325a (plain)
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
package SVNFileLocator;

# ************************************************************
# Description   : Use SVN to determine the list of modified files.
# Author        : Chad Elliott
# Create Date   : 11/29/2005
# ************************************************************

# ************************************************************
# Pragmas
# ************************************************************

use strict;
use FileHandle;

use FileLocator;

use vars qw(@ISA);
@ISA = qw(FileLocator);

# ************************************************************
# Subroutine Section
# ************************************************************

sub locate {
  my($self)      = shift;
  my(@dirs)      = @_;
  my($fh)        = new FileHandle();
  my(@modified)  = ();
  my(@removed)   = ();
  my(@conflicts) = ();
  my(@unknown)   = ();
  my($nul)       = ($^O eq 'MSWin32' ? 'nul' : '/dev/null');

  if (open($fh, "svn diff @dirs 2> $nul |")) {
    while(<$fh>) {
      my($line) = $_;
      if ($line =~ /^Index:\s+(.*)/) {
        if (-r $1) {
          push(@modified, $1);
        }
        else {
          push(@removed, $1);
        }
      }
    }
    close($fh);
  }
  return \@modified, \@removed, \@conflicts, \@unknown;
}


1;