mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 21:31:36 +02:00
Set latest seen version after non empty snapshot fetch.
This commit is contained in:
@@ -17,10 +17,10 @@ import java.util.*;
|
||||
*/
|
||||
public class SnapshotFetcher {
|
||||
|
||||
public List<Snapshot> getSnapshotsForProjectAfterVersion(String projectName, int version) throws FailedConnectionException, SnapshotPostException {
|
||||
public LinkedList<Snapshot> getSnapshotsForProjectAfterVersion(String projectName, int version) throws FailedConnectionException, SnapshotPostException {
|
||||
List<SnapshotInfo> snapshotInfos = getSnapshotInfosAfterVersion(projectName, version);
|
||||
List<SnapshotData> snapshotDatas = getMatchingSnapshotData(projectName, snapshotInfos);
|
||||
List<Snapshot> snapshots = combine(snapshotInfos, snapshotDatas);
|
||||
LinkedList<Snapshot> snapshots = combine(snapshotInfos, snapshotDatas);
|
||||
return snapshots;
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ public class SnapshotFetcher {
|
||||
return requests;
|
||||
}
|
||||
|
||||
private List<Snapshot> combine(List<SnapshotInfo> snapshotInfos, List<SnapshotData> snapshotDatas) {
|
||||
List<Snapshot> snapshots = new LinkedList<Snapshot>();
|
||||
private LinkedList<Snapshot> combine(List<SnapshotInfo> snapshotInfos, List<SnapshotData> snapshotDatas) {
|
||||
LinkedList<Snapshot> snapshots = new LinkedList<Snapshot>();
|
||||
Iterator<SnapshotInfo> infos = snapshotInfos.iterator();
|
||||
Iterator<SnapshotData> datas = snapshotDatas.iterator();
|
||||
while (infos.hasNext()) {
|
||||
|
||||
@@ -38,7 +38,10 @@ public class DataStore implements CandidateSnapshotCallback {
|
||||
}
|
||||
|
||||
public List<WritableRepositoryContents> updateProjectWithName(String name, Repository repository) throws IOException, SnapshotPostException {
|
||||
List<Snapshot> snapshots = snapshotFetcher.getSnapshotsForProjectAfterVersion(name, persistentStore.getLatestVersionForProject(name));
|
||||
LinkedList<Snapshot> snapshots = snapshotFetcher.getSnapshotsForProjectAfterVersion(name, persistentStore.getLatestVersionForProject(name));
|
||||
if (!snapshots.isEmpty()) {
|
||||
persistentStore.setLatestVersionForProject(name, snapshots.getLast().getVersionID());
|
||||
}
|
||||
List<WritableRepositoryContents> commits = makeCommitsFromSnapshots(name, repository, snapshots);
|
||||
return commits;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user