Commit Diff


commit - ae1630c43b66d73e5927dbf3a49babe676bc519f
commit + 3b9e9950f092720aceb7785054993f03cd597db9
blob - 8706010e3ce8fee727f9da2677bea9885fdafd49
blob + f0a9d57b091e6279c22a6f91942caa5d271bd612
--- README
+++ README
@@ -5,6 +5,7 @@ To install, run install.sh.
 The following commands are provided:
 
 - backlight - set backlight brightness
+- bbpr - create a Bitbucket pull request
 - bbsnip - create a snippet on BitBucket
 - hits - count web traffic
 - hlsget - download the contents of a HLS playlist
blob - 40b05ab1da3fbd3c338173550dc1ae584a3a5ff7
blob + 74ee509feea8a653ca8e274b946de54a33fc3c4a
--- bin/bbpr
+++ bin/bbpr
@@ -16,6 +16,9 @@ dest=main
 if git branch --list master | grep master > /dev/null
 then
 	dest=master
+elif test -n $1
+then
+	dest=$1
 fi
 
 cover=`mktemp`
@@ -23,12 +26,10 @@ git log $dest.. | grep -v '^commit' > $cover
 
 if test -n $EDITOR
 then
-	EDITOR=vi
+	EDITOR=ed
 fi
 $EDITOR $cover
-
 title=`sed -n 1p $cover`
-
 description=`awk 'NR > 2 { print }' $cover`
 rm $cover
 
blob - /dev/null
blob + bd1ceeba91c9e234e95fbaf68831ff566e5e7be6 (mode 644)
--- /dev/null
+++ man/bbpr.1
@@ -0,0 +1,60 @@
+.Dd
+.Dt BBPR 1
+.Sh NAME
+.Nm bbpr
+.Nd create a Bitbucket pull request
+.Sh SYNOPSIS
+.Nm
+.Op Ar branch
+.Sh DESCRIPTION
+.Nm
+creates a Bitbucket pull request to merge the currently checked-out branch
+with the named
+.Ar branch
+of the remote
+.Ar origin .
+If no destination
+.Ar branch
+is specified,
+.Ar main ,
+then
+.Ar master
+are tried.
+A URL pointing to the pull request is created on success.
+.Pp
+.Nm
+prompts for a pull request
+.Dq cover letter ,
+similar to
+.Xr git-commit 1 ,
+by reading the
+.Ev EDITOR
+environment variable;
+otherwise
+.Xr ed 1 .
+The first line is the pull request's title.
+The second line is ignored and should be empty.
+The rest becomes the description.
+.Sh FILES
+.Bl -tag -width Ds
+.It Pa $HOME/.config/atlassian/bitbucket.org
+Configuration file containing a Bitbucket API token.
+.El
+.Sh EXIT STATUS
+.Ex
+.Sh EXAMPLES
+Create a pull request to merge test_refactor into main:
+.Bd -literal -offset indent
+git switch test_refactor
+bbpr
+.Ed
+.Pp
+Create a pull request to merge typo into test_refactor:
+.Bd -literal -offset indent
+git switch typo
+bbpr test_refactor
+.Ed
+.Sh SEE ALSO
+.Xr curl 1 ,
+.Xr jq 1 ,
+.Lk https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests Bitbucket pull requests API reference