How to Export Commit and Pull Request Data from Bitbucket to CSV

June 18, 2024
#How To#Bitbucket#Reporting
13 min

Being a universal file type, CSV serves as a go-to format for integrations between the applications. It allows for transferring a large amount of data across the systems, blending it, and building custom reports. To export commit and pull request data from Bitbucket Data Center to a CSV file, you can use the Awesome Graphs for Bitbucket app.

In this article, we’ll show you two ways how to use the app to export engineering data to CSV for further integration, organization, and processing in analytics tools and custom solutions.

What commit and pull request data you will get

The methods described later in the article will give you two kinds of generated CSV files, depending on whether you export data about commits or PRs.

In the case of commit data, you’ll get a list of commits with the following details:

  • creation date
  • author’s email, name, and username
  • repository and project name
  • commit hash
  • whether it is a merge commit or not
  • number of lines of code added and deleted

commits export

The resulting CSV with a list of pull requests will contain the following information:

  • pull request creation and last updated date 
  • author’s name and username
  • repository and project name
  • PR state and its ID
  • reviewers’ names and usernames
  • PR cycle time and its phases: time to open, pickup time, review time, time to resolve

pull request (PR) export

Exporting from the People page

You can export raw commit and pull request data to CSV directly from Bitbucket. When you click All users in the People dropdown menu at the header, you’ll get to the People page with a global overview of developers’ activity based on the number of commits or pull requests.

At the top-right corner, you’ll notice the Export menu, where you can choose CSV.

Export Commit and Pull Request Data from Bitbucket

By default, the page shows developers’ contributions made within a month, but you can choose a longer period up to a quarter. The filtering applies not only to the GUI but also to the data exported, so if you don’t change the timespan, you’ll get a list of commits or pull requests for the last 30 days.

Exporting via the REST API resources

Awesome Graphs REST API allows you to retrieve and export commit and pull request data to a CSV file on global, project, repository, and user levels. This functionality is aimed to automate the processes you used to handle manually and streamline the existing workflows.

To find the REST API resources, you can go to the in-app documentation by choosing Export → REST API on the People page (accessible to Awesome Graphs’ users), or to our documentation website.

In the article, we’ll show you two examples of the resources and how they work: one for exporting commits and another for pull requests. The rest of the resources follow the same model, so you can apply these principles to get the data you need.

Export commits to CSV

This resource exports a list of commits with their details from all Bitbucket projects and repositories to a CSV file.

Here is the curl request example:

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits/export/csv"

Alternatively, you can use any REST API client like Postman or put the URL directly into your browser’s address bar (you need to be authenticated in Bitbucket in this browser), and you’ll get a generated CSV file.

By default, it exports the data for the last 30 days. However, you can set a timeframe for exported data up to one year (366 days) with sinceDate / untilDate parameters:

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits/export/csv?sinceDate=2024-05-01&untilDate=2024-05-15"

For commit resources, you can also use the query parameters such as merges to filter merge/non-merge commits or order to specify the order to return commits in.

You can read more about this resource and its parameters in our documentation, as well as find other resources for exporting commit data on project, repository, and user levels.

Export pull requests to CSV

The pull request resources work similarly, so to export a list of pull requests with their details from all Bitbucket projects and repositories to a CSV file, you need to make the following curl request:

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/pull-requests/export/csv"

The sinceDate / untilDate parameters can also be applied to state the timespan up to a year, but here you have an additional parameter dateType, allowing you to choose either the creation date or the date of the last update as a filtering criterion. So, if you set dateType to created, only the pull requests created during the stated period will be returned, while dateType set to updated will include the pull requests that were updated within the time frame.

Another pull request specific parameter is state, which allows you to filter the response to only include openmerged, or declined pull requests.

For example, the following request will return a list of open pull requests, which were updated between May 1st and May 15th:

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits/export/csv?dateType=updated&state=open&sinceDate=2024-05-01&untilDate=2024-05-15"

Refer to our documentation for more details about this resource and its parameters. Additionally, you can find information on other resources for exporting pull request data at the project, repository, and user levels.

Integrate intelligently

While CSV is supported by many systems and is quite comfortable to manage, it is not the only way for software integrations the Awesome Graphs for Bitbucket app offers. Using the REST API, you can make data flow between the applications, automate the workflow, and get custom reports tailored to your needs.

For Awesome Graphs Data Center clients, we offer a Premium Support subscription aimed at enhancing efficiency and saving time while working with our app and its REST API resources. It includes personalized assistance from our experts who will create scripts in Python, Bash, Java, or Kotlin to interact with our REST APIs and build reports tailored to your specific requirements. By using these advanced capabilities, our clients optimize their workflows, gain deeper insights into their engineering activities, and drive informed decision-making.

