Indefero

Indefero Commit Details


Date:2010-08-28 17:03:47 (14 years 3 months ago)
Author:Thomas Keller
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:593240b4207742099e20d84826c0ae9533f547b0
Parents: 8aae0f29d4d37135382c18f0fb8c08059ce1a14f
Message:implement IDF_Scm_Monotone_BasicIO::compile()

Changes:

File differences

src/IDF/Scm/Monotone/BasicIO.php
2626
2727
2828
29
29
3030
3131
3232
......
5454
5555
5656
57
5758
5859
5960
......
6162
6263
6364
65
6466
6567
6668
......
105107
106108
107109
108
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
109160
110161
111162
*
* @author Thomas Keller <me@thomaskeller.biz>
*/
class IDF_Scm_Monotone_BasicIO extends IDF_Scm
class IDF_Scm_Monotone_BasicIO
{
/**
* Parses monotone's basic_io format
}
if ($in[$pos] == '[') {
unset($stanzaLine['values']);
++$pos; // opening square bracket
$stanzaLine['hash'] = substr($in, $pos, 40);
$pos += 40;
}
else
{
unset($stanzaLine['hash']);
$valCount = 0;
while ($in[$pos] == '"') {
++$pos; // opening quote
*/
public static function compile($in)
{
throw new IDF_Scm_Exception("not yet implemented");
$out = "";
$first = true;
foreach ((array)$in as $sx => $stanza) {
if ($first)
$first = false;
else
$out .= "\n";
$maxkeylength = 0;
foreach ((array)$stanza as $lx => $line) {
if (!array_key_exists('key', $line)) {
throw new IDF_Scm_Exception(
'"key" not found in basicio stanza '.$sx.', line '.$lx
);
}
$maxkeylength = max($maxkeylength, strlen($line['key']));
}
foreach ((array)$stanza as $lx => $line) {
$out .= str_pad($line['key'], $maxkeylength, ' ', STR_PAD_LEFT);
if (array_key_exists('hash', $line)) {
$out .= ' ['.$line['hash'].']';
} else
if (array_key_exists('values', $line)) {
if (!is_array($line['values']) || count($line['values']) == 0) {
throw new IDF_Scm_Exception(
'"values" must be an array of a size >= 1 '.
'in basicio stanza '.$sx.', line '.$lx
);
}
foreach ($line['values'] as $value) {
$out .= ' "'.str_replace(
array("\\", "\""),
array("\\\\", "\\\""),
$value).'"';
}
}
else
{
throw new IDF_Scm_Exception(
'neither "hash" nor "values" found in basicio '.
'stanza '.$sx.', line '.$lx
);
}
$out .= "\n";
}
}
return $out;
}
}

Archive Download the corresponding diff file

Page rendered in 0.07373s using 13 queries.