Hi, over the last weeks (and especially yesterday/today) I've been
working on a little script which goes through all the branches (except
the master branch) and checks the last commit of each branch about
whether it is an already merged script on gerrit.

Previously it worked completely offline (and it is still available by
using --offline) and was checking for each branch whether the
change-id of the latest commit could be found as the change-id in the
master branch.

Now yesterday I discovered it is possible to query gerrit via SSH and
get the data as JSON back so it now has an online mode (per default)
and checks for each change-id if it's open. So this also covers now
abandoned branches and also shows whether a branch has been even
submitted. There is an advanced online mode (via
--load-additional-data) which (after the first query) queries on the
open changes if the branch is up to date. I was able to query all
information in only one request so it's doing one (or with the
additional information two) request(s) which take for 47 change-ids
about 100 ms (according to the answer, but it feels longer, probably
overhead of the SSH connection).

By default it doesn't delete any branches but it's possible to also
delete those branches automatically, only those beginning with review/
or asking for all of them. I'm planning on an automatic update (if
request) if a branch could be updated.

You can find the script in the following gist
https://gist.github.com/xZise/975251c90e531347fee7 . It should work on
any git repository, although the server/port are currently hardcoded
(I might have an idea to fix that soon).

I'm not sure how much energy I put in this in case if we are not
staying with gerrit when the WMF does. But I originally didn't intent
to grow it so “big”.

Have fun with it,
Fabian

_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l

Reply via email to