Skip to content

Commit 7e643f8

Browse files
committed
Support including deleted files (attic) in CVS directory listings
1 parent 258b57c commit 7e643f8

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/Client.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function fetchFile($path, $revision = null)
5656
return $this->fetch($url);
5757
}
5858

59-
public function fetchDirectory($path, $revision = null)
59+
public function fetchDirectory($path, $revision = null, $showAttic = false)
6060
{
6161
if (substr($path, -1) !== '/') {
6262
return $this->reject(new InvalidArgumentException('Directory path MUST end with trailing slash'));
@@ -68,6 +68,11 @@ public function fetchDirectory($path, $revision = null)
6868
$url .= '?pathrev=' . $revision;
6969
}
7070

71+
if ($showAttic) {
72+
$url .= (strpos($url, '?') === false) ? '?' : '&';
73+
$url .= 'hideattic=0';
74+
}
75+
7176
// TODO: path MUST end with trailing slash
7277
// TODO: accessing files will redirect to file with relative location URL (not supported by clue/buzz-react)
7378

tests/ClientTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ public function testFetchDirectoryRevision()
6767
$this->expectPromiseReject($promise);
6868
}
6969

70+
public function testFetchDirectoryAttic()
71+
{
72+
$this->browser->expects($this->once())->method('get')->with($this->equalTo('http://viewvc.example.org/directory/?hideattic=0'))->will($this->returnValue($this->createPromiseRejected()));
73+
74+
$promise = $this->client->fetchDirectory('/directory/', null, true);
75+
76+
$this->expectPromiseReject($promise);
77+
}
78+
79+
public function testFetchDirectoryRevisionAttic()
80+
{
81+
$this->browser->expects($this->once())->method('get')->with($this->equalTo('http://viewvc.example.org/directory/?pathrev=1.1&hideattic=0'))->will($this->returnValue($this->createPromiseRejected()));
82+
83+
$promise = $this->client->fetchDirectory('/directory/', '1.1', true);
84+
85+
$this->expectPromiseReject($promise);
86+
}
87+
7088
public function testFetchPatch()
7189
{
7290
$this->browser->expects($this->once())->method('get')->with($this->equalTo('http://viewvc.example.org/README.md?view=patch&r1=1.0&r2=1.1'))->will($this->returnValue($this->createPromiseRejected()));

0 commit comments

Comments
 (0)