Skip to content

Commit e615743

Browse files
committed
sort revisions semantically
fixes #3925
1 parent 7626bae commit e615743

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

opengrok-indexer/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ information: Portions Copyright [yyyy] [name of copyright owner]
1818
1919
CDDL HEADER END
2020
21-
Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
21+
Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
2222
Portions Copyright (c) 2017-2020, Chris Fraire <[email protected]>.
2323
Portions Copyright (c) 2020-2020, Lubos Kosco <[email protected]>.
2424
@@ -223,6 +223,11 @@ Portions Copyright (c) 2020-2020, Lubos Kosco <[email protected]>.
223223
<artifactId>org.eclipse.jgit</artifactId>
224224
<version>5.12.0.202106070339-r</version>
225225
</dependency>
226+
<dependency>
227+
<groupId>io.github.g00fy2</groupId>
228+
<artifactId>versioncompare</artifactId>
229+
<version>1.5.0</version>
230+
</dependency>
226231
</dependencies>
227232

228233
<build>

opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSHistoryParser.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opengrok.indexer.history;
2424

@@ -33,6 +33,8 @@
3333
import java.util.ArrayList;
3434
import java.util.HashMap;
3535
import java.util.List;
36+
37+
import io.github.g00fy2.versioncompare.Version;
3638
import org.opengrok.indexer.util.Executor;
3739

3840
/**
@@ -182,7 +184,7 @@ History parse(File file, Repository repos) throws HistoryException {
182184
// so they need to be sorted according to revision.
183185
if (cvsrepo.getBranch() != null && !cvsrepo.getBranch().isEmpty()) {
184186
List<HistoryEntry> entries = history.getHistoryEntries();
185-
entries.sort((o1, o2) -> o2.getRevision().compareTo(o1.getRevision()));
187+
entries.sort((o1, o2) -> new Version(o2.getRevision()).compareTo(new Version(o1.getRevision())));
186188
history.setHistoryEntries(entries);
187189
}
188190

0 commit comments

Comments
 (0)