-
Notifications
You must be signed in to change notification settings - Fork 27
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
New branch creation causes the plugin to iterate over all changesets #1
Comments
I will look into this the next days. |
This seems to also happen when new tags are pushed to the server |
Hey Christian, any news about this ? |
I was on vacation and just returned. I will first concentrate on making the plugin compatible with Bitbucket 4.x (#5). Shortly after that I will look into this improvement. In order to know on which version to concentrate first it would be good to know which versions of Bitbucket you are running and/or if you plan to update to Bitbucket in the near future, so please leave a comment with the version information for Bitbucket. |
We're currently on Stash v3.11.0, but we'll probably upgrade to BBServer soon. (in fact, I hadn't paid attention to news, and it's your message above that made me aware of the rebranding) |
I checked on the Bitbucket API, but I'm not sure yet how to implement this. |
IIRC in the case of new branches the "from" hash was
|
It seems that the bitbucket API has no way of running
If I understand this correctly. Some workaround to get only those commits that are really "new" to the object store would be required. |
Apparently, there is a way of filtering those commits which are new to the repository: https://answers.atlassian.com/questions/223143/how-to-get-only-new-changesets-in-pre-receive-hook-on-new-branch-push |
I've run into the same performance issue and updated the plugin to use diff-tree. Now on repo with >50k commits and >15k files the response is instant, whereas earlier I was getting timeouts. Those changes are available here #26. |
Thank you very much for the PR. |
I've found a limitation on using the diff-tree, it squashes the delta and omits files that were both added and removed in the range of commits. My case is to clean up a repository with 5 years of history from binary files and to protect it from further degradation. Unfortunately it takes just hours for people to pollute it with branches containing old history and it makes whole cleanup pointless. I was trying to modify the diff-tree call a bit unfortunately with no luck. Now I'm looking into using git-log ... But maybe there is some better way? |
Bitbucket Server 5.0 introduced a new ADDED_TO_REPOSITORY filter that can be used to filter and examine only new commits that will be added to the repository |
Thanks for sharing and looks very promising and exactly what is needed. I'm currently traveling but will look into when back.
|
Also hitting this bug. |
I have started to use the new Bitbucket API based on the changes done in #26, but I will need a few more days. |
@tarnowsc: You mentioned that you had some issues with the PR and that something is squashed. |
I think I was able to reproduce now the issue. Will check for alternatives. |
Hi @christiangalsterer to reproduce this just add a violating file and remove it in subsequent commit. If you check those two commits the squashed diff is fine, nevertheless the history contains a file that violates your rules. |
We are also having this issue. We are on bitbucket 4.14.2 |
If you have a fix/solution available for this problem this would be assume. I and some other contributors tried different approaches and they all had some other drawbacks. Before opening a PR can you share some code or link to your plugin to have a look how you solved it just to make sure that you don't spend time in creating a PR and it is maybe a approach we have already tried. Of course if you have a PR already available and/or is easy to create you can also create a PR. Thanks in advance. |
It seems that this is popular, so I have made my own updates to the plugin myself as well :-) My attempt however was different than presented here before; instead of rewriting everything and going into diff-tree call (which AFAIK will always produce delta before first and last commit, thus skipping all changes introduced in the meantime - "the squash rebase issue") I have reworked your original approach by reducing number of git operations required for different steps. I am working on requesting a PR for the change, but I have to deal with some company OSS contributions regulations first, so probably not before January. Let me just share my results: I have tested scenarios with file size hook with two different patterns set:
Hope to get the code introduced into official release next year :-) |
Reading the performance improvements, it seems you did a marvellous job and I'm really looking forward for the PR 👍 |
Sorry, went on vacation and forgot about this. Here's a snippet we use to use rev-list to see what changes are actually new.
|
Sorry, not sure why the first function isn't part of the code block |
Hi, thanks for the example. Will hopefully have some time in the next days to look into it. |
Quick question I assume that the first and last commit from the result from getNewCommitsFromRefChange are the startCommit and endCommit parameter for getChangesFromCommits? |
I have submitted pull request mentioned in December, please review at your spare time. It also uses ScmService, but keeps using Bitbucket API instead of custom git diff calls. I believe this should be sufficient. |
A version 3.3.0 is now available in the Atlassian Marketplace for Bitbucket versions 5.2.x and newer. Thanks again to @raspy for his great contribution to fix this issue. |
@christiangalsterer is there still plan to release this fix for 4.x? |
We have a very large repo (over 100K changes, 10 years of history). If we enable the plugin, then pushing a new branch to the server basically causes the push to hang and eventually die, because it will check every commit since the beginning of time.
The above happens because Stash gives you a
from
hash of000000
and ato
hash of<sha>
, which will give you all changesets when you do the iteration.There's no good fix, but a good medium term fix will be to just add a limit to how many changes are requested for a new branch push (e.g. 100).
The text was updated successfully, but these errors were encountered: