-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Myers algorithm in linear space #112
Changes from all commits
53153e2
034774e
b07b979
cbb1f4f
3a87497
df9a059
ef11cb1
69e32f6
241a30d
84029fd
743edaa
f3d1caf
0121c61
37933be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ build | |
/.idea | ||
*.iml | ||
out | ||
.DS_Store | ||
.DS_Store | ||
.kotlin/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,11 @@ All credit for the implementation goes to original authors. | |
|
||
## Features | ||
|
||
All features from version `4.10` of the original library are present, except for: | ||
All features from version `4.12` of the original library are present, except for: | ||
|
||
- fuzzy patches | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will port in another PR. |
||
- unified diff, which heavily uses file read/write and therefore needs a more complicated rewrite | ||
- diff-utils-jgit, which uses JVM-only jgit library | ||
- diff-utils-jgit, which uses JVM-only JGit | ||
|
||
Please refer to the original guides for more information. | ||
|
||
|
@@ -29,8 +30,10 @@ Currently, artifacts for the following platforms are supported: | |
- WebAssembly (JS and WASI) | ||
- Native | ||
|
||
The supported Native targets are (following the Kotlin/Native [target support guidelines](https://kotlinlang.org/docs/native-target-support.html)): | ||
The supported Native targets are (following the Kotlin/Native [target support guidelines][1]): | ||
|
||
| Tier 1 | Tier 2 | Tier 3 | | ||
|:---------|:---------|:---------| | ||
| macosX64 | linuxX64 | mingwX64 | | ||
|
||
[1]: https://kotlinlang.org/docs/native-target-support.html |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,11 +19,12 @@ | |
package io.github.petertrr.diffutils.algorithm | ||
|
||
import io.github.petertrr.diffutils.patch.DeltaType | ||
import kotlin.jvm.JvmField | ||
|
||
public data class Change( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if making the class There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @petertrr we are targeting Java 8, so it wouldn't make any difference unfortunately. |
||
val deltaType: DeltaType, | ||
val startOriginal: Int, | ||
val endOriginal: Int, | ||
val startRevised: Int, | ||
val endRevised: Int, | ||
@JvmField val deltaType: DeltaType, | ||
@JvmField val startOriginal: Int, | ||
@JvmField val endOriginal: Int, | ||
@JvmField val startRevised: Int, | ||
@JvmField val endRevised: Int, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright 2024 Peter Trifanov. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.github.petertrr.diffutils.algorithm | ||
|
||
public fun interface DiffEqualizer<T> { | ||
public fun test(one: T, two: T): Boolean | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2024 Peter Trifanov. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.github.petertrr.diffutils.algorithm | ||
|
||
public class EqualsDiffEqualizer<T> : DiffEqualizer<T> { | ||
override fun test(one: T, two: T): Boolean = | ||
one == two | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2024 Peter Trifanov. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.github.petertrr.diffutils.algorithm | ||
|
||
public class IgnoreWsStringDiffEqualizer : DiffEqualizer<String> { | ||
private companion object { | ||
private val ws = Regex("\\s+") | ||
} | ||
|
||
override fun test(one: String, two: String): Boolean = | ||
ws.replace(one.trim(), " ") == ws.replace(two.trim(), " ") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kotlin 2.0 introduces a new folder to store metadata.