Skip to content

Conversation

@njam
Copy link
Contributor

@njam njam commented Feb 16, 2018

By default disabled, can be enabled and configured with --context NUM.
image

Wdyt?
This is my first time writing Go code, please let me know if my naming is off, something should be refactored or just be done differently!

The code iterates over all diff records and keep track of how many lines are between the closest change (addition or removal) before the current line. Then it iterates again through all diff records but backwards and adjusts the distance if the closest change after the current line is closer.
When printing the diff we can then simply omit records that have a distance larger than the desired context.

I have an alternative implementation which first creates chunks and then iterates over chunks of diffs to print, if you prefer it: diff-with-chunks.go.

@njam
Copy link
Contributor Author

njam commented Apr 25, 2018

@databus23 I've updated the branch to the new CLI interace.
Maybe a flag like --context which is not available in helm upgrade should go before the "upgrade" now? So it's helm diff --context 3 upgrade ...?

@helgi
Copy link
Contributor

helgi commented Apr 27, 2018

This one would be great to have, even without --context or similar; makes it similar to have diff works

@mumoshu
Copy link
Collaborator

mumoshu commented Jun 4, 2018

@njam Thank you so much for contributing the awesome feature!

@zytek updated your work in #53 and I added my comments there. Would you mind taking a look?

@njam
Copy link
Contributor Author

njam commented Jun 9, 2018

@mumoshu I've added the --context option to all CLI commands that print a diff, and added a unit test.
wdyt?

By default disabled, can be enabled and configured with `--context NUM`.
@njam
Copy link
Contributor Author

njam commented Jun 18, 2018

@mumoshu when you have a moment, would you be able to review this?

@njam
Copy link
Contributor Author

njam commented Jun 25, 2018

@mumoshu let me know if something should be changed! :)

Copy link
Collaborator

@mumoshu mumoshu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@njam Thanks for your effort and the reminder! LGTM.

@mumoshu mumoshu merged commit 9de4152 into databus23:master Jun 27, 2018
@njam
Copy link
Contributor Author

njam commented Jun 27, 2018

Cool, thanks!

@njam
Copy link
Contributor Author

njam commented Jun 27, 2018

Should I add a Travis config? Or you will do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants