Git Product home page Git Product logo

bpc's Introduction

bpc

bpc Bitbucket Python Client is simple python client for Bitbucket Server that uses REST API through Stashy library

Dependencies

bpc is Python 3 based. To install dependencies just launch:

  • pip install -r src/requirements.txt

Or install them manually

pip install stashy
pip install gitpython
pip install click

Note: it is take for granted that your default Python installation is Python 3 if not just explicitly run bpc with Python 3: python3 bpc

Usage

Server configuration

bpc needs configuration for at least one Bitbucket server; to add new server configuration invoke command

bpc config

and provide required details:

Non interactive way:

bpc config --server-base-url "https://www.example.com/mybitbucketinstance" --server-shortcut mybitbucketinstance --username myuser --token mytoken

The first server added to bpc will be used as default one; to change it invoke:

bpc config --set-default-server mybitbucketinstance

Note: default server is used only when querying for Bitbucket projects/repositories; the server configuration for managing Pull Request will be guess from local git repository

Pull Request

To manage Pull Requests bpc shall be invoked in folder containing a git repository

Creating PR

Invoke command:

bpc pr 

and provide required details:

  • ...
  • ...

Non interactive way:

bpc pr --title "PR title" --description "PR description"

Additional settings

  • A default target branch can be specified for each needed repository, invoke command:

     bpc pr --set-default-branch myBranch
    
  • Repository name can be added to PR title: it can be enable disabled:

     bpc config --pr-set-repo-title [true|false]
    
  • To enabled disable request for PR description, use the following command:

     bpc config --pr-set-empty-description [true|false]
    
  • To enable/disable fetch changes before opening PR, use the following command:

    bpc config --pr-set-auto-fetch [true|false]
    
  • To enable/disable pushing changes to remote server before opening PR, use the following command:

     bpc config --pr-set-auto-push [true|false]
    
  • To specify Pull Request custom reviewers (per project), use the command:

     bpc config --set-default-pr-reviewers=userA,userB --project=projectName --server=serverShortcut
    
    • Note: Bitbucket username are case sensitive

Listing PRs

To list all the PR pending for a repository, just invoke command:

bpc pr --list 

Listing projects and repositories

List all the projects in default Bitbucket server (projects that the current user has access to):

bpc remote 

Add flag --server to specify the server that will be queried

List all repositories on a specific Bitbucket project:

bpc remote --project  PROJECT_NAME

Select editor

bcp is using Click library to edit information, to change default editor in Linux you can edit file ~/.selected_editor

Advanced tips

  • Some command line options can be shortened when the resulting command is unambigous
  • At your own risk, you can dig in ~/.bpc/config.json to spot for features not yet officially released

bpc development

TODO

  • Pretty print servers list
  • Select editor from bpc
  • Clone repositories directly from bpc

Debug configurations

You can retrieve some debug configurations is .vscode/.launch.json

Dependency list generation

  • Install pipreqs
    • pip install pipreqs
  • just launch pipreqs to get requirements.txt list

Building executable

  1. Install pyinstaller pip install pyinstaller
  2. Launch comand pyinstaller.exe src/bpc.spec

Inspiration

lab for gitlab has given me the idea to implement this client, but is very far to have comparable features

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.