1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11: class Horde_Vcs_Directory_Svn extends Horde_Vcs_Directory_Base
12: {
13: 14: 15: 16: 17: 18: 19: 20: 21:
22: public function __construct(Horde_Vcs_Base $rep, $dn, $opts = array())
23: {
24: parent::__construct($rep, $dn, $opts);
25:
26: $cmd = $rep->getCommand() . ' ls '
27: . escapeshellarg($rep->sourceroot . $this->_dirName);
28:
29: $dir = proc_open(
30: $cmd,
31: array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')),
32: $pipes);
33: if (!$dir) {
34: throw new Horde_Vcs_Exception('Failed to execute svn ls: ' . $cmd);
35: }
36: if ($error = stream_get_contents($pipes[2])) {
37: proc_close($dir);
38: throw new Horde_Vcs_Exception($error);
39: }
40:
41: 42:
43: $errors = array();
44: while (!feof($pipes[1])) {
45: $line = chop(fgets($pipes[1], 1024));
46: if (!strlen($line)) {
47: continue;
48: }
49:
50: if (substr($line, 0, 4) == 'svn:') {
51: $errors[] = $line;
52: } elseif (substr($line, -1) == '/') {
53: $this->_dirs[] = substr($line, 0, -1);
54: } else {
55: $this->_files[] = $rep->getFile($this->_dirName . '/' . $line);
56: }
57: }
58:
59: proc_close($dir);
60: }
61: }
62: