I think the script sounds good.  I'm torn on whether to tie it to releases
or just to let it run daily.  There is a chance somebody will accidentally
close a ticket before a merge, but I think that's probably pretty
unlikely.  In that case, they'd likely have their local branch to fall back
on anyway.  Maybe we could split the difference and still do a cron job,
but set it to run once a week as opposed to daily.

On Mon, Feb 8, 2016 at 8:12 PM, Daniel Kuppitz <m...@gremlin.guru> wrote:

> Nope, no worries, I just tried it out and it kept my local branches that I
> never pushed to the remote repository.
>
> On Tue, Feb 9, 2016 at 3:09 AM, Daniel Kuppitz <m...@gremlin.guru> wrote:
>
> > WARNING: I suspect this command will also remove local branches that you
> > haven't push yet.
> >
> > On Tue, Feb 9, 2016 at 3:07 AM, Daniel Kuppitz <m...@gremlin.guru> wrote:
> >
> >> Well, I cannot delete the branches on your local machine, but you can
> run
> >>
> >> git fetch -p
> >>
> >>
> >> to prune all stale references.
> >>
> >> Cheers,
> >> Daniel
> >>
> >>
> >> On Tue, Feb 9, 2016 at 2:21 AM, Marko Rodriguez <okramma...@gmail.com>
> >> wrote:
> >>
> >>> Hi guys,
> >>>
> >>> Does this also delete local branches? Do we still have to handle that
> >>> manually?
> >>>
> >>> Thanks,
> >>> Marko.
> >>>
> >>> http://markorodriguez.com
> >>>
> >>> On Feb 8, 2016, at 5:47 PM, Daniel Kuppitz <m...@gremlin.guru> wrote:
> >>>
> >>> > Actually it doesn't even have to be part of the release process, this
> >>> > script could also be triggered by a daily cron job. It just goes
> >>> through
> >>> > all the remote branches, find the respective Jira ticket and if the
> >>> ticket
> >>> > is closed, it will delete the branch. Thus the number of versions
> we're
> >>> > currently working on doesn't make a difference.
> >>> >
> >>> > Cheers,
> >>> > Daniel
> >>> >
> >>> >
> >>> > On Mon, Feb 8, 2016 at 10:21 PM, Stephen Mallette <
> >>> spmalle...@gmail.com>
> >>> > wrote:
> >>> >
> >>> >> I like the convenience of a script as we don't get the nice "delete
> >>> branch"
> >>> >> button in GitHub after we merge a PR (as we're on a mirror from
> >>> Apache - i
> >>> >> assume).
> >>> >>
> >>> >> Daniel, what happens when we have two versions going though? like
> for
> >>> >> 3.1.2-incubating and 3.2.0-incubating when we run the script on
> >>> release of
> >>> >> 1 it will blow out the branches for the other - it's not going to be
> >>> >> "release" specific.  I guess that's ok.......
> >>> >>
> >>> >> On Mon, Feb 8, 2016 at 2:30 PM, Daniel Kuppitz <m...@gremlin.guru>
> >>> wrote:
> >>> >>
> >>> >>> Hi devs,
> >>> >>>
> >>> >>> after the TP 3.1.1 release was managed by Stephen, we had to clean
> >>> up /
> >>> >>> delete a lot of branches that were no longer needed. We used to
> >>> delete
> >>> >>> branches as soon as we were done with the work on it, but at some
> >>> point
> >>> >>> Apache disabled the functionality to delete branches and so we
> ended
> >>> up
> >>> >>> with a lot of dead branches.
> >>> >>>
> >>> >>> For the cleanup I've used a simple shell script that checks the
> >>> status of
> >>> >>> the respective Jira ticket and if it's closed, the branch is
> assumed
> >>> to
> >>> >> be
> >>> >>> no longer needed and will be deleted.
> >>> >>>
> >>> >>> This is the script:
> >>> >>>
> >>> >>> for branch in $(git branch -r | grep -Po 'TINKERPOP[3]?-.*')
> >>> >>> do
> >>> >>>  jira=`sed 's/TINKERPOP3/TINKERPOP/' <<< $branch | grep -Po
> >>> >>> 'TINKERPOP-[0-9]*'`
> >>> >>>  status=`curl -s https://issues.apache.org/jira/browse/$jira |
> grep
> >>> -A1
> >>> >>> status-val | grep -Po '(?<=>)[^<]*(?=)' | head -n1`
> >>> >>>  if [ "$status" == "Closed" ]; then
> >>> >>>    git push origin --delete $branch
> >>> >>>  fi
> >>> >>> done
> >>> >>>
> >>> >>>
> >>> >>> Do people like the idea of running this script as part of the
> release
> >>> >>> process? In this case developers would no longer need to remember
> to
> >>> >> delete
> >>> >>> development branches; however naming conventions would become even
> >>> more
> >>> >>> important AND tickets should only be closed after the branch was
> >>> merged.
> >>> >>>
> >>> >>> Cheers,
> >>> >>> Daniel
> >>> >>>
> >>> >>
> >>>
> >>>
> >>
> >
>

Reply via email to