-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 09ec360
Showing
4 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
*.class | ||
*.o | ||
*.pyc | ||
*.sqlite3 | ||
.*.sw[a-z] | ||
.sw[a-z] | ||
*~ | ||
.DS_Store | ||
bin-debug/* | ||
bin-release/* | ||
bin/* | ||
tags | ||
*.beam | ||
*.dump | ||
env/ | ||
.env/ | ||
*egg-info* | ||
misc/ | ||
dist/ | ||
Icon? | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
tl;dr: all code code is licensed under simplified BSD, unless stated otherwise. | ||
|
||
Unless stated otherwise in the source files, all code is copyright 2017 David | ||
Wolever <[email protected]>. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY EXPRESS OR | ||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
EVENT SHALL <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
The views and conclusions contained in the software and documentation are those | ||
of the authors and should not be interpreted as representing official policies, | ||
either expressed or implied, of David Wolever. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
git-blast: show git branches sorted by last commit date | ||
======================================================= | ||
|
||
``git-blast`` (Brach LAST) shows git commits ordered by the date of the last commit:: | ||
|
||
$ git blast | ||
* master 33 minutes ago | ||
david 4 days ago [M] | ||
unholy-david-payments 4 days ago | ||
payments 5 days ago [M] | ||
david-old 4 months ago | ||
dbscan 5 months ago | ||
matrix-fun 5 months ago | ||
|
||
|
||
Installation | ||
============ | ||
|
||
Put ``git-blast`` somewhere in ``$PATH``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Shows git branches sorted by last commit date, noting when branch has been | ||
merged: | ||
$ git blast | ||
* master 33 minutes ago | ||
david 4 days ago [M] | ||
unholy-david-payments 4 days ago | ||
payments 5 days ago [M] | ||
ask-inst-type 7 days ago | ||
legacy 2 weeks ago | ||
archive 2 weeks ago | ||
upload 3 weeks ago | ||
david-old 4 months ago | ||
dbscan 5 months ago | ||
matrix-fun 5 months ago | ||
""" | ||
|
||
import subprocess as sp | ||
|
||
def xcall(cmd): | ||
return sp.check_output(cmd.split()).decode("utf-8") | ||
|
||
C_GREEN = '\033[0;32m' | ||
C_BLUE = '\033[0;34m' | ||
C_RESET = '\033[0;0m' | ||
|
||
cur_branch = xcall("git rev-parse --abbrev-ref HEAD").strip() | ||
merged_branches = set([ | ||
x.split()[-1] for x | ||
in xcall("git branch --merged").splitlines() | ||
]) | ||
|
||
by_date = xcall( | ||
"git for-each-ref --sort=-committerdate refs/heads/ " | ||
"--format=%(refname:short)%09%(committerdate:relative)" | ||
) | ||
for line in by_date.splitlines(): | ||
branch, _, date = line.partition("\t") | ||
output = "" | ||
if branch == cur_branch: | ||
output += "* %s%s" %(C_GREEN, branch) | ||
else: | ||
output += " %s" %(branch, ) | ||
output += " %s%s%s" %(C_BLUE, date, C_RESET) | ||
if branch in merged_branches and branch != cur_branch: | ||
output += " [%sM%s]" %(C_GREEN, C_RESET) | ||
print(output) |