Related posts

Analyze How Code Review is Going in Bitbucket Data Center

September 27, 2021
#Analytics#How To#Bitbucket
9 min

Awesome Graphs is one of our most popular apps. It’s a solution that extends Bitbucket, a platform that teams use to host Git repositories and collaborate on code.

Awesome Graphs helps engineering leaders and software teams improve their own processes and deliver products faster by transforming invisible development activities into easy-to-understand insights and reports.

One of the keys focuses of the app is the code review processes analytics. We would like to tell you which features support this use case and how you can benefit from the app. Keep reading if you are interested in:

  • Seeing how actively your team members review code
  • Analyzing what developers may need to improve their work patterns and who’s doing a great job
  • Learning what reviewers are most active and diligent
  • Knowing the average time taken to resolve pull requests.

Code review analysis

code review analysis in bitbucket

The Contributions Report analyzes activity in pull requests (tasks, comments, needs work/approved/declined statuses). It helps you understand:

  • What developers create high-quality code and who might need to improve their approach to work. E.g. when an engineer has fewer taskscomments, and needs work flags in their pull requests, it suggests his work is approved as it is or with minor changes and he creates code of high quality.
  • What reviewers are thorough when they review the work of developers. E.g. diligent reviewers come up with suggestions and improvements, so they have more tasks and comments than others.
  • How the dynamics of code review changes over time. E.g. you can see if the number of pull requests with Needs work flags is getting bigger or smaller if the number of tasks in pull requests is increasing or decreasing over time.

Learn more

The average time taken to resolve pull requests

pull requests resolution time report in bitbucket

Another report, Resolution Time Report, shows the average time taken to resolve pull requests. This is helpful to capture trends in resolution time. It displays resolution times of merged and declined pull requests separately. With this report you can:

  • Notice spikes in resolution time and then dive in to see what went wrong
  • See if an average resolution time is high for a long period of time – it can be a signal to look into your code review process and determine what causes delays
  • Monitor how changes in your processes affect the speed of code review.

Learn more

Knowledge sharing indicators

reviewers of pull requests report in bitbucket

The Pie Chart Report is a handy way to check if all developers in your team are involved in the code review. This report shows the breakdown of pull requests by different statistics types.

Grouped by reviewer, the Pie Chart Report shows the following:

  • How many pull requests each person reviewed. These metrics help understand how much everyone contributes to the project.
  • Whether all people review code or there are one or two who are doing all job. This is an indicator of poor knowledge sharing.
  • Who is too busy reviewing all pull requests of their team. These people can become a bottleneck that slows the delivery time, because they’re not available for immediate review.

Learn more

Pull requests with a too long or too short resolution time

pull requests resolution time report in bitbucket

The Resolution Time Distribution Report visualizes pull requests grouped by the time taken to merge or decline them and gives an idea of the most frequent resolution times on your project. Using this report. you can easily:

  • find pull requests with the longest resolution time to check the reasons for the delay
  • see pull requests with the shortest time to resolve them to investigate whether they were checked as appropriate
  • predict the resolution time for the future pull requests.

Learn more

Exporting pull requests for the future processing

With Awesome Graphs, the historical data can be exported to a CSV file right on the People page.

exporting pull requests from bitbucket

As a result of the exporting, you receive the CSV file with the list of pull requests (alternatively, the list of commits) with their details about the author, reviewers, state, the date they were created and last updated. The files can be processed in Excel or integrated with analytics tools like Tableau, Power BI, etc. to create custom graphs and dashboards and merge with the data from other apps.

Learn more

What other reports do you need?

Awesome Graphs already has a wide range of graphs and reports that help you answer various questions about project development and the work of your team in Bitbucket. We are open to your feedback and appreciate hearing about what you need. So if you have a problem that you think Awesome Graphs can help you with, contact us – we actually listen.

Try Awesome Graphs for free

 

Announcing New Stiltsoft Partner Program

March 22, 2021
#News
2 min

At Stiltsoft, we recognize how important both our partners and customers are, so we decided to launch our new Partner Program that will affect only the Awesome Graphs for Bitbucket app.

We are building a new Partner Program to provide you with comprehensive training materials and resources, free app licenses, promo codes, and more. If you apply, you save time and effort of your sales team with the help of our training course and demos on demand.

