Returns a snapshot after having applied the specified diff.
| 164 | |
| 165 | // Returns a snapshot after having applied the specified diff. |
| 166 | Try<Snapshot> patch(const Operation::Diff& diff) const |
| 167 | { |
| 168 | if (diff.entry().name() != entry.name()) { |
| 169 | return Error("Attempted to patch the wrong snapshot"); |
| 170 | } |
| 171 | |
| 172 | Try<string> patch = svn::patch( |
| 173 | entry.value(), |
| 174 | svn::Diff(diff.entry().value())); |
| 175 | |
| 176 | if (patch.isError()) { |
| 177 | return Error(patch.error()); |
| 178 | } |
| 179 | |
| 180 | Entry entry(diff.entry()); |
| 181 | entry.set_value(patch.get()); |
| 182 | |
| 183 | return Snapshot(position, entry, diffs + 1); |
| 184 | } |
| 185 | |
| 186 | // Position in the log where this snapshot is located. NOTE: if |
| 187 | // 'diffs' is greater than 0 this still represents the location of |