diff --git a/bitfuckit/integrations/README.adoc b/bitfuckit/integrations/README.adoc index f3759815..f6e2b8d5 100644 --- a/bitfuckit/integrations/README.adoc +++ b/bitfuckit/integrations/README.adoc @@ -35,15 +35,18 @@ regedit /s integrations/tortoisegit/bitfuckit-context-menu.reg === git-cola -git-cola supports custom actions in its config. +git-cola reads `guitool.*` entries from git config and lists them in its +Actions menu (no plugin code required). *Install integration:* [source,bash] ---- -mkdir -p ~/.config/git-cola -cp integrations/git-cola/actions.py ~/.config/git-cola/ +git config --global include.path "$(pwd)/integrations/git-cola/guitool.config" ---- +Or copy the `[guitool "..."]` sections from `integrations/git-cola/guitool.config` +into `~/.gitconfig`. + === Gittyup Gittyup can be extended with custom plugins. diff --git a/bitfuckit/integrations/git-cola/actions.py b/bitfuckit/integrations/git-cola/actions.py deleted file mode 100644 index 02522a27..00000000 --- a/bitfuckit/integrations/git-cola/actions.py +++ /dev/null @@ -1,105 +0,0 @@ -# SPDX-License-Identifier: PMPL-1.0 -""" -git-cola custom actions for bitfuckit integration - -Installation: - mkdir -p ~/.config/git-cola/actions - cp actions.py ~/.config/git-cola/actions/bitfuckit.py - -Or add to your existing git-cola actions config. -""" - -from cola import cmds -from cola.i18n import N_ -import subprocess - - -class BitbucketCreatePR(cmds.Command): - """Create a Bitbucket pull request for current branch.""" - - @staticmethod - def name(): - return N_('Bitbucket: Create PR') - - def do(self): - branch = cmds.Interaction.current_branch() - subprocess.run(['bitfuckit', 'pr', 'create', '--branch', branch]) - - -class BitbucketListPRs(cmds.Command): - """List Bitbucket pull requests.""" - - @staticmethod - def name(): - return N_('Bitbucket: List PRs') - - def do(self): - result = subprocess.run( - ['bitfuckit', 'pr', 'list'], - capture_output=True, - text=True - ) - cmds.Interaction.information( - N_('Bitbucket Pull Requests'), - result.stdout - ) - - -class BitbucketMirror(cmds.Command): - """Mirror repository to Bitbucket.""" - - @staticmethod - def name(): - return N_('Bitbucket: Mirror Repository') - - def do(self): - repo_name = cmds.Interaction.current_repository_name() - subprocess.run(['bitfuckit', 'mirror', repo_name]) - - -class BitbucketPipelineStatus(cmds.Command): - """Check Bitbucket pipeline status.""" - - @staticmethod - def name(): - return N_('Bitbucket: Pipeline Status') - - def do(self): - result = subprocess.run( - ['bitfuckit', 'pipeline', 'status'], - capture_output=True, - text=True - ) - cmds.Interaction.information( - N_('Bitbucket Pipeline'), - result.stdout - ) - - -class BitbucketAuthStatus(cmds.Command): - """Show Bitbucket authentication status.""" - - @staticmethod - def name(): - return N_('Bitbucket: Auth Status') - - def do(self): - result = subprocess.run( - ['bitfuckit', 'auth', 'status'], - capture_output=True, - text=True - ) - cmds.Interaction.information( - N_('Bitbucket Authentication'), - result.stdout - ) - - -# Register actions -ACTIONS = [ - BitbucketCreatePR, - BitbucketListPRs, - BitbucketMirror, - BitbucketPipelineStatus, - BitbucketAuthStatus, -] diff --git a/bitfuckit/integrations/git-cola/guitool.config b/bitfuckit/integrations/git-cola/guitool.config new file mode 100644 index 00000000..da002550 --- /dev/null +++ b/bitfuckit/integrations/git-cola/guitool.config @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: MPL-2.0-or-later +# git-cola custom actions for bitfuckit integration +# +# git-cola reads `guitool.*` entries from git config and shows them in its +# Actions menu (no Python plugin required). Names use `Bitbucket/` +# so they appear under a single "Bitbucket" submenu. +# +# Install (one of): +# git config --global include.path "$(pwd)/integrations/git-cola/guitool.config" +# or copy these sections into ~/.gitconfig (or a repo's .git/config). + +[guitool "Bitbucket/Create PR"] + cmd = bitfuckit pr create --branch $(git rev-parse --abbrev-ref HEAD) + noconsole = false + norescan = true + +[guitool "Bitbucket/List PRs"] + cmd = bitfuckit pr list + noconsole = false + norescan = true + +[guitool "Bitbucket/Mirror Repository"] + cmd = bitfuckit mirror $(basename $(git rev-parse --show-toplevel)) + confirm = true + noconsole = false + norescan = true + +[guitool "Bitbucket/Pipeline Status"] + cmd = bitfuckit pipeline status + noconsole = false + norescan = true + +[guitool "Bitbucket/Auth Status"] + cmd = bitfuckit auth status + noconsole = false + norescan = true