Skip to content
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

Tag diff #14

Closed
wants to merge 13 commits into from
Closed

Tag diff #14

wants to merge 13 commits into from

Conversation

jjmachan
Copy link
Contributor

@jjmachan jjmachan commented Apr 2, 2020

Adding TagDiff

Why is this change required? What problem does it solve? Describe your changes in detail:

This is used to perform a diff of the tags in Stockroom and create a neat representation of the same.

If it fixes an open issue, please link to the issue here:

#9

Screenshots (if appropriate):

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Documentation update
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@CLAassistant
Copy link

CLAassistant commented Apr 2, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@hhsecond hhsecond left a comment

Choose a reason for hiding this comment

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

I have some slight comments about the programming style that we are following in this repo. I'll take another look soon for the APIs and the workflow

return ''.join(output)

def _repr_html_(self):
return print(self.gen_tables())._repr_html_()
Copy link
Member

Choose a reason for hiding this comment

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

Why do you have to print this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The print function is used to generate the HTML in Rich

table = Table(title='Diff %s..%s'%(self.ref_commit[2:7], self.dest_commit[2:7]))

# Generate Columns
column_headings = ['Tags'] + [self.ref_commit, self.dest_commit]
Copy link
Member

Choose a reason for hiding this comment

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

Can't you just do ['Tags', self.ref_commit, self.dest_commit]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this seems better...will convert

dest_row = ""

if row in self._added:
dest_row = "[green] %s [/green]"%(self._added[row])
Copy link
Member

Choose a reason for hiding this comment

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

Use fstrings whenever possible. Fstrings is the new feature added to 3.6 and since we support only 3.6+, it's preferable to use that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do that

Parse the hangar.diff and store the changes in the TagDiff object
"""

print('Accessing ref_commit')
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should print these messages; do you have any specific reason to think would help the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No I guess not now ... but maybe later when we have the capabilities to diff with multiple branches and staged? seemed like a good info but does clutter it.

Copy link
Member

Choose a reason for hiding this comment

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

@hhsecond I think that for the purposes of Stockroom, it would be a good idea to implement some sort of logging which records the series of operations performed...

As we've discussed, managing branching/merging will be a bit of a coordination challenge (syncronizing branches between Git & Hangar), and i can imagine there are a few corner cases where having an audit log of

accessed commit #foo
diffed commit #foo << #bar
checking out tag "vFoo.Bar.Baz"
created branch xyz
...

would be super helpful for debugging purposes.

The hangar core can reconstruct the sequence of operations by querying it's internals directly, but since that isn't available to stockroom (It's not a public API, and never will be) it wouldn't be the worst idea to use a logging file handler to record stuff like this (even if it's not printed to the screen).

Just my 2-cents worth of input :)

@lgtm-com
Copy link

lgtm-com bot commented Apr 17, 2020

This pull request introduces 2 alerts when merging 3e0bc23 into d133577 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Non-standard exception raised in special method

@hhsecond
Copy link
Member

Closing since inactive and since it has been stalled

@hhsecond hhsecond closed this Aug 12, 2020
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.

4 participants