We want to inform you that Awesome Graphs for Bitbucket has Standard Atlassian Partner Discount until March 21st, 2021. From March 22nd, a 20% discount will only be available for Stiltsoft Partners.

Other Stiltsoft apps participate in the Standard Discount scheme for Atlassian Marketplace Products.

To get a 20% discount, you will need to become our partner. Moreover, you will get other partnership perks:

  • Free licenses
  • Demo on demand
  • Promo codes
  • Enablement materials
  • App training
  • Co-marketing activities

To join, simply drop an email at partner@stiltsoft.com, and we will get you set up as soon as possible. For more details, please visit our website.

We look forward to continued collaboration!

Related posts

    Case Study: How a FinTech Company Improves Code Review Process

    June 30, 2020
    #Bitbucket#Case Study
    7 min

    We’ve got pretty good with our Pull Request and Code Review process, but initially, our PRs were complex, not very well documented, and difficult to read. The Resolution Time Distribution graph shows how better we are getting at this, being able to merge PRs much quicker than before.

    Pablo Reyes, VP Engineering at Strands

    Strands is one of our customers that has been using Awesome Graphs for Bitbucket for a couple of years so far. Since 2004, Strands has been developing highly customizable digital money management software for top-tier financial institutions worldwide. Our team is happy to help them reach their goals and improve their development processes with the statistics visualizations we provide.

    Pablo Reyes, VP of Engineering at Strands, shared best practices on how their team effectively uses our solution to:

    • identify bottlenecks in code review
    • track the process improvement with the implemented changes
    • increase developers’ motivation by keeping an eye on their performance trends.

    Code review process improvement

    In fact, they’ve got pretty good with their Code Review process so far. But initially, the PRs were complex, poorly documented, and difficult to read. The Resolution Time Distribution report shows how better they are getting at this, merging PRs much quicker than before. code review process improvement in Bitbucket

    Since they do a lot of code reviews at Strands, it’s always nice to see who and what teams are making the best use of it. It’s motivating for the team to see the progress, and the Pull Requests reports give them the perfect overview of these advancements.

    A couple of years ago, they started improving their code review process. For example, they introduced the practice of approving PRs by at least three people. Moreover, they encouraged developers to leave many comments and suggestions and only approve a PR once it’s good enough.

    As a result, PRs are resolved faster, not only because they are done better but also because the quality of suggested improvements rises constantly. The Contributions report gives an overview of code review activity and whether it improves or not.

    contributions report in Bitbucket

    Software development tracking

    At Strands, managers don’t use Awesome Graphs to control the number of commits per developer. Still, they find it useful to look at the dynamics of the overall activity to capture the code development trends. For example, if there’s a significant drop, the developer is probably stuck at difficult tasks or disturbed by various activities, helping other teams or communicating with customers.

    Most things are caught soon in the day-to-day communication and work, but mid-term changes in the trend (either a decrease or increase) give them a hint of something they may need to look at. This has been visible when people change projects or teams.

    The developer’s Contributions graph gives a clear view of this kind of drops and rises, and it’s handy to compare two periods before and after certain changes were implemented.

    developer contributions in Bitbucket

    Any emerging trend serves as a valuable point for discussion, enabling the team to identify potential bottlenecks or areas that can be enhanced within their software development process. Developers’ performance is complex and depends on lots of different things, some quantitative and some qualitative. Still, the aggregation of code contributions (comments, pull requests, tasks solved, commits, etc) gives some good indicators of how a team evolves with time.

    Along with the others, the Contributors graph provides insights into the dynamics of code contributions by different teams and helps with software development tracking.

    software development tracking

    Try the best teams’ practices for your company

    Awesome Graphs for Bitbucket has become a helpful tool for Strands to identify problem areas  in their processes and track whether the implemented changes improve them. Besides, it is a handy instrument for regular monitoring of software development.

    Try Awesome Graphs for Bitbucket for free and discover how it can benefit your workflow.

    Read more case studies to see how our customers benefit from using Awesome Graphs for Bitbucket in their work:

    Related posts

      Introducing New Feature: Graphs for Teams in Awesome Graphs

      December 3, 2019
      #Reporting#Analytics#News#Bitbucket
      7 min

      There is no doubt that effective working and communication processes in a team greatly influence the overall success of a product or company. Atlassian products like Bitbucket, Jira, and Confluence aim to improve collaboration and bring distributed colleagues together.

      Awesome Graphs for Bitbucket app is our contribution to the teamwork of more than 2,000 companies, as its primary goal is to help identify the bottlenecks in the development workflow and increase the speed. We are eager to make the processes transparent for both developers and managers and, thereby, improve the communication and narrow the gap between them.

      We’ve discovered that lots of our clients use similar workflows: they have multiple teams working on the same project or repository. Therefore, tracking the productivity of a particular group that a project or delivery manager, or team lead manages can be tricky as the app showed graphs for all the activity across a project or repository that included the statistics about all the teams together. That’s why we decided to implement a feature that can make their lives easier: graphs for teams.

      View the statistics for your team

      Teams feature is designed to visualize the statistics about your team performance if there’s a lot of people working on a project or repository. It excludes the contributions of the members of other teams and helps get rid of noisy data.

      Configure your teams in the settings and choose it in the All contributors drop-down menu on the Graphs page and analyze how much commits, pull requests, and lines of code a team produces apart from others.

      Compare the activity of different teams

      If you manage multiple teams working on the same project or repository, you may find it useful to separate their statistics from each other.  For example, compare their impact in a codebase of your repository using the Code Frequency graph. That’s what you can easily do with our new feature!

      Let’s say you manage two teams: back-end and front-end developers. Open a graph for each team in different tabs and compare their performance.

      From the screenshot below, you may identify that your back-end team is continuously deleting the lines of code. They are probably involved in some bug fixing or refactoring activities or implement changes in the API.

      Meanwhile, the front-end team has to rewrite some pieces of code to adjust the changes in the backend.

      Exclude automated users from the statistics

      If you use automation in your repositories, the graphs may show the information that is not related to the activity of your team. Lots of commits and lines of code added by CI/CD users and automated scripts may complicate the performance analysis since it’s not obvious which contributions are made by real people and which of them are not.

      Use teams feature to solve this problem by creating a team with all the people you need except for the automated users.

      Teams management

      A team can be made on the global, project, and repository level by the user with administrative permissions on this level. A team can include whole Bitbucket groups or individual users.

      It’s possible to create a global team in the Teams tab in the Administration page and view graphs for it in all projects and repositories.

      There’s no need to disturb your Sys Admins from their work to create a team. If you’re a project or repository admin, you may do it in the Teams tab in the settings. In this case, your teams’ graphs will be available only in your repository or project and higher.

      Improve your teams’ activity tracking

      At the moment, graphs for teams are available only for the Graphs page, but we’ll add this feature to the People page and Reports soon in the next releases.

      Try a new version of Awesome Graphs for Bitbucket to get even more useful insights on your team productivity and compare the activities of different teams!

      We are delighted to implement the team feature that our customers were asking for, and we hope to make their working process a bit easier and better! So, we appreciate any feedback on the app and suggestions that could help you get the most benefit from Awesome Graphs. If you have any, please, feel free to write to us here as we’re looking forward to learning about your needs!

      Related posts

        New App Release: Submodule Changes for Bitbucket

        September 17, 2019
        #News#Bitbucket
        4 min

        We have recently released a new app – Submodule Changes for Bitbucket. This free app is created to improve the experience with the Git submodule workflow. No more unreadable pull requests with changes to submodules and skipping the code review process!

        Dealing with submodules can be annoying

        Our company develops Awesome Graphs for Bitbucket – the app that provides the statistics for projects and repositories and helps to analyze and evaluate development team performance, code review practices and personal activity of each team member. Awesome Graphs for Bitbucket is very popular and has more than 2600 installs on the Marketplace at the moment. It’s available for Bitbucket Server, Data Center and Cloud. We use Git submodules that contain features which are similar for all the versions in order to achieve the fastest delivery.

        If you use it in your projects too, you may face the situations when the commits made to a submodule are shown as two hashes in the Diff tab instead of displaying the lines of code, folders, and files that have actually been modified.

        It creates the greatest difficulty to the reviewers of pull requests since there’s no chance to review changes and leave comments on the commits of the submodule repository.

        Review Pull Requests Easily

        If you don’t want to skip such an important part of the development process as the code review, you can try the solution we created: Submodule Changes for Bitbucket. At first, this app came as software that we were using internally, but then we discovered that lots of other developers face similar issues.

        Submodule Changes for Bitbucket replaces two commit hashes with the files modified in a commit or pull request. It highlights the changes with a submodule update in the Diff tab as if all of them were made to a parental repository.

        The app also gives you the possibility to watch the Blame view, leave comments and suggest improvements in pull requests. It makes the process similar to reviewing changes in the original repository.

        Submodule Changes for Bitbucket is a completely free app that can simplify the code review process for the teams that use Git submodules for their projects.

        Try it and see how it fits your workflow!

        Related posts