plain-merge 7.1.22 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/LICENSE.md +3 -6
- data/README.md +28 -12
- data/lib/plain/merge/backend.rb +3 -3
- data/lib/plain/merge/provider.rb +24 -24
- data/lib/plain/merge/version.rb +1 -1
- data/lib/plain/merge.rb +15 -15
- data/lib/plain-merge.rb +3 -3
- data.tar.gz.sig +0 -0
- metadata +13 -14
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3464d3236c8fa1a156d30966b6b859e2608d5e5e3951cb929616516ee2cca5ee
|
|
4
|
+
data.tar.gz: 54bc0678033f31e1f46cf919236118e516c16ea6ae5b22d61f3512db554eac00
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca457c5968460bb1d0c8cf325ed8e2a2b045f5975b09db45fea1e35aa6e35c72ba06a1304558be0657845d6605b8822dcd965c0a49e15908684ac9002a40fd6b
|
|
7
|
+
data.tar.gz: 734292db15f0310e8e06ea5c394962ee8afbaa993fac7dab26d1588323b86ae6e60463c0d861419e3d81453e8be22649b698c6809a58e9b2f2796da8c2fcd7c2
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/LICENSE.md
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
# License
|
|
2
2
|
|
|
3
|
-
This project is made available under the following
|
|
3
|
+
This project is made available under the following license.
|
|
4
4
|
Choose the option that best fits your use case:
|
|
5
5
|
|
|
6
|
-
- [
|
|
7
|
-
- [PolyForm-Small-Business-1.0.0](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/PolyForm-Small-Business-1.0.0.md)
|
|
8
|
-
|
|
9
|
-
If none of the above licenses fit your use case, please [contact us](mailto:floss@galtzo.com) to discuss a custom commercial license.
|
|
6
|
+
- [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.md)
|
|
10
7
|
|
|
11
8
|
## Copyright Notice
|
|
12
9
|
|
|
13
|
-
-
|
|
10
|
+
- Copyright (c) 2026 Peter H. Boling
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# ☯️ Plain::Merge
|
|
4
4
|
|
|
5
|
-
[![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License:
|
|
5
|
+
[![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license] [![Total downloads][👽dl-ranki]][👽dl-rank] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf]
|
|
6
6
|
|
|
7
7
|
`if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know on Discord][✉️discord-invite] or [RubyForum][✉️ruby-forum], as I may have missed the notification.
|
|
8
8
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
[![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
|
|
12
12
|
|
|
13
13
|
<!-- kettle-sponsors:shields:start -->
|
|
14
|
+
<a href="#corporate-sponsorship"><img src="https://logos.galtzo.com/assets/images/sponsors/shield/github.svg" alt="services: GitHub"></a> <a href="#corporate-sponsorship"><img src="https://logos.galtzo.com/assets/images/sponsors/shield/healthsherpa.svg" alt="sponsor: HealthSherpa"></a> <a href="#corporate-sponsorship"><img src="https://logos.galtzo.com/assets/images/sponsors/shield/microsoft.svg" alt="compute: Microsoft"></a>
|
|
14
15
|
<!-- kettle-sponsors:shields:end -->
|
|
15
16
|
|
|
16
17
|
## 🌻 Synopsis <a href="https://discord.gg/3qme4XHNKN"><img alt="Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/galtzo-floss/avatar-128px.svg" width="8%" align="right"/></a> <a href="https://ruby-toolbox.com"><img alt="ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5" src="https://logos.galtzo.com/assets/images/ruby-lang/avatar-128px.svg" width="8%" align="right"/></a>
|
|
@@ -64,6 +65,17 @@ abort result.fetch(:diagnostics).inspect unless result.fetch(:ok)
|
|
|
64
65
|
File.write("notes.txt", result.fetch(:output))
|
|
65
66
|
```
|
|
66
67
|
|
|
68
|
+
## 🏢 Corporate Sponsorship
|
|
69
|
+
|
|
70
|
+
<!-- kettle-sponsors:cards:start -->
|
|
71
|
+
<a href="https://github.com"><picture><source media="(max-width: 600px)" srcset="https://logos.galtzo.com/assets/images/sponsors/phone/github.svg"><img src="https://logos.galtzo.com/assets/images/sponsors/github.svg" align="top" alt="Sponsor: GitHub - Copilot Max"></picture></a> <a href="https://healthsherpa.com"><picture><source media="(max-width: 600px)" srcset="https://logos.galtzo.com/assets/images/sponsors/phone/healthsherpa.svg"><img src="https://logos.galtzo.com/assets/images/sponsors/healthsherpa.svg" align="top" alt="Sponsor: HealthSherpa - GitHub Sponsors => @pboling (maintainer)"></picture></a> <a href="https://opensource.microsoft.com"><picture><source media="(max-width: 600px)" srcset="https://logos.galtzo.com/assets/images/sponsors/phone/microsoft.svg"><img src="https://logos.galtzo.com/assets/images/sponsors/microsoft.svg" align="top" alt="Sponsor: Microsoft - Azure compute resources"></picture></a>
|
|
72
|
+
|
|
73
|
+
<sub>Create sponsorship badges for your project with [kettle-sponsors](https://github.com/kettle-dev/kettle-sponsors).</sub>
|
|
74
|
+
<!-- kettle-sponsors:cards:end -->
|
|
75
|
+
|
|
76
|
+
**If you're working in a company that's making significant use of structuredmerge tools we'd
|
|
77
|
+
appreciate it if you suggest to your company to become a structuredmerge sponsor.**
|
|
78
|
+
|
|
67
79
|
## 💡 Info you can shake a stick at
|
|
68
80
|
|
|
69
81
|
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
@@ -72,7 +84,7 @@ File.write("notes.txt", result.fetch(:output))
|
|
|
72
84
|
| Support & Community | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![Get help from RubyForum][✉️ruby-forum-img]][✉️ruby-forum] [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼🏫expsup-upwork-img]][👨🏼🏫expsup-upwork] [![Get help from me on Codementor][👨🏼🏫expsup-codementor-img]][👨🏼🏫expsup-codementor] |
|
|
73
85
|
| Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on GitHub.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
|
|
74
86
|
| Documentation | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![GitLab Wiki][📜gl-wiki-img]][📜gl-wiki] [![GitHub Wiki][📜gh-wiki-img]][📜gh-wiki] |
|
|
75
|
-
| Compliance | [![License:
|
|
87
|
+
| Compliance | [![License: MIT][📄license-img]][📄license] [![Apache license compatibility: Category A][📄license-compat-img]][📄license-compat] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 3.0][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
|
|
76
88
|
| Style | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2] |
|
|
77
89
|
| Maintainer 🎖️ | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact Maintainer][🚂maint-contact-img]][🚂maint-contact] [![My technical writing][💖💁🏼♂️devto-img]][💖💁🏼♂️devto] |
|
|
78
90
|
| `...` 💖 | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼♂️aboutme-img]][💖💁🏼♂️aboutme] [🧊][💖🧊berg] [🐙][💖🐙hub] [🛖][💖🛖hut] [🧪][💖🧪lab] |
|
|
@@ -119,6 +131,8 @@ We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you m
|
|
|
119
131
|
|
|
120
132
|
See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
|
|
121
133
|
|
|
134
|
+
Want to contribute with AI coding agents? This project is developed with [Cloudroom][🖇cloudroom] and ships an `AGENTS.md` with repo conventions so agents can jump straight in. Signing up with [my referral link][🖇cloudroom] also supports ongoing maintenance at no extra cost to you.
|
|
135
|
+
|
|
122
136
|
## 📌 Versioning
|
|
123
137
|
|
|
124
138
|
This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
|
|
@@ -147,10 +161,8 @@ See [CHANGELOG.md][📌changelog] for a list of releases.
|
|
|
147
161
|
|
|
148
162
|
## 📄 License
|
|
149
163
|
|
|
150
|
-
The gem is available under the
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
If none of the available licenses suit your use case, please [contact us](mailto:floss@galtzo.com) to discuss a custom commercial license.
|
|
164
|
+
The gem is available as open source under the terms of
|
|
165
|
+
the [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.md) [![License: MIT][📄license-img]][📄license-ref].
|
|
154
166
|
|
|
155
167
|
### Please give the project a star ⭐ ♥.
|
|
156
168
|
|
|
@@ -160,6 +172,11 @@ If this project helps you, please consider supporting the maintainer. This is no
|
|
|
160
172
|
|
|
161
173
|
[![Sponsor me on GitHub Sponsors][🖇sponsor-bottom-img]][🖇sponsor] 💌 [![Sponsor me on Liberapay][⛳liberapay-bottom-img]][⛳liberapay] 💌 [![Donate on PayPal][🖇paypal-bottom-img]][🖇paypal] 💌 [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] 💌 [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
|
|
162
174
|
|
|
175
|
+
I use [Cloudroom][🖇cloudroom], an agentic AI coding environment, every day. It's the first AI product that made me say "shut up and take my money."
|
|
176
|
+
If you sign up with [my referral link][🖇cloudroom], I receive a share of your subscription for as long as you stay subscribed, at no extra cost to you.
|
|
177
|
+
|
|
178
|
+
[🖇cloudroom]: https://go.cloudroom.dev/u9f53f181a
|
|
179
|
+
|
|
163
180
|
Thanks for RTFM. ☺️
|
|
164
181
|
|
|
165
182
|
[⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
|
|
@@ -217,7 +234,6 @@ Thanks for RTFM. ☺️
|
|
|
217
234
|
[💖🐙hub]: https://github.org/pboling
|
|
218
235
|
[💖🛖hut]: https://sr.ht/~galtzo/
|
|
219
236
|
[💖🧪lab]: https://gitlab.com/pboling
|
|
220
|
-
[🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
|
|
221
237
|
[👨🏼🏫expsup-upwork]: https://www.upwork.com/freelancers/~014942e9b056abdf86?mp_source=share
|
|
222
238
|
[👨🏼🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
|
|
223
239
|
[👨🏼🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
|
|
@@ -266,7 +282,7 @@ Thanks for RTFM. ☺️
|
|
|
266
282
|
[🖐contributors]: https://github.com/structuredmerge/structuredmerge-ruby/graphs/contributors
|
|
267
283
|
[🖐contributors-img]: https://contrib.rocks/image?repo=structuredmerge/structuredmerge-ruby
|
|
268
284
|
[🪇conduct]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CODE_OF_CONDUCT.md
|
|
269
|
-
[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-
|
|
285
|
+
[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-3.0-259D6C.svg
|
|
270
286
|
[📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
|
271
287
|
[📌semver]: https://semver.org/spec/v2.0.0.html
|
|
272
288
|
[📌semver-img]: https://img.shields.io/badge/semver-2.0.0-259D6C.svg?style=flat
|
|
@@ -283,10 +299,10 @@ Thanks for RTFM. ☺️
|
|
|
283
299
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
284
300
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
285
301
|
[📄license]: LICENSE.md
|
|
286
|
-
[📄license-ref]:
|
|
287
|
-
[📄license-img]: https://img.shields.io/badge/License-
|
|
288
|
-
[📄license-compat]: https://www.apache.org/legal/resolved.html#category-
|
|
289
|
-
[📄license-compat-img]: https://img.shields.io/badge/
|
|
302
|
+
[📄license-ref]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.md
|
|
303
|
+
[📄license-img]: https://img.shields.io/badge/License-MIT-259D6C.svg
|
|
304
|
+
[📄license-compat]: https://www.apache.org/legal/resolved.html#category-a
|
|
305
|
+
[📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A-%E2%9C%93-259D6C.svg?style=flat&logo=Apache
|
|
290
306
|
|
|
291
307
|
[📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
|
|
292
308
|
[📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
|
data/lib/plain/merge/backend.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Plain
|
|
4
4
|
# StructuredMerge plain text fallback behavior.
|
|
5
5
|
module Merge
|
|
6
|
-
BACKEND_REFERENCE = TreeHaver::BackendReference.new(id:
|
|
6
|
+
BACKEND_REFERENCE = TreeHaver::BackendReference.new(id: "plain-line", family: "line")
|
|
7
7
|
|
|
8
8
|
module Backend
|
|
9
9
|
# TreeHaver language wrapper for plain text parsed into normalized line
|
|
@@ -26,7 +26,7 @@ module Plain
|
|
|
26
26
|
# normalized backend registry.
|
|
27
27
|
class Parser < TreeHaver::Base::Parser
|
|
28
28
|
def parse(source)
|
|
29
|
-
raise
|
|
29
|
+
raise "Language not set" unless language
|
|
30
30
|
|
|
31
31
|
Plain::Merge.analyze_text(source)
|
|
32
32
|
end
|
|
@@ -50,7 +50,7 @@ module Plain
|
|
|
50
50
|
language_name,
|
|
51
51
|
backend_module: Backend,
|
|
52
52
|
backend_type: :line,
|
|
53
|
-
gem_name:
|
|
53
|
+
gem_name: "plain-merge",
|
|
54
54
|
contract: :line
|
|
55
55
|
)
|
|
56
56
|
end
|
data/lib/plain/merge/provider.rb
CHANGED
|
@@ -5,8 +5,8 @@ module Plain
|
|
|
5
5
|
# Coarse whole-document provider for unstructured plain text.
|
|
6
6
|
# rubocop:disable Metrics/ClassLength, Metrics/MethodLength, Metrics/ParameterLists -- provider operations and envelopes form one cohesive boundary
|
|
7
7
|
class Provider
|
|
8
|
-
def provider_id =
|
|
9
|
-
def family =
|
|
8
|
+
def provider_id = "ruby.text"
|
|
9
|
+
def family = "text"
|
|
10
10
|
|
|
11
11
|
def capabilities
|
|
12
12
|
{
|
|
@@ -26,8 +26,8 @@ module Plain
|
|
|
26
26
|
def diff2(request)
|
|
27
27
|
before = request.fetch(:before_source)
|
|
28
28
|
after = request.fetch(:after_source)
|
|
29
|
-
changes = before == after ? [] : [classification(before, before, after)]
|
|
30
|
-
result(:diff2, request, changes: changes, diff: {
|
|
29
|
+
changes = (before == after) ? [] : [classification(before, before, after)]
|
|
30
|
+
result(:diff2, request, changes: changes, diff: {before: before, after: after, changes: changes})
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def merge2(request)
|
|
@@ -36,8 +36,8 @@ module Plain
|
|
|
36
36
|
:merge2,
|
|
37
37
|
request,
|
|
38
38
|
output: merged.fetch(:output),
|
|
39
|
-
render_report: {
|
|
40
|
-
verification: {
|
|
39
|
+
render_report: {strategy: :normalized_block_merge},
|
|
40
|
+
verification: {output_rendered: true}
|
|
41
41
|
)
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -61,15 +61,15 @@ module Plain
|
|
|
61
61
|
output: rendered.content,
|
|
62
62
|
changes: [classification(base, ours, theirs)],
|
|
63
63
|
render_report: render_report(rendered, :exact_revision),
|
|
64
|
-
verification: {
|
|
64
|
+
verification: {base_participated: true, output_reparsed: true, semantic_match: rendered.content == output}
|
|
65
65
|
)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def conflicted_merge3(request, base, ours, theirs)
|
|
69
69
|
conflict = {
|
|
70
|
-
conflict_id:
|
|
70
|
+
conflict_id: "text-conflict-root",
|
|
71
71
|
category: :edit_edit,
|
|
72
|
-
path:
|
|
72
|
+
path: "",
|
|
73
73
|
change_classification: classification(base, ours, theirs)
|
|
74
74
|
}
|
|
75
75
|
rendered = render(
|
|
@@ -82,7 +82,7 @@ module Plain
|
|
|
82
82
|
theirs: [conflict_side(:theirs, theirs)],
|
|
83
83
|
labels: request.fetch(:labels, {}),
|
|
84
84
|
marker_size: request.fetch(:conflict_marker_size, 7),
|
|
85
|
-
metadata: {
|
|
85
|
+
metadata: {path: "", category: :edit_edit}
|
|
86
86
|
)
|
|
87
87
|
]
|
|
88
88
|
)
|
|
@@ -90,20 +90,20 @@ module Plain
|
|
|
90
90
|
:merge3,
|
|
91
91
|
request,
|
|
92
92
|
category: :merge_conflict,
|
|
93
|
-
message:
|
|
93
|
+
message: "Plain text changed independently on both sides.",
|
|
94
94
|
changes: [conflict.fetch(:change_classification)],
|
|
95
95
|
conflicts: [conflict],
|
|
96
96
|
conflicted_output: rendered.content,
|
|
97
97
|
render_report: render_report(rendered, :whole_document_conflict),
|
|
98
|
-
verification: {
|
|
98
|
+
verification: {base_participated: true}
|
|
99
99
|
)
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
def classification(base, ours, theirs)
|
|
103
103
|
{
|
|
104
|
-
path:
|
|
105
|
-
ours: base == ours ? :unchanged : :edited,
|
|
106
|
-
theirs: base == theirs ? :unchanged : :edited
|
|
104
|
+
path: "",
|
|
105
|
+
ours: (base == ours) ? :unchanged : :edited,
|
|
106
|
+
theirs: (base == theirs) ? :unchanged : :edited
|
|
107
107
|
}.freeze
|
|
108
108
|
end
|
|
109
109
|
|
|
@@ -116,7 +116,7 @@ module Plain
|
|
|
116
116
|
theirs: request[:theirs_source].to_s
|
|
117
117
|
},
|
|
118
118
|
fragments: fragments,
|
|
119
|
-
metadata: {
|
|
119
|
+
metadata: {provider_id: provider_id}
|
|
120
120
|
)
|
|
121
121
|
)
|
|
122
122
|
end
|
|
@@ -124,10 +124,10 @@ module Plain
|
|
|
124
124
|
def source_fragment(role, source)
|
|
125
125
|
if source.empty?
|
|
126
126
|
return Ast::Merge::SourceRender::SynthesizedFragment.new(
|
|
127
|
-
content:
|
|
127
|
+
content: "",
|
|
128
128
|
reason: :exact_empty_source,
|
|
129
129
|
producer: provider_id,
|
|
130
|
-
metadata: {
|
|
130
|
+
metadata: {source_role: role}
|
|
131
131
|
)
|
|
132
132
|
end
|
|
133
133
|
|
|
@@ -135,7 +135,7 @@ module Plain
|
|
|
135
135
|
revision: role,
|
|
136
136
|
start_line: 1,
|
|
137
137
|
end_line: [source.lines.length, 1].max,
|
|
138
|
-
metadata: {
|
|
138
|
+
metadata: {source_role: role}
|
|
139
139
|
)
|
|
140
140
|
end
|
|
141
141
|
|
|
@@ -143,10 +143,10 @@ module Plain
|
|
|
143
143
|
return source_fragment(role, source) if !source.empty? && source.end_with?("\n")
|
|
144
144
|
|
|
145
145
|
Ast::Merge::SourceRender::SynthesizedFragment.new(
|
|
146
|
-
content: source.empty? ?
|
|
146
|
+
content: source.empty? ? "" : "#{source}\n",
|
|
147
147
|
reason: :conflict_line_boundary,
|
|
148
148
|
producer: provider_id,
|
|
149
|
-
metadata: {
|
|
149
|
+
metadata: {source_role: role, copied_source: true}
|
|
150
150
|
)
|
|
151
151
|
end
|
|
152
152
|
|
|
@@ -170,7 +170,7 @@ module Plain
|
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
def failure(operation, request, category:, message:, changes: [], conflicts: [], render_report: {},
|
|
173
|
-
|
|
173
|
+
verification: {}, **payload)
|
|
174
174
|
Ast::Merge::ProviderResult.build(
|
|
175
175
|
operation: operation,
|
|
176
176
|
success: false,
|
|
@@ -178,7 +178,7 @@ module Plain
|
|
|
178
178
|
request,
|
|
179
179
|
changes: changes,
|
|
180
180
|
conflicts: conflicts,
|
|
181
|
-
diagnostics: [{
|
|
181
|
+
diagnostics: [{category: category, severity: :error, message: message, blocking: true}],
|
|
182
182
|
render_report: render_report,
|
|
183
183
|
verification: verification
|
|
184
184
|
),
|
|
@@ -196,7 +196,7 @@ module Plain
|
|
|
196
196
|
package: Plain::Merge::PACKAGE_NAME,
|
|
197
197
|
package_version: Plain::Merge::Version::VERSION
|
|
198
198
|
},
|
|
199
|
-
profile: {
|
|
199
|
+
profile: {profile_id: request[:profile_id] || :coarse_document}
|
|
200
200
|
}.merge(fields)
|
|
201
201
|
end
|
|
202
202
|
end
|
data/lib/plain/merge/version.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Plain
|
|
|
5
5
|
# Version namespace for this gem.
|
|
6
6
|
module Version
|
|
7
7
|
# Current gem version.
|
|
8
|
-
VERSION =
|
|
8
|
+
VERSION = "8.0.0"
|
|
9
9
|
end
|
|
10
10
|
# Current gem version exposed at the traditional constant location.
|
|
11
11
|
VERSION = Version::VERSION # Traditional Constant Location
|
data/lib/plain/merge.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require_relative
|
|
3
|
+
require "ast/merge"
|
|
4
|
+
require "tree_haver"
|
|
5
|
+
require_relative "merge/version"
|
|
6
6
|
|
|
7
7
|
module Plain
|
|
8
8
|
module Merge
|
|
9
|
-
PACKAGE_NAME =
|
|
9
|
+
PACKAGE_NAME = "plain-merge"
|
|
10
10
|
DEFAULT_TEXT_REFINEMENT_THRESHOLD = 0.7
|
|
11
11
|
DEFAULT_TEXT_REFINEMENT_WEIGHTS = {
|
|
12
12
|
content: 0.7,
|
|
@@ -14,13 +14,13 @@ module Plain
|
|
|
14
14
|
position: 0.15
|
|
15
15
|
}.freeze
|
|
16
16
|
|
|
17
|
-
autoload :Provider,
|
|
17
|
+
autoload :Provider, "plain/merge/provider"
|
|
18
18
|
|
|
19
19
|
module_function
|
|
20
20
|
|
|
21
21
|
def text_feature_profile
|
|
22
22
|
{
|
|
23
|
-
family:
|
|
23
|
+
family: "text",
|
|
24
24
|
supported_dialects: [],
|
|
25
25
|
supported_policies: []
|
|
26
26
|
}
|
|
@@ -35,7 +35,7 @@ module Plain
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def text_parse_request(source)
|
|
38
|
-
TreeHaver::ParserRequest.new(source: source, language:
|
|
38
|
+
TreeHaver::ParserRequest.new(source: source, language: "text")
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def normalize_text(source)
|
|
@@ -43,7 +43,7 @@ module Plain
|
|
|
43
43
|
.gsub(/\r\n?/, "\n")
|
|
44
44
|
.strip
|
|
45
45
|
.split(/\n\s*\n+/)
|
|
46
|
-
.map { |block| block.strip.gsub(/\s+/,
|
|
46
|
+
.map { |block| block.strip.gsub(/\s+/, " ") }
|
|
47
47
|
.reject(&:empty?)
|
|
48
48
|
.join("\n\n")
|
|
49
49
|
end
|
|
@@ -69,7 +69,7 @@ module Plain
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
{
|
|
72
|
-
kind:
|
|
72
|
+
kind: "text",
|
|
73
73
|
normalized_source: normalized_source,
|
|
74
74
|
blocks: blocks
|
|
75
75
|
}
|
|
@@ -119,7 +119,7 @@ module Plain
|
|
|
119
119
|
matched << {
|
|
120
120
|
template_index: template_index,
|
|
121
121
|
destination_index: destination_index,
|
|
122
|
-
phase:
|
|
122
|
+
phase: "exact",
|
|
123
123
|
score: 1.0
|
|
124
124
|
}
|
|
125
125
|
next
|
|
@@ -149,7 +149,7 @@ module Plain
|
|
|
149
149
|
matched << {
|
|
150
150
|
template_index: best_template_index,
|
|
151
151
|
destination_index: destination_index,
|
|
152
|
-
phase:
|
|
152
|
+
phase: "refined",
|
|
153
153
|
score: best_score
|
|
154
154
|
}
|
|
155
155
|
end
|
|
@@ -182,7 +182,7 @@ module Plain
|
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
def refined_text_similarity(template_block, destination_block, template_total, destination_total,
|
|
185
|
-
|
|
185
|
+
weights = DEFAULT_TEXT_REFINEMENT_WEIGHTS)
|
|
186
186
|
content = string_similarity(template_block[:normalized], destination_block[:normalized])
|
|
187
187
|
length = length_similarity(template_block[:normalized], destination_block[:normalized])
|
|
188
188
|
position = position_similarity(
|
|
@@ -223,7 +223,7 @@ module Plain
|
|
|
223
223
|
current[0] = right_index
|
|
224
224
|
|
|
225
225
|
(1..left.length).each do |left_index|
|
|
226
|
-
cost = left[left_index - 1] == right[right_index - 1] ? 0 : 1
|
|
226
|
+
cost = (left[left_index - 1] == right[right_index - 1]) ? 0 : 1
|
|
227
227
|
current[left_index] = [
|
|
228
228
|
current[left_index - 1] + 1,
|
|
229
229
|
previous[left_index] + 1,
|
|
@@ -258,7 +258,7 @@ module Plain
|
|
|
258
258
|
private_class_method :length_similarity
|
|
259
259
|
|
|
260
260
|
def relative_position(index, total)
|
|
261
|
-
total > 1 ? index.to_f / (total - 1) : 0.5
|
|
261
|
+
(total > 1) ? index.to_f / (total - 1) : 0.5
|
|
262
262
|
end
|
|
263
263
|
private_class_method :relative_position
|
|
264
264
|
|
|
@@ -272,6 +272,6 @@ module Plain
|
|
|
272
272
|
end
|
|
273
273
|
end
|
|
274
274
|
|
|
275
|
-
require_relative
|
|
275
|
+
require_relative "merge/backend"
|
|
276
276
|
Plain::Merge.register_backend!
|
|
277
277
|
Plain::Merge.register_provider!
|
data/lib/plain-merge.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
4
|
-
require
|
|
5
|
-
require_relative
|
|
3
|
+
require_relative "plain/merge"
|
|
4
|
+
require "version_gem"
|
|
5
|
+
require_relative "plain/merge/version"
|
|
6
6
|
|
|
7
7
|
Plain::Merge::Version.class_eval do
|
|
8
8
|
extend VersionGem::Basic
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: plain-merge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 8.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -44,7 +44,7 @@ dependencies:
|
|
|
44
44
|
-
|
|
45
45
|
- "="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
47
|
+
version: 8.0.0
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
-
|
|
53
53
|
- "="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version:
|
|
55
|
+
version: 8.0.0
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: tree_haver
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -60,7 +60,7 @@ dependencies:
|
|
|
60
60
|
-
|
|
61
61
|
- "="
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
|
-
version:
|
|
63
|
+
version: 8.0.0
|
|
64
64
|
type: :runtime
|
|
65
65
|
prerelease: false
|
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -68,7 +68,7 @@ dependencies:
|
|
|
68
68
|
-
|
|
69
69
|
- "="
|
|
70
70
|
- !ruby/object:Gem::Version
|
|
71
|
-
version:
|
|
71
|
+
version: 8.0.0
|
|
72
72
|
- !ruby/object:Gem::Dependency
|
|
73
73
|
name: version_gem
|
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -104,7 +104,7 @@ dependencies:
|
|
|
104
104
|
-
|
|
105
105
|
- ">="
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
|
-
version: 3.1.
|
|
107
|
+
version: 3.1.41
|
|
108
108
|
type: :development
|
|
109
109
|
prerelease: false
|
|
110
110
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -116,7 +116,7 @@ dependencies:
|
|
|
116
116
|
-
|
|
117
117
|
- ">="
|
|
118
118
|
- !ruby/object:Gem::Version
|
|
119
|
-
version: 3.1.
|
|
119
|
+
version: 3.1.41
|
|
120
120
|
- !ruby/object:Gem::Dependency
|
|
121
121
|
name: bundler-audit
|
|
122
122
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -232,7 +232,7 @@ dependencies:
|
|
|
232
232
|
-
|
|
233
233
|
- ">="
|
|
234
234
|
- !ruby/object:Gem::Version
|
|
235
|
-
version: 2.0.
|
|
235
|
+
version: 2.0.32
|
|
236
236
|
type: :development
|
|
237
237
|
prerelease: false
|
|
238
238
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -244,7 +244,7 @@ dependencies:
|
|
|
244
244
|
-
|
|
245
245
|
- ">="
|
|
246
246
|
- !ruby/object:Gem::Version
|
|
247
|
-
version: 2.0.
|
|
247
|
+
version: 2.0.32
|
|
248
248
|
- !ruby/object:Gem::Dependency
|
|
249
249
|
name: turbo_tests2
|
|
250
250
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -350,14 +350,13 @@ files:
|
|
|
350
350
|
- sig/plain/merge.rbs
|
|
351
351
|
homepage: "https://github.com/structuredmerge/structuredmerge-ruby"
|
|
352
352
|
licenses:
|
|
353
|
-
-
|
|
354
|
-
- PolyForm-Small-Business-1.0.0
|
|
353
|
+
- MIT
|
|
355
354
|
metadata:
|
|
356
355
|
homepage_uri: "https://structuredmerge.org"
|
|
357
|
-
source_code_uri: "https://github.com/structuredmerge/structuredmerge-ruby/tree/
|
|
358
|
-
changelog_uri: "https://github.com/structuredmerge/structuredmerge-ruby/blob/
|
|
356
|
+
source_code_uri: "https://github.com/structuredmerge/structuredmerge-ruby/tree/v8.0.0"
|
|
357
|
+
changelog_uri: "https://github.com/structuredmerge/structuredmerge-ruby/blob/v8.0.0/CHANGELOG.md"
|
|
359
358
|
bug_tracker_uri: "https://github.com/structuredmerge/structuredmerge-ruby/issues"
|
|
360
|
-
documentation_uri: "https://www.rubydoc.info/gems/plain-merge/
|
|
359
|
+
documentation_uri: "https://www.rubydoc.info/gems/plain-merge/8.0.0"
|
|
361
360
|
funding_uri: "https://github.com/sponsors/pboling"
|
|
362
361
|
wiki_uri: "https://github.com/structuredmerge/structuredmerge-ruby/wiki"
|
|
363
362
|
news_uri: "https://www.railsbling.com/tags/plain-merge"
|
metadata.gz.sig
CHANGED
|
Binary file
|