-
Notifications
You must be signed in to change notification settings - Fork 0
[#58] Add intermediate representation #1
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
[#58] Add intermediate representation #1
Conversation
How much work would it be to now pipe the diff into |
@SuperSandro2000 do you want to diff sources and environments in other way? In that case, you need to change |
@rvem what do you think about adding Generic and Data instances to all types of tree? |
What are the use-cases for them? 🤔 |
We provide Diff tree functionality as library, so it will be great to have possibility to make some orphan instances with generic / use uniplate on resulting tree. But now I understand, that user can make orphan instances of Generic/Data, if he wants. |
I basically want to fix Gabriella439#42 |
You can count offsets and print only parts that differ with calculated position. I think, it can be easily done in renderText function by adding new flag to the render ReaderT environment and changing algorithm of text building. |
It would be easy if I would know a thing about Haskell 🙃 |
golden-tests/expected-output
Outdated
@@ -0,0 +1,1014 @@ | |||
- /nix/store/5kwdw9nynm8195n9dvn6zzx0rbxb2cvm-nixos-system-nixos-22.11.20221013.cfea568.drv:{out} |
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.
Does the upstream master nix-diff
version produce the same output?
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.
Yes, I tested on version from nixpkgs
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.
Also, does this test cover all possible diff elements, i.e. there are different inputs, outputs, environment parts?
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.
Also, does this test cover all possible diff elements, i.e. there are different inputs, outputs, environment parts?
I'm not sure about that.
Yes, I tested on version from nixpkgs
I start to test it one another time now and get difference. Replaced cmp -u
with diff
and got this output
38c38
<
---
>
44c44
<
---
>
46,48c46,48
<
<
<
---
>
>
>
58c58
<
---
>
...
So I need to understand, what is the source of difference and replace cmp -u
with diff
, because it helps us to get more sensible error.
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.
I'm not sure about that.
I think it's important to have tests that cover all possible cases, so please check and update tests if needed 🙃
golden-tests/run-test.sh
Outdated
@@ -0,0 +1,9 @@ | |||
#!/usr/bin/env bash | |||
|
|||
export OLD_DRV="$(nix-instantiate ./old-derivation/drv.nix)" |
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.
A small nitpick: you probably don't need to export
them, old_drv="$(nix-instantiate ./old-derivation/drv.nix)"
will be just enough to make it available in the scope of the remaining script, and AFAICS, these env variables aren't used anywhere in the subsequent calls
Problem: There is no way to reuse result of diff alghorithm because program print it into stdout in human readable format in-place. Solution: divide steps of finding diff between two derivations and printing it out. Now result of `diff` is tree with result of derivation comparison, that you can print than in stdout as was before, or use in your program.
Problem: we need to check if code changes will also change the behavior Solution: add test, that will make two derivations and check if output of program will be different of saved one.
21d3e97
to
f5c009b
Compare
Problem: There is no way to reuse the result of diff algorithm because program print it into stdout in human readable format in-place.
Solution: divide steps of finding diff between two derivations and printing it out. Now result of
diff
is tree with result of derivation comparison, that you can print than in stdout as was before, or use in your program.