Skip to content

Conversation

@snogge
Copy link
Contributor

@snogge snogge commented Sep 26, 2019

This is the current status of my work to add bitbucket support to
forge.

I think all issue operations are supported, but it does rely on #196,
which is also included in this PR.

It relies on magit/ghub#97 for mutating
operations.

I would appreciate all feedback on how to improve this code, and tips
on things in the forge architecture that I have missed.

@snogge
Copy link
Contributor Author

snogge commented Sep 29, 2019

Rebased to not use #196 but rather the proper fix for #195.

Copy link
Member

@tarsius tarsius left a comment

Choose a reason for hiding this comment

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

There's a strange typo in the commit message.

The string "bitbake" also appears in code added by later commits.

@tarsius
Copy link
Member

tarsius commented Sep 30, 2019

Chop of unreadble second decimals for bitbucket

So that means that earlier commits are broken right? I would prefer not to merge any commits that are known to be broken. Instead of this you can add forge--bitbucket-hack-iso8601 in a separate commit, without actually using it right away. That way you can explain why this is necessary in a commit message, without having a commit message that talks about this and other unrelated stuff.

In a similar vain I would add all the ghub--buck-METHOD functions in a single commit, which adds nothing else and doesn't actually start using any of these functins yet. These functions are basically boilerplate and adding one of them in the same commit that starts using it makes that commit look more involved than it actually is. Also if all this boilerplate is added in a single commit, then it is easier to verify that no copy-paste error has occurred when creating one of these functions.

@snogge
Copy link
Contributor Author

snogge commented Oct 1, 2019

I've moved the addition of forge--buck-* functions to a separate commit, ditto for forge--bitbucket-hack-iso8601.
I've gone over the commit messages but I'm not sure I understand what you mean in your comment about that.

@tarsius
Copy link
Member

tarsius commented Oct 1, 2019

I've gone over the commit messages but I'm not sure I understand what you mean in your comment about that.

I'm pretty sure you mean bitbucket.org when you write bitbake.org.

@snogge
Copy link
Contributor Author

snogge commented Oct 2, 2019

Right. bitbake is a tool I use at work, and obviously I use it so much that I type that over bitbucket, and I cannot even see when I'm doing it. I think I've fixed all bitbake mentions now.

@snogge snogge requested a review from tarsius October 3, 2019 04:10
@tarsius
Copy link
Member

tarsius commented Oct 4, 2019

What is the purpose of the ;; checkdoc-params: (forge-bitbucket-repository) comments?

You also added doc-strings for some methods that apply just as much to the other (gitlab) methods of the respective generic functions. I think you should remove those and instead maintain a list of "generic functions that now have at least two methods and which should therefore be explicitly defined eventually, at which point we can also add the doc-string". 😉

@tarsius
Copy link
Member

tarsius commented Oct 4, 2019

tarsius approved these changes 8 minutes ago

I was merely trying to confirm that you had taken care of changes that I had already requested. I haven't actually reviewed the rest yet. I'll do that when you tell me it is "done" (the same features as for gitlab are supported) or you ask me specific questions.

Comment on lines 21 to 24
;;; Commentary:

;;; Limited support for bitbucket.org in forge.

Copy link
Member

Choose a reason for hiding this comment

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

Since the other libraries do not have such a header, don't add one here either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

