Comments (3)
@wetneb There is unfortunately no simple way to just tack on the base part of the conflict after the merge has completed. The merge algorithm works by removing so-called inconsistencies in the raw merge (which is just the set union of all three ASTs), and iteratively removes anything from the base revision that is inconsistent with either the left or right revision. So, by definition, when the merge has completed and conflicts have been resolved, the base part of any conflict is already gone.
For a brief definition of the merge algorithm, you can refer to section 2.2 of the whitepaper (a preprint is freely available on arxiv). For a significantly more in-depth explanation with worked examples, you may refer to Chapter 4 of my master's thesis (note: it's quite a long read).
I never had time to get around to even experimenting with outputting the base revision due to being short on time, but off the top of my head I can imagine two potential ways of resolving the base part of a conflict. Do note that these are ideas born from thinking through code I wrote 4 years ago, so I can't guarantee either will work in practice.
- When removing inconsistencies, keep track of which base revision PCS triples are removed by what left/right revision triples.
- When outputting conflicts, use the base/left or base/right mappings to find the corresponding part of the base revision.
It feels a bit weird: intuitively the parser should not need to know about how we want to display conflicts.
This is the canonical way to use Spoon: set the environment first (which includes the pretty printer), and then parse, analyze/transform and pretty print with that environment. Setting of the printer requires modifications to the environment, and doing that at any time after parsing would be a bit unexpected. There also was never a reason to leave this configurable before, so there's that as well. Feel free to put up a PR with improvements.
from spork.
from spork.
It's not actually clear to me if the algorithm used to generate the conflicts allows for generating a "base" part alongside the "left" and "right" ones.
This seems to be the place where the "left" and "right" parts are currently extracted:
spork/src/main/kotlin/se/kth/spork/spoon/pcsinterpreter/SporkTreeBuilder.kt
Lines 213 to 226 in e440feb
Not being familiar with the PCS structure, it's not clear to me if there is a simple way to also generate the "base" part in this context. I don't even know if it actually makes sense - it's unclear to me to what extent the base revision is relied on, so it can well be that there are cases where only the left and right revisions are compared, without the ability to trace elements back to the base revision?
@monperrus are you clear on this?
from spork.
Related Issues (20)
- Bad URL in replication/install.sh
- replication/install.sh uses curl, but that's not available by default on Ubuntu 18.04
- Build benchmarks fail because the jars pointed to no longer exist
- Convert to Kotlin
- Use a single logger for the entire project
- Add support for macOS
- Add support for Windows
- Run file merge benchmark only on master
- Update setup-java in GitHub Actions workflow to v2.0.0
- Feedback about Spork's dependency management HOT 3
- Remove comments on version numbers from GitHub Actions
- Conflicts on non-syntactical elements HOT 1
- Conflicts where left == right
- Java 21 support HOT 3
- Package as a native image to speed up merges HOT 1
- Update jgit HOT 1
- Try using gumtree-simple matcher in Spork instead of gumtree-classic HOT 3
- Absence of conflict in delete/modify case HOT 2
- Unexpected and invalid merge outputs HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spork.