Re:Mergiraf: a syntax-aware merge driver for Git
by wetneb on Saturday November 09, 2024 @08:04AM
(#42094209)
I tried your example but git does create a conflict in my case - but maybe I misunderstood the scenario.
Python support can likely be done (I would be thrilled if someone made a PR for it), but I don't know if there is a lot of potential for solving conflicts there: imports can have side effects, function arguments are complicated with the mixture of positional and keyword arguments, decorators are effectful… it seems to me that there is a lot of sensitivity to order in many places.
Re:Mergiraf: a syntax-aware merge driver for Git
by masklinn on Saturday November 09, 2024 @08:32AM
(#42094317)
FWIW your examples are very unclear as they use text formatting, you need to indent lines by 4 spaces (with an empty line before and after) for a code block e.g.
if a == b: print("x")
versus
if a == b:
print("x")
Re:Mergiraf: a syntax-aware merge driver for Git
by chrismorgan on Saturday November 09, 2024 @08:53AM
(#42094423)
The minimum required is actually only two spaces.
x = input()
if x == 'x': print('foo')
If you delete the first print in a branch, delete the other print in another branch, then merge the two branches, you'll have this:x = input()
if x == 'x':
Both branches delete a portion of the code inside the if block, leaving it only with a whitespace. In Python it is not a valid code, as they empty scopes need to be declared with pass.
I installed Mergiraf to see if it can solve this situation, but sadly, it doesn't support Python...