How can I search commit message in BitBucket - bitbucket

How can I search the commit message in BitBucket? I can only search the codes but that doesn't help me. I want to find the keyword HDMI in the commit title for example.

There is a search box for commits on the Bitbucket webpage, under Commits.

If you are using source tree its easy :-)
In the new versions:

If you also have the project locally, you can also search for the log via the console. Don't forget to do a git pull first, to be on the same level as remote.
git log --oneline | grep PATTERN

To search specifically on the commits message you can use the aforementioned search box of the BitBucket page and use the operator 'keyword(string)' or 'grep(regex)'

Related

Is there a way to get gerrit to reject commits without a JiRA ticket number?

How does an admin configure Gerrit to automatically reject commits without JiRA ticket number? I've read this documentation but not sure how to implement it on all branches in a specific repository (not all repos!). Do all users need to download the file and copy it to their local repository or how does it work? What I want to achieve is that git/gerrit automatically rejects a commit that are missing a JiRA ticket number - doesn't have to be valid, it's up to the team to control that the ticket number is valid.
The Jira plugin is based in the ITS plugin. These plugins have a association configuration that can be set to MANDATORY.
MANDATORY : One or more issue-ids are required in the git commit message, otherwise the git push will be rejected.
SUGGESTED : Whenever git commit message does not contain one or more issue-ids, a warning message is displayed as a suggestion on the client.
OPTIONAL : Issues-ids are liked when found on git commit message, no warning are displayed otherwise.
The below config example is taken from the Jira plugin documentation.
[commentLink "Jira"]
match = (\\[[A-Z][A-Z]+-[1-9][0-9]*\\])
html = "$1"
association = MANDATORY
The Git::Hooks is the best solution to this job.
See how to install and configure it here.
See more info about it here.

On Bitbucket, how can I click on a source file and be directed to the URL of the current version of the file instead of a commit version of the file?

When I click on a source file on the Bitbucket web interface, I am directed to a URL something like the following:
https://bitbucket.org/team/someproject/src/ab59759347f7298e875t9c5764d3228d7124aee8/someproject/api.py?at=master&fileviewer=file-view-default
I need to be directed to something like the following instead:
https://bitbucket.org/team/someproject/src/master/someproject/api.py?at=master&fileviewer=file-view-default
How can I change Bitbucket settings to accomplish this?
You've already done it in your example. The commit hash will always take you to a specific revision, but if you replace that with the branch name then it will take you to the head or tip of that branch.

Jenkins trigger build on specific commit message of branch

I did a little search and googling for this issue, but most of the posts are related on how to isolate (by using git plugin etc.)
What I'm wondering is there a way to configure a jenkins job to trigger a build on specific commit message (let's say if it contains "build") on the branch I specified.
Thanks in advance,
You can use Commit Message Trigger Plugin to achieve this.
Once you install this plugin, go to your job configuration page and under Build Environment section check Enable Commit Message Trigger,then add the keyword that will cause the job to trigger.
The answers by #ANIL is totally correct just a few improvement to make thinks clear.
if you put the keyword as admin as shown in image then in your commit message you must
have "ci admin" included and it works. It didn't work without adding ci ahead of keywords in my commit message for me.
We don't have to add ci in keywords in the build environment setting.

How to upload an image to use in issue comments via Github API

I'm currently working with Github API to make an iOS github client app.
I'd like to implement the feature of creating issues with images. My question is how to upload an image for issue comments via API. We're able to upload the image by drag-and-drop via browser in github.com like image below:
I'd like to use this https://cloud.githubusercontent.com/assets/~~~.PNG.
Any way to upload to https://cloud.githubusercontent.com via API or something?
By the Feb 2020 there are still no official solution to upload files via API to be used in the github issues.
Simple solution is to use a repository branch (you can name it assets). You can link to them from the github issues easily, just use raw link with last commit SHA:
https://github.com/ORG/REPO/raw/LAST_SHA/PATH
This kind of link will be rendered in the issues body always correctly.
Ever I also try to find one way to make it.But there is not any available method to do it. I'm doing some extra test to find that you can observe the drag-and-drop action in your devtool-network panel.
I find that https://github.com/upload/assets/21842410 be requested with PUT method, and its response is {"id":21842410,"name":"-2.png","size":1261,"content_type":"image/png","href":"https://cloud.githubusercontent.com/assets/3518853/21842410/7c3f6812-d79b-11e6-8209-e49b44aaa883.png","original_name":null}
I've not finished my test, if this inspires you and you have time to implement any demo, please tell me your result. :)
A solution I'm using is to push the images to the repository instead, and use a relative link in the issue.
You can create an orphan branch just for images and push it to a ref outside of refs/heads, this way this ref is not cloned in a normal clone (you would need git clone --mirror).
It would look something like this (proof-of-concept):
git checkout --orphan images
git rm -rf *
# copy your images to the repo
git add <your images>
git commit -m "add images"
git push origin HEAD:refs/images/image-ref
git log --format=%H
# note the hash
and then in the issue, use a relative link using the commit hash from above:
![alt text](../blob/<HASH HERE>/path/to/your/image.png?raw=true)
It can't be done. Your only chance is to upload your image to your own s3 bucket or similar and link that in the comment/issue. I think github will pick up those and cache them for better user experienceon github.com

link to other system issue number in gerrit code review page based on commit message

I used to write commit message to connect issue system like issue #9548, redmine start page is fixed, and wonder whether it can be written in hook or plugin in gerrit system.
So in the code review page, the issue #9548 can be automatically show the http link to my issues system (like redmine): => issue#9548,redmine start page is fixed
It will be easily for code review.
Yes, it is possible. In your Gerrit configuration, you have to provide a regex expression for the string in the commit message and the link to your bugtracker with wildcards. See the Gerrit documentation. For your example, you would have a regex like (issue\s+#?)(\d+)
If you use Jira and have your Jira case number first in the commit message, add the following to gerrit.config to get links when viewing change sets:
[commentlink "jira"]
match = "^([A-Z]*-[0-9]*)"
link = http://jira/browse/$1
Some supported commit message formats (paste into Rubular to test):
PRJ-123: This is my commit message
ABC-123 - Something: Yes yes
PROJ-123
ABCD-123 - Message
For more examples, see the Gerrit documentation on Section commentlink
Yes you can turn the issue tag into a link in Gerrit. Look at the commentlink configuration - http://gerrit-documentation.googlecode.com/svn/Documentation/2.2.0/config-gerrit.html#_a_id_commentlink_a_section_commentlink

Resources