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

#671: convert str to Fact before check #672

Merged
merged 1 commit into from
Mar 13, 2021

Conversation

aquaherd
Copy link
Member

Please accept this PR into the next hamster release.
It enables the xfce4-panel-plugin to do in-place edits without adding a json library dependency.

Original author is @ederag .

@aquaherd aquaherd linked an issue Mar 12, 2021 that may be closed by this pull request
Copy link
Member

@matthijskooijman matthijskooijman left a comment

Choose a reason for hiding this comment

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

@ederag Thanks for looking into this, @aquaherd thanks for putting this into a PR. Looks like a good fix for the update_fact method in isolation. I haven't tested the code, but it looks like both of you did, so I'm approving this.

As a followup to this (or maybe do it directly, since it would also fix this problem), I wonder if it would be good to handle the # to be removed once update facts use Fact directly. comment by moving the string-to-fact conversion (i.e. the Fact.parse() and fact.copy lines) into Storage.UpdateFact(), since I believe that is the only call to update_fact that currently (and always) passes a string. This would also allow removing the start_time and end_time arguments, which are then completely unused. @ederag, would you agree, or is there some indirect call still possible that needs to keep compatibility?

@ederag
Copy link
Collaborator

ederag commented Mar 12, 2021

No, I do not have time to explain in details, but it's exactly where it should be, IMO.

@matthijskooijman
Copy link
Member

No, I do not have time to explain in details, but it's exactly where it should be, IMO.

Hm, I'm not sure I understand why, but let's just leave it at this fix and leave any refactoring for later, then.

I've updated the commit message to be a bit more verbose and link to the isssue (@aquaherd this means I did a force push to your branch, so pull carefully).

As far as I'm concerned this is ready to merge once another approval is added (or, since it is a rather simple change, if nobody objects for some time, I guess).

@ederag
Copy link
Collaborator

ederag commented Mar 13, 2021

I've updated the commit message to be a bit more verbose and link to the isssue

You play the boss, part of which I understand (you are responsible for the commits),
but in doing so you lost my commit date,
used a commit message that do not follow standard git conventions
(both are important to me, and that's what future devs will see)
and moreover, lost track that it was @aquaherd
who made the work of rebasing my commit onto master.
Your call, but to me, this is bad practice.

This method was written to handle either a Fact object or a string
description of a fact. However, the string-to-Fact conversion happened
too late in the method, after `check_fact()` was called, which requires
a Fact object, leading to an error like:

    AttributeError: 'dbus.String' object has no attribute 'start_time'

This happened in particular when using the DBus UpdateFact method, which
always passes a string to `update_fact()`.

This commit ensures that the string-to-Fact conversion is done
immediately, so the rest of the method can just assume there is a Fact
method.

This fixes projecthamster#671.

Thanks to ederag for this commit, and to Hakan Erduman for submitting it
in a PR.
@matthijskooijman
Copy link
Member

I agree that preserving sufficient history and crediting is important.

but in doing so you lost my commit date,

But the original authorship date is still used? It is shown by default in git show and if you show more details, you can see both the original authordate and the latest commitdate. There is no record of any intermediate commitdates, but I don't think git supports tracking those (your commit date was already lost in the rebase done by @aquaherd).

$ git show 864fa0fc4996d3eea3f10719e87d4068dcf2ae75 | grep Date
Date:   Thu Mar 11 21:10:01 2021 +0100
$ git show --pretty=fuller 864fa0fc4996d3eea3f10719e87d4068dcf2ae75 | grep Date
AuthorDate: Thu Mar 11 21:10:01 2021 +0100
CommitDate: Sat Mar 13 09:52:40 2021 +0100

used a commit message that do not follow standard git conventions

Which convention in particular? Standard git convention, AFAIK, is a single summary line, empty line and a detailed description On top of that I'm using a different convention than you have done in the past, in order to improve readability and verbosity.

and moreover, lost track that it was @aquaherd
who made the work of rebasing my commit onto master.

Good point. This is normally covered by the Author attribute, but since @aquaherd is not the original author, their credit got lost. I've added a note to the commit message to fix that.

@ederag
Copy link
Collaborator

ederag commented Mar 13, 2021

It feels longer to read and answer you than to fix things.

image

That's what devs see on github ("authored and committed 7 minutes ago"),
and @aquaherd is visible only at the bottom of a wordy text.

@matthijskooijman
Copy link
Member

That's what devs see on github ("authored and committed 7 minutes ago"),

As for the timestamp: This is a choice made by github (to show the commit date more prominently than the author date, unlike git, which prefers the AuthorDate), which is maybe unfortunate, but IMHO also not a big deal. It does not seem a good idea to me to provide an incorrect CommitDate for this commit just to get Github to display this nicer.

As for the crediting: If git would be able to list multiple committers, I'd be happy to do so, but the current approach is that git tracks the author and the most recent committer, so that's what's happening here. Again, I do not think it would be good to change the committer here, which would make it less clear who has finalized this commit.

@aquaherd aquaherd merged commit a3c1840 into projecthamster:master Mar 13, 2021
@ederag
Copy link
Collaborator

ederag commented Mar 13, 2021

would make it less clear who has finalized this commit.

In my opinion, you did little (but delaying) in comparison to @aquaherd.

@ederag
Copy link
Collaborator

ederag commented Mar 13, 2021

@aquaherd You merged a commit I explicitly opposed to, which I find disrespectful, for your information.
(it's not just about you, there's also the commit message itself)

@aquaherd
Copy link
Member Author

aquaherd commented Mar 13, 2021

I am sorry if I hurt your feelings - please be assured that I did not intend any disrespect to you or any of the contributors to this repository.

All we did was moving four lines of code downward by four and I am rather uninterested in who's getting credit or how the commit message adheres to whose standards as long as there's a fix upstreamed to the next release whenever that may be.

Everybody please just relax :)

@ederag
Copy link
Collaborator

ederag commented Mar 13, 2021

"Everybody please" don't tell me to "relax" when I just call for mere respect 🙂.
You bypassed my explicit wishes,
just after I fixed your issue !

Anyway, if those were your best apologies, then they are accepted. Let's forget this one.

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.

UpdateFact DBus-Method not callable
3 participants