mp_diff/README.md

45 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2023-03-21 05:34:46 +03:00
# 3-way merge
Tho tools to make smart merge of two versions of changed original data. See [merge3] function online docs.
2023-03-21 06:09:20 +03:00
## Usage
Add dependency:
~~~kotlin
repositories {
//...
maven("https://gitea.sergeych.net/api/packages/SergeychWorks/maven")
}
~~~
and in the source set dependencies something like
~~~kotlin
dependencies {
// ...
2024-03-20 02:25:13 +03:00
implementation("net.sergeych:mp_diff:0.0.10")
2023-03-21 06:09:20 +03:00
}
~~~
Now call it in the code
~~~kotlin
val src = "Hello world".toList()
val a = "Hello friend".toList()
val b = "Bye world".toList()
val m = merge3(src, b, a)
assertEquals("Bye friend", m.merged.joinToString(""))
println(m.blocks)
~~~
2023-03-21 05:34:46 +03:00
2024-03-20 02:25:13 +03:00
# Licensing proglem
I found that part of the code was initially under Apache 2.0. I'm sorry I have to change from mit to Apache therefore, will do it soon. My apologies.
2023-03-21 05:34:46 +03:00
## Acknowledgments
This work is based on the original kotlin diff port https://github.com/GitLiveApp/kotlin-diff-utils work, unfortunatley its packaging is not compatible with current kotlin MP formats so I can't just use it as the dependencies. The wholde `dev.gitlive.difflib` is taken from the link above, where it was published under the [Apache 2.0 license at the moment of borrowing this code](https://github.com/GitLiveApp/kotlin-diff-utils/blob/master/LICENSE).