(let (assignees)
(dolist (issue (alist-get 'issues val))
(setq assignees
(seq-uniq (append (forge--bitbucket-issue-users issue)
Copy link
Member

Choose a reason for hiding this comment

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

You did not require seq.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@tarsius
Copy link
Member

tarsius commented Oct 5, 2019

Now that I have looked at the code I can say that this generally looks reasonable. Since this mostly based on the Gitlab code that I have written, it's not surprising that I would come to that conclusion. ;-)

You are generally on the right track. If you were waiting for that statement before tackling the remaining big gaps, then you can continue working on this now. If you were hoping I would merge this despite it being rather incomplete, then I have to disappoint you. This should be about on par with Gitlab. So I suggest you use this yourself and fix bugs and implement missing features as you go. And then ping me when it is complete or if you are running into issues.

@snogge
Copy link
Contributor Author

snogge commented Oct 5, 2019

What is the purpose of the ;; checkdoc-params: (forge-bitbucket-repository) comments?

checkdoc will complain that forge-bitbucket-repository should be mentioned as a parameter - which is clearly wrong. The checkdoc-param comment suppresses that warning. The correct thing would be to make checkdoc handle generic functions, but I didn't want to be distracted.
I'm fine with removing these comments before merging.

You also added doc-strings for some methods that apply just as much to the other
(gitlab) methods of the respective generic functions. I think you should remove those
and instead maintain a list of "generic functions that now have at least two methods and
which should therefore be explicitly defined eventually, at which point we can also
add the doc-string". wink

Lets figure that out when we are closer to merging this.

@snogge
Copy link
Contributor Author

snogge commented Oct 5, 2019

Now that I have looked at the code I can say that this generally looks reasonable. Since this mostly based on the Gitlab code that I have written, it's not surprising that I would come to that conclusion. ;-)

You are generally on the right track. If you were waiting for that statement before tackling the remaining big gaps, then you can continue working on this now. If you were hoping I would merge this despite it being rather incomplete, then I have to disappoint you. This should be about on par with Gitlab. So I suggest you use this yourself and fix bugs and implement missing features as you go. And then ping me when it is complete or if you are running into issues.

I do have one question that popped up when I began looking at adding pullrequest support.
Bitbucket numbers pullrequests and issues independently, so there will be a pullrequest #N and an issue #N. I noticed that gitlab uses ! to indicate pullrequests, is that for the same reason? Does gitlab do that in their own UI as well? Bitbucket's markdown uses #N for issues and Pull request N
for pullrequests. Is there somewhere to customize that for automatic links in forge?

@tarsius
Copy link
Member

tarsius commented Oct 5, 2019

noticed that gitlab uses ! to indicate pullrequests, is that for the same reason? Does gitlab do that in their own UI as well?

Yes and yes.

Is there somewhere to customize that for automatic links in forge?

What that? Grepping for ! should reveal the places that have to be adjusted for bitbucket.

snogge added 9 commits October 6, 2019 23:16
ISO8601 states that you can have any number of decimal places, but
iso8601.el only handles three in Emacs 27.  Use
`forge--bitbucket-hack-iso8601' to remove excess digits from
timestamps in bitbucket JSON responses.
Add a `forge--pull' implementation for `forge-bitbucket-repository',
and corresponding helper functions `forge--fetch-repository' and
`forge--update-repository'.

Most of the implementation is copied from forge-gitlab.el.
The bitbucket API does not seem to have any way to list users, so
instead extract all users from all issue and add them to the assignees
database.
snogge added 4 commits October 6, 2019 23:16
It would be better to handle this by customizing the issue view for
bitbucket, but as far as I can tell that is not possible right now.
Setting the assignee requires a more complicated json structure.
Refactor `forge--set-topic-field' to support that.
@tarsius
Copy link
Member

tarsius commented Dec 11, 2019

So, how did it go?

@snogge
Copy link
Contributor Author

snogge commented Dec 15, 2019

I started working on the pull request, but I haven't had that much time to devote to this project recently.

@tarsius
Copy link
Member

tarsius commented Dec 17, 2019

Take your time. I am not in a hurry and wouldn't be able to review before next year anyway. Just wondering.

@tarsius tarsius force-pushed the master branch 2 times, most recently from 10fcab8 to 8beace1 Compare June 14, 2020 13:55
@tarsius
Copy link
Member

tarsius commented Oct 2, 2020

@snogge I would like to either merge or else close this soon. Please let me know what your plans are.

I just rebased and there were no conflicts. There's one compile warning:

forge-bitbucket.el:334:1: Warning: Unused lexical variable ‘user’

@tarsius
Copy link
Member

tarsius commented Oct 19, 2020

We can of course reopen when/if you start working on this again.

@tarsius tarsius closed this Oct 19, 2020
@snogge
Copy link
Contributor Author

snogge commented Oct 23, 2020

Yeah, I don't see this happening soon. I've spent my emacs dev time on buttercup instead.
One option would be to get this to a state where you would be comfortable merging it without the pull request support, just so someone else could potentially keep going.
Maybe merge the buck changes so that the next guy wont have to go through that,

@tarsius
Copy link
Member

tarsius commented Oct 24, 2020

If someone else asks about bitbucket support I will point them to your work.

I don't want to merge this without pull-request support because I would then end up having to implement that myself because it would be such a reasonable thing to request once issues and other stuff are supported. I also want to work on other things.

@tarsius
Copy link
Member

tarsius commented Jan 5, 2021

I have added a faq entry about the forges I plan or don't plan to support. Because I do not plan to implement support for this particular forge I am closing this issue. That doesn't mean that you cannot comment here or shouldn't discourage you from contributing support for favorite forge yourself.

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.

2 participants