My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
<?php

require_once 'VersionControl/Subversion/Adapter/Interface.php';

require_once 'VersionControl/Subversion/Adapter/Svn.php';

class Skjb_VersionControl_Subversion
{
protected $config = array(
'adapter' => 'Skjb_VersionControl_Subversion_Adapter_Svn',
);

protected $adapter = null;

public function __construct($config = null)
{
if ($config !== null) {
$this->setConfig($config);
}
}

public function setConfig($config = array())
{
if ($config instanceof Zend_Config) {
$config = $config->toArray();

} elseif (! is_array($config)) {
throw new Exception('Array or Zend_Config object expected, got ' . gettype($config));
}

foreach ($config as $k => $v) {
$this->config[strtolower($k)] = $v;
}

// Pass configuration options to the adapter if it exists
if ($this->adapter instanceof Skjb_VersionControl_Subversion_Adapter_Interface) {
$this->adapter->setConfig($config);
}

return $this;
}

public function setAdapter($adapter)
{
if (is_string($adapter)) {
$adapter = new $adapter;
}

if (! $adapter instanceof Skjb_VersionControl_Subversion_Adapter_Interface) {
throw new Exception('Passed adapter is not a Subversion connection adapter');
}

$this->adapter = $adapter;
$config = $this->config;
unset($config['adapter']);
$this->adapter->setConfig($config);
}

public function getLatestRevision()
{
return $this->getAdapter()->getLatestRev();
}

public function revisionPropertyList($revision)
{
return $this->getAdapter()->revPropList($revision);
}

public function getAdapter()
{
if ($this->adapter == null) {
$this->setAdapter($this->config['adapter']);
}

return $this->adapter;
}
}

Change log

r59 by superhappycamperboy on May 26, 2010   Diff
Moving everything to the library subfolder
Go to: 
Project members, sign in to write a code review

Older revisions

r34 by superhappycamperboy on May 21, 2010   Diff
Moving everything into the Skjb folder
r32 by superhappycamperboy on Mar 23, 2010   Diff
Early Subversion work
r27 by superhappycamperboy on Mar 17, 2010   Diff
Better auth and gathering of details
All revisions of this file

File info

Size: 2079 bytes, 77 lines
Powered by Google Project Hosting