provide an easy way to check if MR already exists for the current branch
sding3 opened this issue · 0 comments
sding3 commented
There doesn't appear to be an easy to check if there already an MR associated with the current branch.
This is currently how I'm doing it, which is a bit cumbersome.
function labmrexists() {(
set +e
output="$(lab mr show --no-pager 2>&1)"
if [[ $? -eq 0 ]]; then
echo yes # exists
return 0
fi
if [[ $output == *"cannot determine MR id"* ]]; then
echo no # does not exist
return 0
fi
echo $output # not sure
return 1
)}
It would be helpful if lab mr show
can use different exit codes when there is no MR v.s. when it failed to perform the check due to some errors.
Additionally, it would be great if there is a command for me to get at the MR URL, e.g. lab mr show --format '{{.mr.url}}'
or something like that.