-alias gvim="C:/programs/Vim/vim74/gvim.exe"
-
if [ -d "${HOME}/.fzf" ] ; then
PATH="${HOME}/.fzf:${PATH}"
fi
+[ -f ~/.fzf.bash ] && source ~/.fzf.bash
-PATH="C:/Program\ Files\ (x86)/MSBuild/12.0/Bin:/c/programs/CMake/bin:${PATH}"
+PATH='/c/programs/CMake/bin':'/c/program files (x86)/msbuild/12.0/bin':${PATH}
-[ -f ~/.fzf.bash ] && source ~/.fzf.bash
+alias gvim='winpty "c:/programs/vim/vim74/gvim.exe"'
+alias python='winpty "c:/program files (x86)/python35-32/python.exe"'
+alias cmake='winpty "c:/programs/cmake/bin/cmake.exe"'
+alias vcbuild='winpty "c:/program files (x86)/microsoft visual studio 9.0/vc/vcpackages/vcbuild.exe"'
+alias msbuild='winpty "c:/program files (x86)/msbuild/12.0/bin/msbuild.exe"'
eval "$(ssh-agent -s)"
ssh-add.exe ~/.ssh/github
alias reload="exec $SHELL -l"
# alias bashhere='chere -il -t mintty -s bash'
-alias newterm='mintty /bin/env CHERE_INVOKING=1 /bin/bash -l &'
alias gtypist='gtypist -wi'
alias startxwin='run /usr/bin/bash.exe -l -c "/usr/bin/startxwin -- -nolock -unixkill"'
alias startvnc='vncserver -geometry 1870x980 -depth 24'
alias startvnc4='vnc4server -geometry 1870x980 -depth 24'
alias dotfiles='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
-alias vcbuild='winpty "c:/program files (x86)/microsoft visual studio 9.0/vc/vcpackages/vcbuild.exe"'
-alias msbuild='winpty "c:/program files (x86)/msbuild/12.0/bin/msbuild.exe"'
-alias python='winpty "c:/program files (x86)/python35-32/python.exe"'
-alias cmake='winpty "c:/programs/cmake/bin/cmake.exe"'
# export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
export LESS=-eFRX
-export GTEST_DIR=~/repos/googletest/googletest
-export CPPUNITDIR=~/repos/cppunit
+export GTEST_DIR='c:/users/59698/repos/googletest/googletest'
+export CPPUNITDIR='c:/users/59698/repos/cppunit'
export VIRTUALENVWRAPPER_PYTHON=/mingw64/bin/python3
#export XDG_CONFIG_HOME = ~/.config/
#export XDG_DATA_DIRS=/usr/share/
#export XDG_CONFIG_DIRS=/etc/xdg/
+PATH=.:${HOME}/bin:${PATH}
+
# Set PATH so it includes user's private bin if it exists
if [ -d "${HOME}/.local/bin" ] ; then
- PATH=.:${HOME}/.local/bin:${PATH}
+ PATH=${HOME}/.local/bin:${PATH}
fi
# Set MANPATH so it includes users' private man if it exists
+++ /dev/null
-#!/bin/sh
-make PREFIX=$PREFIX MULTILIB=lib
-make install PREFIX=$PREFIX/apps/luajit MULTILIB=lib
+++ /dev/null
-#!/bin/sh
-
-./configure \
---prefix=$PREFIX \
---with-features=huge \
---with-compiledby="ejannza" \
---enable-multibyte \
---enable-gui=gtk2 \
---enable-luainterp \
---with-lua-prefix=$PREFIX --with-luajit \
---enable-gpm \
---enable-cscope \
---enable-fontset \
---enable-fail-if-missing
-
-
-make
-make install prefix=$PREFIX/apps/vim
+++ /dev/null
-#!/bin/sh
-
-sudo dnf install kernel-$1
-sudo dnf install akmod-wl "kernel-devel-uname-r == $(uname -r)"
-sudo akmods
+++ /dev/null
-#!/usr/bin/env perl
-
-# by entheon, do whatever the hell you want with this file
-
-print "\n";
-print "**************************\n";
-print "*XTERM 256Color Test Chart\n";
-print "**************************\n";
-print "* 16 = black\n";
-print "* 255 = white\n";
-print "*\n";
-print "* Usage:\n";
-print "* colortest -w\n";
-print "* wide display\n";
-print "*\n";
-print "* colortest -w -r\n";
-print "* wide display reversed\n";
-print "*\n";
-print "* colortest -w -s\n";
-print "* extra spaces padding\n";
-print "*\n";
-print "* colortest -w -r -s\n";
-print "* available combination\n";
-print "*\n";
-print "**************************\n";
-
-if( $ARGV[0] eq "-w" || $ARGV[1] eq "-w" || $ARGV[2] eq "-w" ) {
- push(@arr, [( "\e[38;5;16m 16: 00/00/00", "\e[38;5;17m 17: 00/00/5f", "\e[38;5;18m 18: 00/00/87", "\e[38;5;19m 19: 00/00/af", "\e[38;5;20m 20: 00/00/d7", "\e[38;5;21m 21: 00/00/ff")] );
- push(@arr, [( "\e[38;5;22m 22: 00/5f/00", "\e[38;5;23m 23: 00/5f/5f", "\e[38;5;24m 24: 00/5f/87", "\e[38;5;25m 25: 00/5f/af", "\e[38;5;26m 26: 00/5f/d7", "\e[38;5;27m 27: 00/5f/ff")] );
- push(@arr, [( "\e[38;5;28m 28: 00/87/00", "\e[38;5;29m 29: 00/87/5f", "\e[38;5;30m 30: 00/87/87", "\e[38;5;31m 31: 00/87/af", "\e[38;5;32m 32: 00/87/d7", "\e[38;5;33m 33: 00/87/ff")] );
- push(@arr, [( "\e[38;5;34m 34: 00/af/00", "\e[38;5;35m 35: 00/af/5f", "\e[38;5;36m 36: 00/af/87", "\e[38;5;37m 37: 00/af/af", "\e[38;5;38m 38: 00/af/d7", "\e[38;5;39m 39: 00/af/ff")] );
- push(@arr, [( "\e[38;5;40m 40: 00/d7/00", "\e[38;5;41m 41: 00/d7/5f", "\e[38;5;42m 42: 00/d7/87", "\e[38;5;43m 43: 00/d7/af", "\e[38;5;44m 44: 00/d7/d7", "\e[38;5;45m 45: 00/d7/ff")] );
- push(@arr, [( "\e[38;5;46m 46: 00/ff/00", "\e[38;5;47m 47: 00/ff/5f", "\e[38;5;48m 48: 00/ff/87", "\e[38;5;49m 49: 00/ff/af", "\e[38;5;50m 50: 00/ff/d7", "\e[38;5;51m 51: 00/ff/ff")] );
- push(@arr, [( "\e[38;5;52m 52: 5f/00/00", "\e[38;5;53m 53: 5f/00/5f", "\e[38;5;54m 54: 5f/00/87", "\e[38;5;55m 55: 5f/00/af", "\e[38;5;56m 56: 5f/00/d7", "\e[38;5;57m 57: 5f/00/ff")] );
- push(@arr, [( "\e[38;5;58m 58: 5f/5f/00", "\e[38;5;59m 59: 5f/5f/5f", "\e[38;5;60m 60: 5f/5f/87", "\e[38;5;61m 61: 5f/5f/af", "\e[38;5;62m 62: 5f/5f/d7", "\e[38;5;63m 63: 5f/5f/ff")] );
- push(@arr, [( "\e[38;5;64m 64: 5f/87/00", "\e[38;5;65m 65: 5f/87/5f", "\e[38;5;66m 66: 5f/87/87", "\e[38;5;67m 67: 5f/87/af", "\e[38;5;68m 68: 5f/87/d7", "\e[38;5;69m 69: 5f/87/ff")] );
- push(@arr, [( "\e[38;5;70m 70: 5f/af/00", "\e[38;5;71m 71: 5f/af/5f", "\e[38;5;72m 72: 5f/af/87", "\e[38;5;73m 73: 5f/af/af", "\e[38;5;74m 74: 5f/af/d7", "\e[38;5;75m 75: 5f/af/ff")] );
- push(@arr, [( "\e[38;5;76m 76: 5f/d7/00", "\e[38;5;77m 77: 5f/d7/5f", "\e[38;5;78m 78: 5f/d7/87", "\e[38;5;79m 79: 5f/d7/af", "\e[38;5;80m 80: 5f/d7/d7", "\e[38;5;81m 81: 5f/d7/ff")] );
- push(@arr, [( "\e[38;5;82m 82: 5f/ff/00", "\e[38;5;83m 83: 5f/ff/5f", "\e[38;5;84m 84: 5f/ff/87", "\e[38;5;85m 85: 5f/ff/af", "\e[38;5;86m 86: 5f/ff/d7", "\e[38;5;87m 87: 5f/ff/ff")] );
- push(@arr, [( "\e[38;5;88m 88: 87/00/00", "\e[38;5;89m 89: 87/00/5f", "\e[38;5;90m 90: 87/00/87", "\e[38;5;91m 91: 87/00/af", "\e[38;5;92m 92: 87/00/d7", "\e[38;5;93m 93: 87/00/ff")] );
- push(@arr, [( "\e[38;5;94m 94: 87/5f/00", "\e[38;5;95m 95: 87/5f/5f", "\e[38;5;96m 96: 87/5f/87", "\e[38;5;97m 97: 87/5f/af", "\e[38;5;98m 98: 87/5f/d7", "\e[38;5;99m 99: 87/5f/ff")] );
- push(@arr, [( "\e[38;5;100m 100: 87/87/00", "\e[38;5;101m 101: 87/87/5f", "\e[38;5;102m 102: 87/87/87", "\e[38;5;103m 103: 87/87/af", "\e[38;5;104m 104: 87/87/d7", "\e[38;5;105m 105: 87/87/ff")] );
- push(@arr, [( "\e[38;5;106m 106: 87/af/00", "\e[38;5;107m 107: 87/af/5f", "\e[38;5;108m 108: 87/af/87", "\e[38;5;109m 109: 87/af/af", "\e[38;5;110m 110: 87/af/d7", "\e[38;5;111m 111: 87/af/ff")] );
- push(@arr, [( "\e[38;5;112m 112: 87/d7/00", "\e[38;5;113m 113: 87/d7/5f", "\e[38;5;114m 114: 87/d7/87", "\e[38;5;115m 115: 87/d7/af", "\e[38;5;116m 116: 87/d7/d7", "\e[38;5;117m 117: 87/d7/ff")] );
- push(@arr, [( "\e[38;5;118m 118: 87/ff/00", "\e[38;5;119m 119: 87/ff/5f", "\e[38;5;120m 120: 87/ff/87", "\e[38;5;121m 121: 87/ff/af", "\e[38;5;122m 122: 87/ff/d7", "\e[38;5;123m 123: 87/ff/ff")] );
- push(@arr, [( "\e[38;5;124m 124: af/00/00", "\e[38;5;125m 125: af/00/5f", "\e[38;5;126m 126: af/00/87", "\e[38;5;127m 127: af/00/af", "\e[38;5;128m 128: af/00/d7", "\e[38;5;129m 129: af/00/ff")] );
- push(@arr, [( "\e[38;5;130m 130: af/5f/00", "\e[38;5;131m 131: af/5f/5f", "\e[38;5;132m 132: af/5f/87", "\e[38;5;133m 133: af/5f/af", "\e[38;5;134m 134: af/5f/d7", "\e[38;5;135m 135: af/5f/ff")] );
- push(@arr, [( "\e[38;5;136m 136: af/87/00", "\e[38;5;137m 137: af/87/5f", "\e[38;5;138m 138: af/87/87", "\e[38;5;139m 139: af/87/af", "\e[38;5;140m 140: af/87/d7", "\e[38;5;141m 141: af/87/ff")] );
- push(@arr, [( "\e[38;5;142m 142: af/af/00", "\e[38;5;143m 143: af/af/5f", "\e[38;5;144m 144: af/af/87", "\e[38;5;145m 145: af/af/af", "\e[38;5;146m 146: af/af/d7", "\e[38;5;147m 147: af/af/ff")] );
- push(@arr, [( "\e[38;5;148m 148: af/d7/00", "\e[38;5;149m 149: af/d7/5f", "\e[38;5;150m 150: af/d7/87", "\e[38;5;151m 151: af/d7/af", "\e[38;5;152m 152: af/d7/d7", "\e[38;5;153m 153: af/d7/ff")] );
- push(@arr, [( "\e[38;5;154m 154: af/ff/00", "\e[38;5;155m 155: af/ff/5f", "\e[38;5;156m 156: af/ff/87", "\e[38;5;157m 157: af/ff/af", "\e[38;5;158m 158: af/ff/d7", "\e[38;5;159m 159: af/ff/ff")] );
- push(@arr, [( "\e[38;5;160m 160: d7/00/00", "\e[38;5;161m 161: d7/00/5f", "\e[38;5;162m 162: d7/00/87", "\e[38;5;163m 163: d7/00/af", "\e[38;5;164m 164: d7/00/d7", "\e[38;5;165m 165: d7/00/ff")] );
- push(@arr, [( "\e[38;5;166m 166: d7/5f/00", "\e[38;5;167m 167: d7/5f/5f", "\e[38;5;168m 168: d7/5f/87", "\e[38;5;169m 169: d7/5f/af", "\e[38;5;170m 170: d7/5f/d7", "\e[38;5;171m 171: d7/5f/ff")] );
- push(@arr, [( "\e[38;5;172m 172: d7/87/00", "\e[38;5;173m 173: d7/87/5f", "\e[38;5;174m 174: d7/87/87", "\e[38;5;175m 175: d7/87/af", "\e[38;5;176m 176: d7/87/d7", "\e[38;5;177m 177: d7/87/ff")] );
- push(@arr, [( "\e[38;5;178m 178: d7/af/00", "\e[38;5;179m 179: d7/af/5f", "\e[38;5;180m 180: d7/af/87", "\e[38;5;181m 181: d7/af/af", "\e[38;5;182m 182: d7/af/d7", "\e[38;5;183m 183: d7/af/ff")] );
- push(@arr, [( "\e[38;5;184m 184: d7/d7/00", "\e[38;5;185m 185: d7/d7/5f", "\e[38;5;186m 186: d7/d7/87", "\e[38;5;187m 187: d7/d7/af", "\e[38;5;188m 188: d7/d7/d7", "\e[38;5;189m 189: d7/d7/ff")] );
- push(@arr, [( "\e[38;5;190m 190: d7/ff/00", "\e[38;5;191m 191: d7/ff/5f", "\e[38;5;192m 192: d7/ff/87", "\e[38;5;193m 193: d7/ff/af", "\e[38;5;194m 194: d7/ff/d7", "\e[38;5;195m 195: d7/ff/ff")] );
- push(@arr, [( "\e[38;5;196m 196: ff/00/00", "\e[38;5;197m 197: ff/00/5f", "\e[38;5;198m 198: ff/00/87", "\e[38;5;199m 199: ff/00/af", "\e[38;5;200m 200: ff/00/d7", "\e[38;5;201m 201: ff/00/ff")] );
- push(@arr, [( "\e[38;5;202m 202: ff/5f/00", "\e[38;5;203m 203: ff/5f/5f", "\e[38;5;204m 204: ff/5f/87", "\e[38;5;205m 205: ff/5f/af", "\e[38;5;206m 206: ff/5f/d7", "\e[38;5;207m 207: ff/5f/ff")] );
- push(@arr, [( "\e[38;5;208m 208: ff/87/00", "\e[38;5;209m 209: ff/87/5f", "\e[38;5;210m 210: ff/87/87", "\e[38;5;211m 211: ff/87/af", "\e[38;5;212m 212: ff/87/d7", "\e[38;5;213m 213: ff/87/ff")] );
- push(@arr, [( "\e[38;5;214m 214: ff/af/00", "\e[38;5;215m 215: ff/af/5f", "\e[38;5;216m 216: ff/af/87", "\e[38;5;217m 217: ff/af/af", "\e[38;5;218m 218: ff/af/d7", "\e[38;5;219m 219: ff/af/ff")] );
- push(@arr, [( "\e[38;5;220m 220: ff/d7/00", "\e[38;5;221m 221: ff/d7/5f", "\e[38;5;222m 222: ff/d7/87", "\e[38;5;223m 223: ff/d7/af", "\e[38;5;224m 224: ff/d7/d7", "\e[38;5;225m 225: ff/d7/ff")] );
- push(@arr, [( "\e[38;5;226m 226: ff/ff/00", "\e[38;5;227m 227: ff/ff/5f", "\e[38;5;228m 228: ff/ff/87", "\e[38;5;229m 229: ff/ff/af", "\e[38;5;230m 230: ff/ff/d7", "\e[38;5;231m 231: ff/ff/ff")] );
- push(@arr, [( "\e[38;5;232m 232: 08/08/08", "\e[38;5;233m 233: 12/12/12", "\e[38;5;234m 234: 1c/1c/1c", "\e[38;5;235m 235: 26/26/26", "\e[38;5;236m 236: 30/30/30", "\e[38;5;237m 237: 3a/3a/3a")] );
- push(@arr, [( "\e[38;5;238m 238: 44/44/44", "\e[38;5;239m 239: 4e/4e/4e", "\e[38;5;240m 240: 58/58/58", "\e[38;5;241m 241: 62/62/62", "\e[38;5;242m 242: 6c/6c/6c", "\e[38;5;243m 243: 76/76/76")] );
- push(@arr, [( "\e[38;5;244m 244: 80/80/80", "\e[38;5;245m 245: 8a/8a/8a", "\e[38;5;246m 246: 94/94/94", "\e[38;5;247m 247: 9e/9e/9e", "\e[38;5;248m 248: a8/a8/a8", "\e[38;5;249m 249: b2/b2/b2")] );
- push(@arr, [( "\e[38;5;250m 250: bc/bc/bc", "\e[38;5;251m 251: c6/c6/c6", "\e[38;5;252m 252: d0/d0/d0", "\e[38;5;253m 253: da/da/da", "\e[38;5;254m 254: e4/e4/e4", "\e[38;5;255m 255: ee/ee/ee")] );
-
- if( $ARGV[0] eq "-s" || $ARGV[1] eq "-s" || $ARGV[2] eq "-s" ){
- $padding = " ";
- }
- else {
-
- }
-
- # display in reverse order
- if( $ARGV[0] eq "-r" || $ARGV[1] eq "-r" || $ARGV[2] eq "-r" ){
- for( $dimone = 0; $dimone < scalar @arr; $dimone++ ) {
-
- $seed = ($dimone % 6) * -1;
- for( $dimtwo = 0; $dimtwo < 6; $dimtwo++ ) {
-
- $movone = $seed;
- $movtwo = $seed * -1;
-
- print $arr[$dimone][$dimtwo] . $padding;
-
- $seed = $seed+1;
- }
-
- print "\n";
- }
- }
- else {
- for( $dimone = 0; $dimone < scalar @arr; $dimone++ ) {
-
- $seed = ($dimone % 6) * -1;
- for( $dimtwo = 0; $dimtwo < 6; $dimtwo++ ) {
-
- $movone = $seed;
- $movtwo = $seed * -1;
-
- $newone = $dimone+$movone;
- $newtwo = $dimtwo+$movtwo;
-
- if( $newone < scalar @arr ){
- print $arr[$newone][$newtwo] . $padding;
- }
-
- $seed = $seed+1;
- }
-
- print "\n";
- }
- }
- print "\n";
- print "\n";
-
-}
-else {
- print "\e[38;5;16m 16: 00/00/00\n";
- print "\e[38;5;17m 17: 00/00/5f\n";
- print "\e[38;5;18m 18: 00/00/87\n";
- print "\e[38;5;19m 19: 00/00/af\n";
- print "\e[38;5;20m 20: 00/00/d7\n";
- print "\e[38;5;21m 21: 00/00/ff\n";
- print "\e[38;5;22m 22: 00/5f/00\n";
- print "\e[38;5;23m 23: 00/5f/5f\n";
- print "\e[38;5;24m 24: 00/5f/87\n";
- print "\e[38;5;25m 25: 00/5f/af\n";
- print "\e[38;5;26m 26: 00/5f/d7\n";
- print "\e[38;5;27m 27: 00/5f/ff\n";
- print "\e[38;5;28m 28: 00/87/00\n";
- print "\e[38;5;29m 29: 00/87/5f\n";
- print "\e[38;5;30m 30: 00/87/87\n";
- print "\e[38;5;31m 31: 00/87/af\n";
- print "\e[38;5;32m 32: 00/87/d7\n";
- print "\e[38;5;33m 33: 00/87/ff\n";
- print "\e[38;5;34m 34: 00/af/00\n";
- print "\e[38;5;35m 35: 00/af/5f\n";
- print "\e[38;5;36m 36: 00/af/87\n";
- print "\e[38;5;37m 37: 00/af/af\n";
- print "\e[38;5;38m 38: 00/af/d7\n";
- print "\e[38;5;39m 39: 00/af/ff\n";
- print "\e[38;5;40m 40: 00/d7/00\n";
- print "\e[38;5;41m 41: 00/d7/5f\n";
- print "\e[38;5;42m 42: 00/d7/87\n";
- print "\e[38;5;43m 43: 00/d7/af\n";
- print "\e[38;5;44m 44: 00/d7/d7\n";
- print "\e[38;5;45m 45: 00/d7/ff\n";
- print "\e[38;5;46m 46: 00/ff/00\n";
- print "\e[38;5;47m 47: 00/ff/5f\n";
- print "\e[38;5;48m 48: 00/ff/87\n";
- print "\e[38;5;49m 49: 00/ff/af\n";
- print "\e[38;5;50m 50: 00/ff/d7\n";
- print "\e[38;5;51m 51: 00/ff/ff\n";
- print "\e[38;5;52m 52: 5f/00/00\n";
- print "\e[38;5;53m 53: 5f/00/5f\n";
- print "\e[38;5;54m 54: 5f/00/87\n";
- print "\e[38;5;55m 55: 5f/00/af\n";
- print "\e[38;5;56m 56: 5f/00/d7\n";
- print "\e[38;5;57m 57: 5f/00/ff\n";
- print "\e[38;5;58m 58: 5f/5f/00\n";
- print "\e[38;5;59m 59: 5f/5f/5f\n";
- print "\e[38;5;60m 60: 5f/5f/87\n";
- print "\e[38;5;61m 61: 5f/5f/af\n";
- print "\e[38;5;62m 62: 5f/5f/d7\n";
- print "\e[38;5;63m 63: 5f/5f/ff\n";
- print "\e[38;5;64m 64: 5f/87/00\n";
- print "\e[38;5;65m 65: 5f/87/5f\n";
- print "\e[38;5;66m 66: 5f/87/87\n";
- print "\e[38;5;67m 67: 5f/87/af\n";
- print "\e[38;5;68m 68: 5f/87/d7\n";
- print "\e[38;5;69m 69: 5f/87/ff\n";
- print "\e[38;5;70m 70: 5f/af/00\n";
- print "\e[38;5;71m 71: 5f/af/5f\n";
- print "\e[38;5;72m 72: 5f/af/87\n";
- print "\e[38;5;73m 73: 5f/af/af\n";
- print "\e[38;5;74m 74: 5f/af/d7\n";
- print "\e[38;5;75m 75: 5f/af/ff\n";
- print "\e[38;5;76m 76: 5f/d7/00\n";
- print "\e[38;5;77m 77: 5f/d7/5f\n";
- print "\e[38;5;78m 78: 5f/d7/87\n";
- print "\e[38;5;79m 79: 5f/d7/af\n";
- print "\e[38;5;80m 80: 5f/d7/d7\n";
- print "\e[38;5;81m 81: 5f/d7/ff\n";
- print "\e[38;5;82m 82: 5f/ff/00\n";
- print "\e[38;5;83m 83: 5f/ff/5f\n";
- print "\e[38;5;84m 84: 5f/ff/87\n";
- print "\e[38;5;85m 85: 5f/ff/af\n";
- print "\e[38;5;86m 86: 5f/ff/d7\n";
- print "\e[38;5;87m 87: 5f/ff/ff\n";
- print "\e[38;5;88m 88: 87/00/00\n";
- print "\e[38;5;89m 89: 87/00/5f\n";
- print "\e[38;5;90m 90: 87/00/87\n";
- print "\e[38;5;91m 91: 87/00/af\n";
- print "\e[38;5;92m 92: 87/00/d7\n";
- print "\e[38;5;93m 93: 87/00/ff\n";
- print "\e[38;5;94m 94: 87/5f/00\n";
- print "\e[38;5;95m 95: 87/5f/5f\n";
- print "\e[38;5;96m 96: 87/5f/87\n";
- print "\e[38;5;97m 97: 87/5f/af\n";
- print "\e[38;5;98m 98: 87/5f/d7\n";
- print "\e[38;5;99m 99: 87/5f/ff\n";
- print "\e[38;5;100m 100 :87/87/00\n";
- print "\e[38;5;101m 101 :87/87/5f\n";
- print "\e[38;5;102m 102 :87/87/87\n";
- print "\e[38;5;103m 103 :87/87/af\n";
- print "\e[38;5;104m 104 :87/87/d7\n";
- print "\e[38;5;105m 105 :87/87/ff\n";
- print "\e[38;5;106m 106 :87/af/00\n";
- print "\e[38;5;107m 107 :87/af/5f\n";
- print "\e[38;5;108m 108 :87/af/87\n";
- print "\e[38;5;109m 109 :87/af/af\n";
- print "\e[38;5;110m 110 :87/af/d7\n";
- print "\e[38;5;111m 111 :87/af/ff\n";
- print "\e[38;5;112m 112 :87/d7/00\n";
- print "\e[38;5;113m 113 :87/d7/5f\n";
- print "\e[38;5;114m 114 :87/d7/87\n";
- print "\e[38;5;115m 115 :87/d7/af\n";
- print "\e[38;5;116m 116 :87/d7/d7\n";
- print "\e[38;5;117m 117 :87/d7/ff\n";
- print "\e[38;5;118m 118 :87/ff/00\n";
- print "\e[38;5;119m 119 :87/ff/5f\n";
- print "\e[38;5;120m 120 :87/ff/87\n";
- print "\e[38;5;121m 121 :87/ff/af\n";
- print "\e[38;5;122m 122 :87/ff/d7\n";
- print "\e[38;5;123m 123 :87/ff/ff\n";
- print "\e[38;5;124m 124 :af/00/00\n";
- print "\e[38;5;125m 125 :af/00/5f\n";
- print "\e[38;5;126m 126 :af/00/87\n";
- print "\e[38;5;127m 127 :af/00/af\n";
- print "\e[38;5;128m 128 :af/00/d7\n";
- print "\e[38;5;129m 129 :af/00/ff\n";
- print "\e[38;5;130m 130 :af/5f/00\n";
- print "\e[38;5;131m 131 :af/5f/5f\n";
- print "\e[38;5;132m 132 :af/5f/87\n";
- print "\e[38;5;133m 133 :af/5f/af\n";
- print "\e[38;5;134m 134 :af/5f/d7\n";
- print "\e[38;5;135m 135 :af/5f/ff\n";
- print "\e[38;5;136m 136 :af/87/00\n";
- print "\e[38;5;137m 137 :af/87/5f\n";
- print "\e[38;5;138m 138 :af/87/87\n";
- print "\e[38;5;139m 139 :af/87/af\n";
- print "\e[38;5;140m 140 :af/87/d7\n";
- print "\e[38;5;141m 141 :af/87/ff\n";
- print "\e[38;5;142m 142 :af/af/00\n";
- print "\e[38;5;143m 143 :af/af/5f\n";
- print "\e[38;5;144m 144 :af/af/87\n";
- print "\e[38;5;145m 145 :af/af/af\n";
- print "\e[38;5;146m 146 :af/af/d7\n";
- print "\e[38;5;147m 147 :af/af/ff\n";
- print "\e[38;5;148m 148 :af/d7/00\n";
- print "\e[38;5;149m 149 :af/d7/5f\n";
- print "\e[38;5;150m 150 :af/d7/87\n";
- print "\e[38;5;151m 151 :af/d7/af\n";
- print "\e[38;5;152m 152 :af/d7/d7\n";
- print "\e[38;5;153m 153 :af/d7/ff\n";
- print "\e[38;5;154m 154 :af/ff/00\n";
- print "\e[38;5;155m 155 :af/ff/5f\n";
- print "\e[38;5;156m 156 :af/ff/87\n";
- print "\e[38;5;157m 157 :af/ff/af\n";
- print "\e[38;5;158m 158 :af/ff/d7\n";
- print "\e[38;5;159m 159 :af/ff/ff\n";
- print "\e[38;5;160m 160 :d7/00/00\n";
- print "\e[38;5;161m 161 :d7/00/5f\n";
- print "\e[38;5;162m 162 :d7/00/87\n";
- print "\e[38;5;163m 163 :d7/00/af\n";
- print "\e[38;5;164m 164 :d7/00/d7\n";
- print "\e[38;5;165m 165 :d7/00/ff\n";
- print "\e[38;5;166m 166 :d7/5f/00\n";
- print "\e[38;5;167m 167 :d7/5f/5f\n";
- print "\e[38;5;168m 168 :d7/5f/87\n";
- print "\e[38;5;169m 169 :d7/5f/af\n";
- print "\e[38;5;170m 170 :d7/5f/d7\n";
- print "\e[38;5;171m 171 :d7/5f/ff\n";
- print "\e[38;5;172m 172 :d7/87/00\n";
- print "\e[38;5;173m 173 :d7/87/5f\n";
- print "\e[38;5;174m 174 :d7/87/87\n";
- print "\e[38;5;175m 175 :d7/87/af\n";
- print "\e[38;5;176m 176 :d7/87/d7\n";
- print "\e[38;5;177m 177 :d7/87/ff\n";
- print "\e[38;5;178m 178 :d7/af/00\n";
- print "\e[38;5;179m 179 :d7/af/5f\n";
- print "\e[38;5;180m 180 :d7/af/87\n";
- print "\e[38;5;181m 181 :d7/af/af\n";
- print "\e[38;5;182m 182 :d7/af/d7\n";
- print "\e[38;5;183m 183 :d7/af/ff\n";
- print "\e[38;5;184m 184 :d7/d7/00\n";
- print "\e[38;5;185m 185 :d7/d7/5f\n";
- print "\e[38;5;186m 186 :d7/d7/87\n";
- print "\e[38;5;187m 187 :d7/d7/af\n";
- print "\e[38;5;188m 188 :d7/d7/d7\n";
- print "\e[38;5;189m 189 :d7/d7/ff\n";
- print "\e[38;5;190m 190 :d7/ff/00\n";
- print "\e[38;5;191m 191 :d7/ff/5f\n";
- print "\e[38;5;192m 192 :d7/ff/87\n";
- print "\e[38;5;193m 193 :d7/ff/af\n";
- print "\e[38;5;194m 194 :d7/ff/d7\n";
- print "\e[38;5;195m 195 :d7/ff/ff\n";
- print "\e[38;5;196m 196 :ff/00/00\n";
- print "\e[38;5;197m 197 :ff/00/5f\n";
- print "\e[38;5;198m 198 :ff/00/87\n";
- print "\e[38;5;199m 199 :ff/00/af\n";
- print "\e[38;5;200m 200 :ff/00/d7\n";
- print "\e[38;5;201m 201 :ff/00/ff\n";
- print "\e[38;5;202m 202 :ff/5f/00\n";
- print "\e[38;5;203m 203 :ff/5f/5f\n";
- print "\e[38;5;204m 204 :ff/5f/87\n";
- print "\e[38;5;205m 205 :ff/5f/af\n";
- print "\e[38;5;206m 206 :ff/5f/d7\n";
- print "\e[38;5;207m 207 :ff/5f/ff\n";
- print "\e[38;5;208m 208 :ff/87/00\n";
- print "\e[38;5;209m 209 :ff/87/5f\n";
- print "\e[38;5;210m 210 :ff/87/87\n";
- print "\e[38;5;211m 211 :ff/87/af\n";
- print "\e[38;5;212m 212 :ff/87/d7\n";
- print "\e[38;5;213m 213 :ff/87/ff\n";
- print "\e[38;5;214m 214 :ff/af/00\n";
- print "\e[38;5;215m 215 :ff/af/5f\n";
- print "\e[38;5;216m 216 :ff/af/87\n";
- print "\e[38;5;217m 217 :ff/af/af\n";
- print "\e[38;5;218m 218 :ff/af/d7\n";
- print "\e[38;5;219m 219 :ff/af/ff\n";
- print "\e[38;5;220m 220 :ff/d7/00\n";
- print "\e[38;5;221m 221 :ff/d7/5f\n";
- print "\e[38;5;222m 222 :ff/d7/87\n";
- print "\e[38;5;223m 223 :ff/d7/af\n";
- print "\e[38;5;224m 224 :ff/d7/d7\n";
- print "\e[38;5;225m 225 :ff/d7/ff\n";
- print "\e[38;5;226m 226 :ff/ff/00\n";
- print "\e[38;5;227m 227 :ff/ff/5f\n";
- print "\e[38;5;228m 228 :ff/ff/87\n";
- print "\e[38;5;229m 229 :ff/ff/af\n";
- print "\e[38;5;230m 230 :ff/ff/d7\n";
- print "\e[38;5;231m 231 :ff/ff/ff\n";
- print "\e[38;5;232m 232 :08/08/08\n";
- print "\e[38;5;233m 233 :12/12/12\n";
- print "\e[38;5;234m 234 :1c/1c/1c\n";
- print "\e[38;5;235m 235 :26/26/26\n";
- print "\e[38;5;236m 236 :30/30/30\n";
- print "\e[38;5;237m 237 :3a/3a/3a\n";
- print "\e[38;5;238m 238 :44/44/44\n";
- print "\e[38;5;239m 239 :4e/4e/4e\n";
- print "\e[38;5;240m 240 :58/58/58\n";
- print "\e[38;5;241m 241 :62/62/62\n";
- print "\e[38;5;242m 242 :6c/6c/6c\n";
- print "\e[38;5;243m 243 :76/76/76\n";
- print "\e[38;5;244m 244 :80/80/80\n";
- print "\e[38;5;245m 245 :8a/8a/8a\n";
- print "\e[38;5;246m 246 :94/94/94\n";
- print "\e[38;5;247m 247 :9e/9e/9e\n";
- print "\e[38;5;248m 248 :a8/a8/a8\n";
- print "\e[38;5;249m 249 :b2/b2/b2\n";
- print "\e[38;5;250m 250 :bc/bc/bc\n";
- print "\e[38;5;251m 251 :c6/c6/c6\n";
- print "\e[38;5;252m 252 :d0/d0/d0\n";
- print "\e[38;5;253m 253 :da/da/da\n";
- print "\e[38;5;254m 254 :e4/e4/e4\n";
- print "\e[38;5;255m 255 :ee/ee/ee\n";
- print "\n";
- print "\n";
-}
-print "\e0m";
-exit;
+++ /dev/null
-#!/bin/sh
-# Copyright 2010 - 2012, Tim Henigan <tim.henigan@gmail.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-# Perform a directory diff between commits in the repository using
-# the external diff or merge tool specified in the user's config.
-
-USAGE='[--cached] [--copy-back] [-x|--extcmd=<command>] <commit>{0,2} [-- <path>*]
-
- --cached Compare to the index rather than the working tree.
-
- --copy-back Copy files back to the working tree when the diff
- tool exits (in case they were modified by the
- user). This option is only valid if the diff
- compared with the working tree.
-
- -x=<command>
- --extcmd=<command> Specify a custom command for viewing diffs.
- git-diffall ignores the configured defaults and
- runs $command $LOCAL $REMOTE when this option is
- specified. Additionally, $BASE is set in the
- environment.
-'
-
-SUBDIRECTORY_OK=1
-. "$(git --exec-path)/git-sh-setup"
-
-TOOL_MODE=diff
-. "$(git --exec-path)/git-mergetool--lib"
-
-merge_tool="$(get_merge_tool)"
-if test -z "$merge_tool"
-then
- echo "Error: Either the 'diff.tool' or 'merge.tool' option must be set."
- usage
-fi
-
-start_dir=$(pwd)
-
-# All the file paths returned by the diff command are relative to the root
-# of the working copy. So if the script is called from a subdirectory, it
-# must switch to the root of working copy before trying to use those paths.
-cdup=$(git rev-parse --show-cdup) &&
-cd "$cdup" || {
- echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree"
- exit 1
-}
-
-# set up temp dir
-tmp=$(perl -e 'use File::Temp qw(tempdir);
- $t=tempdir("/tmp/git-diffall.XXXXX") or exit(1);
- print $t') || exit 1
-#trap 'rm -rf "$tmp"' EXIT
-
-left=
-right=
-paths=
-dashdash_seen=
-compare_staged=
-merge_base=
-left_dir=
-right_dir=
-diff_tool=
-copy_back=
-
-while test $# != 0
-do
- case "$1" in
- -h|--h|--he|--hel|--help)
- usage
- ;;
- --cached)
- compare_staged=1
- ;;
- --copy-back)
- copy_back=1
- ;;
- -x|--e|--ex|--ext|--extc|--extcm|--extcmd)
- if test $# = 1
- then
- echo You must specify the tool for use with --extcmd
- usage
- else
- diff_tool=$2
- shift
- fi
- ;;
- --)
- dashdash_seen=1
- ;;
- -*)
- echo Invalid option: "$1"
- usage
- ;;
- *)
- # could be commit, commit range or path limiter
- case "$1" in
- *...*)
- left=${1%...*}
- right=${1#*...}
- merge_base=1
- ;;
- *..*)
- left=${1%..*}
- right=${1#*..}
- ;;
- *)
- if test -n "$dashdash_seen"
- then
- paths="$paths$1 "
- elif test -z "$left"
- then
- left=$1
- elif test -z "$right"
- then
- right=$1
- else
- paths="$paths$1 "
- fi
- ;;
- esac
- ;;
- esac
- shift
-done
-
-# Determine the set of files which changed
-if test -n "$left" && test -n "$right"
-then
- left_dir="cmt-$(git rev-parse --short $left)"
- right_dir="cmt-$(git rev-parse --short $right)"
-
- if test -n "$compare_staged"
- then
- usage
- elif test -n "$merge_base"
- then
- git diff --name-only "$left"..."$right" -- $paths >"$tmp/filelist"
- else
- git diff --name-only "$left" "$right" -- $paths >"$tmp/filelist"
- fi
-elif test -n "$left"
-then
- left_dir="cmt-$(git rev-parse --short $left)"
-
- if test -n "$compare_staged"
- then
- right_dir="staged"
- git diff --name-only --cached "$left" -- $paths >"$tmp/filelist"
- else
- right_dir="working_tree"
- git diff --name-only "$left" -- $paths >"$tmp/filelist"
- fi
-else
- left_dir="HEAD"
-
- if test -n "$compare_staged"
- then
- right_dir="staged"
- git diff --name-only --cached -- $paths >"$tmp/filelist"
- else
- right_dir="working_tree"
- git diff --name-only -- $paths >"$tmp/filelist"
- fi
-fi
-
-# Exit immediately if there are no diffs
-if test ! -s "$tmp/filelist"
-then
- exit 0
-fi
-
-if test -n "$copy_back" && test "$right_dir" != "working_tree"
-then
- echo "--copy-back is only valid when diff includes the working tree."
- exit 1
-fi
-
-# Create the named tmp directories that will hold the files to be compared
-mkdir -p "$tmp/$left_dir" "$tmp/$right_dir"
-
-# Populate the tmp/right_dir directory with the files to be compared
-while read name
-do
- if test -n "$right"
- then
- ls_list=$(git ls-tree $right "$name")
- if test -n "$ls_list"
- then
- mkdir -p "$tmp/$right_dir/$(dirname "$name")"
- git show "$right":"$name" >"$tmp/$right_dir/$name" || true
- fi
- elif test -n "$compare_staged"
- then
- ls_list=$(git ls-files -- "$name")
- if test -n "$ls_list"
- then
- mkdir -p "$tmp/$right_dir/$(dirname "$name")"
- git show :"$name" >"$tmp/$right_dir/$name"
- fi
- else
- if test -e "$name"
- then
- mkdir -p "$tmp/$right_dir/$(dirname "$name")"
- cp "$name" "$tmp/$right_dir/$name"
- fi
- fi
-done < "$tmp/filelist"
-
-# Populate the tmp/left_dir directory with the files to be compared
-while read name
-do
- if test -n "$left"
- then
- ls_list=$(git ls-tree $left "$name")
- if test -n "$ls_list"
- then
- mkdir -p "$tmp/$left_dir/$(dirname "$name")"
- git show "$left":"$name" >"$tmp/$left_dir/$name" || true
- fi
- else
- if test -n "$compare_staged"
- then
- ls_list=$(git ls-tree HEAD "$name")
- if test -n "$ls_list"
- then
- mkdir -p "$tmp/$left_dir/$(dirname "$name")"
- git show HEAD:"$name" >"$tmp/$left_dir/$name"
- fi
- else
- mkdir -p "$tmp/$left_dir/$(dirname "$name")"
- git show :"$name" >"$tmp/$left_dir/$name"
- fi
- fi
-done < "$tmp/filelist"
-
-LOCAL="$tmp/$left_dir"
-REMOTE="$tmp/$right_dir"
-
-if test -n "$diff_tool"
-then
- export BASE
- eval $diff_tool '"$LOCAL"' '"$REMOTE"'
-else
- run_merge_tool "$merge_tool" false
-fi
-
-# Copy files back to the working dir, if requested
-if test -n "$copy_back" && test "$right_dir" = "working_tree"
-then
- cd "$start_dir"
- git_top_dir=$(git rev-parse --show-toplevel)
- find "$tmp/$right_dir" -type f |
- while read file
- do
- cp "$file" "$git_top_dir/${file#$tmp/$right_dir/}"
- done
-fi
\ No newline at end of file
+++ /dev/null
-TOOL=vimdiff
-ARG=$@
-$TOOL $ARG
+++ /dev/null
-#!/bin/bash
-TOOL=vim
-ARG=$@
-$TOOL $ARG
+++ /dev/null
-#! /bin/bash
-TOOL=vimdiff
-ARG=$@
-$TOOL $ARG
+++ /dev/null
-#!/usr/bin/env python
-from __future__ import print_function
-
-COPYRIGHT = """\
-Copyright (C) 2011-2012 OpenStack LLC.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-implied.
-
-See the License for the specific language governing permissions and
-limitations under the License."""
-
-import datetime
-import json
-import os
-import re
-import shlex
-import subprocess
-import sys
-import time
-
-if sys.version < '3':
- import ConfigParser
- import urllib
- import urlparse
- urlopen = urllib.urlopen
- urlparse = urlparse.urlparse
- do_input = raw_input
-else:
- import configparser as ConfigParser
- import urllib.parse
- import urllib.request
- urlopen = urllib.request.urlopen
- urlparse = urllib.parse.urlparse
- do_input = input
-
-from distutils import version as du_version
-
-version = "1.22"
-
-VERBOSE = False
-UPDATE = False
-CONFIGDIR = os.path.expanduser("~/.config/git-review")
-GLOBAL_CONFIG = "/etc/git-review/git-review.conf"
-USER_CONFIG = os.path.join(CONFIGDIR, "git-review.conf")
-PYPI_URL = "http://pypi.python.org/pypi/git-review/json"
-PYPI_CACHE_TIME = 60 * 60 * 24 # 24 hours
-DEFAULTS = dict(hostname='gerrit.lud.stericsson.com', port='29418', project=False,
- defaultbranch='master', defaultremote="gerrit",
- defaultrebase="0")
-
-_branch_name = None
-_has_color = None
-_no_color_support = False
-
-
-class colors:
- yellow = '\033[33m'
- green = '\033[92m'
- reset = '\033[0m'
-
-
-class GitReviewException(Exception):
- pass
-
-
-class CommandFailed(GitReviewException):
-
- def __init__(self, *args):
- Exception.__init__(self, *args)
- (self.rc, self.output, self.argv, self.envp) = args
- self.quickmsg = dict([
- ("argv", " ".join(self.argv)),
- ("rc", self.rc),
- ("output", self.output)])
-
- def __str__(self):
- return self.__doc__ + """
-The following command failed with exit code %(rc)d
- "%(argv)s"
------------------------
-%(output)s
------------------------""" % self.quickmsg
-
-
-class ChangeSetException(GitReviewException):
-
- def __init__(self, e):
- GitReviewException.__init__(self)
- self.e = str(e)
-
- def __str__(self):
- return self.__doc__ % self.e
-
-
-def parse_review_number(review):
- parts = review.split(',')
- if len(parts) < 2:
- parts.append(None)
- return parts
-
-
-def build_review_number(review, patchset):
- if patchset is not None:
- return '%s,%s' % (review, patchset)
- return review
-
-
-def run_command_status(*argv, **env):
- if VERBOSE:
- print(datetime.datetime.now(), "Running:", " ".join(argv))
- if len(argv) == 1:
- argv = shlex.split(str(argv[0]))
- newenv = os.environ
- newenv.update(env)
- p = subprocess.Popen(argv, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT, env=newenv)
- (out, nothing) = p.communicate()
- out = out.decode('utf-8')
- return (p.returncode, out.strip())
-
-
-def run_command(*argv, **env):
- (rc, output) = run_command_status(*argv, **env)
- return output
-
-
-def run_command_exc(klazz, *argv, **env):
- """Run command *argv, on failure raise 'klazz
-
- klass should be derived from CommandFailed
- """
- (rc, output) = run_command_status(*argv, **env)
- if rc != 0:
- raise klazz(rc, output, argv, env)
- return output
-
-
-def update_latest_version(version_file_path):
- """Cache the latest version of git-review for the upgrade check."""
-
- if not os.path.exists(CONFIGDIR):
- os.makedirs(CONFIGDIR)
-
- if os.path.exists(version_file_path) and not UPDATE:
- if (time.time() - os.path.getmtime(version_file_path)) < 28800:
- return
-
- latest_version = version
- try:
- latest_version = json.load(urlopen(PYPI_URL))['info']['version']
- except Exception:
- pass
-
- with open(version_file_path, "w") as version_file:
- version_file.write(latest_version)
-
-
-def latest_is_newer():
- """Check if there is a new version of git-review."""
-
- # Skip version check if distro package turns it off
- if os.path.exists(GLOBAL_CONFIG):
- config = dict(check=False)
- configParser = ConfigParser.ConfigParser(config)
- configParser.read(GLOBAL_CONFIG)
- if not configParser.getboolean("updates", "check"):
- return False
-
- version_file_path = os.path.join(CONFIGDIR, "latest-version")
- update_latest_version(version_file_path)
-
- latest_version = None
- with open(version_file_path, "r") as version_file:
- latest_version = du_version.StrictVersion(version_file.read())
- if latest_version > du_version.StrictVersion(version):
- return True
- return False
-
-
-def git_directories():
- """Determine (absolute git work directory path, .git subdirectory path)."""
- cmd = ("git", "rev-parse", "--show-toplevel", "--git-dir")
- out = run_command_exc(GitDirectoriesException, *cmd)
- try:
- return out.split()
- except ValueError:
- raise GitDirectoriesException(0, out, cmd, {})
-
-
-class GitDirectoriesException(CommandFailed):
- "Cannot determine where .git directory is."
- EXIT_CODE = 70
-
-
-class CustomScriptException(CommandFailed):
- """Custom script execution failed."""
- EXIT_CODE = 71
-
-
-def run_custom_script(action):
- """Get status and output of .git/hooks/$action-review or/and
- ~/.config/hooks/$action-review if existing.
- """
- returns = []
- script_file = "%s-review" % (action)
- (top_dir, git_dir) = git_directories()
- paths = [os.path.join(CONFIGDIR, "hooks", script_file),
- os.path.join(git_dir, "hooks", script_file)]
- for fpath in paths:
- if os.path.isfile(fpath) and os.access(fpath, os.X_OK):
- status, output = run_command_status(fpath)
- returns.append((status, output, fpath))
-
- for (status, output, path) in returns:
- if status is not None and status != 0:
- raise CustomScriptException(status, output, [path], {})
- elif output and VERBOSE:
- print("script %s output is:" % (path))
- print(output)
-
-
-def git_config_get_value(section, option, default=None):
- try:
- return run_command_exc(GitConfigException,
- "git", "config",
- "--get",
- "%s.%s" % (section, option)).strip()
- except GitConfigException as exc:
- if exc.rc == 1:
- return default
- raise
-
-
-class GitConfigException(CommandFailed):
- """Git config value retrieval failed."""
- EXIT_CODE = 128
-
-
-class CannotInstallHook(CommandFailed):
- "Problems encountered installing commit-msg hook"
- EXIT_CODE = 2
-
-
-def set_hooks_commit_msg(remote, target_file):
- """Install the commit message hook if needed."""
-
- # Create the hooks directory if it's not there already
- hooks_dir = os.path.dirname(target_file)
- if not os.path.isdir(hooks_dir):
- os.mkdir(hooks_dir)
-
- (hostname, username, port, project_name) = \
- parse_git_show(remote, "Push")
-
- if not os.path.exists(target_file) or UPDATE:
- if VERBOSE:
- print("Fetching commit hook from: scp://%s:%s" % (hostname, port))
- if port is not None:
- port = "-P %s" % port
- else:
- port = ""
- if username is None:
- userhost = hostname
- else:
- userhost = "%s@%s" % (username, hostname)
- run_command_exc(
- CannotInstallHook,
- "scp", port,
- userhost + ":hooks/commit-msg",
- target_file)
-
- if not os.access(target_file, os.X_OK):
- os.chmod(target_file, os.path.stat.S_IREAD | os.path.stat.S_IEXEC)
-
-
-def test_remote(username, hostname, port, project):
- """Tests that a possible gerrit remote works."""
-
- if port is not None:
- port = "-p %s" % port
- else:
- port = ""
- if username is None:
- userhost = hostname
- else:
- userhost = "%s@%s" % (username, hostname)
-
- (status, ssh_output) = run_command_status(
- "ssh", "-x", port, userhost,
- "gerrit", "ls-projects")
-
- if status == 0:
- if VERBOSE:
- print("%s@%s:%s worked." % (username, hostname, port))
- return True
- else:
- if VERBOSE:
- print("%s@%s:%s did not work." % (username, hostname, port))
- return False
-
-
-def make_remote_url(username, hostname, port, project):
- """Builds a gerrit remote URL."""
- if username is None:
- return "ssh://%s:%s/%s" % (hostname, port, project)
- else:
- return "ssh://%s@%s:%s/%s" % (username, hostname, port, project)
-
-
-def add_remote(hostname, port, project, remote):
- """Adds a gerrit remote."""
- asked_for_username = False
-
- username = os.getenv("USERNAME")
- if not username:
- username = git_config_get_value("gitreview", "username")
- if not username:
- username = os.getenv("USER")
- if port is None:
- port = 29418
-
- remote_url = make_remote_url(username, hostname, port, project)
- if VERBOSE:
- print("No remote set, testing %s" % remote_url)
- if not test_remote(username, hostname, port, project):
- print("Could not connect to gerrit.")
- username = do_input("Enter your gerrit username: ")
- remote_url = make_remote_url(username, hostname, port, project)
- print("Trying again with %s" % remote_url)
- if not test_remote(username, hostname, port, project):
- raise Exception("Could not connect to gerrit at %s" % remote_url)
- asked_for_username = True
-
- print("Creating a git remote called \"%s\" that maps to:" % remote)
- print("\t%s" % remote_url)
- cmd = "git remote add -f %s %s" % (remote, remote_url)
- (status, remote_output) = run_command_status(cmd)
-
- if status != 0:
- raise Exception("Error running %s" % cmd)
-
- if asked_for_username:
- print()
- print("This repository is now set up for use with git-review.")
- print("You can set the default username for future repositories with:")
- print(' git config --global --add gitreview.username "%s"' % username)
- print()
-
-
-def parse_git_show(remote, verb):
- fetch_url = ""
- for line in run_command("git remote show -n %s" % remote).split("\n"):
- if line.strip().startswith("%s" % verb):
- fetch_url = line.split()[2]
-
- parsed_url = urlparse(fetch_url)
- project_name = parsed_url.path.lstrip("/")
- if project_name.endswith(".git"):
- project_name = project_name[:-4]
-
- hostname = parsed_url.netloc
- username = None
- port = parsed_url.port
-
- if VERBOSE:
- print("Found origin %s URL:" % verb, fetch_url)
-
- # Workaround bug in urlparse on OSX
- if parsed_url.scheme == "ssh" and parsed_url.path[:2] == "//":
- hostname = parsed_url.path[2:].split("/")[0]
-
- if "@" in hostname:
- (username, hostname) = hostname.split("@")
- if ":" in hostname:
- (hostname, port) = hostname.split(":")
-
- # Is origin an ssh location? Let's pull more info
- if parsed_url.scheme == "ssh" and port is None:
- port = 22
-
- return (hostname, username, str(port), project_name)
-
-
-def check_color_support():
- global _has_color
- global _no_color_support
- if _has_color is None:
- test_command = "git log --color=never --oneline HEAD^1..HEAD"
- (status, output) = run_command_status(test_command)
- if status == 0:
- _has_color = True
- else:
- _has_color = False
-
- if _no_color_support:
- _has_color = False
-
- return _has_color
-
-
-def get_config(config_file=None):
- """Generate the configuration map by starting with some built-in defaults
- and then loading GLOBAL_CONFIG, USER_CONFIG, and a repository-specific
- .gitreview file, if they exist. In case of conflict, the configuration file
- with the narrowest scope wins.
- """
- config = DEFAULTS.copy()
- for filename in (GLOBAL_CONFIG, USER_CONFIG, config_file):
- if filename is not None and os.path.exists(filename):
- config.update(load_config_file(filename))
- return config
-
-
-def load_config_file(config_file):
- """Load configuration options from a file."""
- configParser = ConfigParser.ConfigParser()
- configParser.read(config_file)
- options = {
- 'hostname': 'host',
- 'port': 'port',
- 'project': 'project',
- 'defaultbranch': 'defaultbranch',
- 'defaultremote': 'defaultremote',
- 'defaultrebase': 'defaultrebase',
- }
- config = {}
- for config_key, option_name in options.items():
- if configParser.has_option('gerrit', option_name):
- config[config_key] = configParser.get('gerrit', option_name)
- return config
-
-
-def update_remote(remote):
- cmd = "git remote update %s" % remote
- (status, output) = run_command_status(cmd)
- if VERBOSE:
- print(output)
- if status != 0:
- print("Problem running '%s'" % cmd)
- if not VERBOSE:
- print(output)
- return False
- return True
-
-
-def check_remote(branch, remote, hostname, port, project):
- """Check that a Gerrit Git remote repo exists, if not, set one."""
-
- has_color = check_color_support()
- if has_color:
- color_never = "--color=never"
- else:
- color_never = ""
-
- if remote in run_command("git remote").split("\n"):
-
- remotes = run_command("git branch -a %s" % color_never).split("\n")
- for current_remote in remotes:
- if (current_remote.strip() == "remotes/%s/%s" % (remote, branch)
- and not UPDATE):
- return
- # We have the remote, but aren't set up to fetch. Fix it
- if VERBOSE:
- print("Setting up gerrit branch tracking for better rebasing")
- update_remote(remote)
- return
-
- if hostname is False or port is False or project is False:
- # This means there was no .gitreview file
- print("No '.gitreview' file found in this repository.")
- print("We don't know where your gerrit is. Please manually create ")
- print("a remote named \"%s\" and try again." % remote)
- sys.exit(1)
-
- # Gerrit remote not present, try to add it
- try:
- add_remote(hostname, port, project, remote)
- except Exception:
- print(sys.exc_info()[2])
- print("We don't know where your gerrit is. Please manually create ")
- print("a remote named \"%s\" and try again." % remote)
- raise
-
-
-def rebase_changes(branch, remote, interactive=True):
-
- remote_branch = "remotes/%s/%s" % (remote, branch)
-
- if not update_remote(remote):
- return False
-
- if interactive:
- cmd = "git rebase -i %s" % remote_branch
- else:
- cmd = "git rebase %s" % remote_branch
-
- (status, output) = run_command_status(cmd, GIT_EDITOR='true')
- if status != 0:
- print("Errors running %s" % cmd)
- if interactive:
- print(output)
- return False
- return True
-
-
-def undo_rebase():
- cmd = "git reset --hard ORIG_HEAD"
- (status, output) = run_command_status(cmd)
- if status != 0:
- print("Errors running %s" % cmd)
- print(output)
- return False
- return True
-
-
-def get_branch_name(target_branch):
- global _branch_name
- if _branch_name is not None:
- return _branch_name
- _branch_name = None
- has_color = check_color_support()
- if has_color:
- color_never = "--color=never"
- else:
- color_never = ""
- for branch in run_command("git branch %s" % color_never).split("\n"):
- if branch.startswith('*'):
- _branch_name = branch.split()[1].strip()
- if _branch_name == "(no":
- _branch_name = target_branch
- return _branch_name
-
-
-def assert_one_change(remote, branch, yes, have_hook):
- has_color = check_color_support()
- if has_color:
- color = git_config_get_value("color", "ui")
- if color is None:
- color = "auto"
- else:
- color = color.lower()
- if (color == "" or color == "true"):
- color = "auto"
- elif color == "false":
- color = "never"
- elif color == "auto":
- # Python is not a tty, we have to force colors
- color = "always"
- use_color = "--color=%s" % color
- else:
- use_color = ""
- cmd = "git log %s --decorate --oneline HEAD --not remotes/%s/%s --" % (
- use_color, remote, branch)
- (status, output) = run_command_status(cmd)
- if status != 0:
- print("Had trouble running %s" % cmd)
- print(output)
- sys.exit(1)
- output_lines = len(output.split("\n"))
- if output_lines == 1 and not have_hook:
- print("Your change was committed before the commit hook was installed")
- print("Amending the commit to add a gerrit change id")
- run_command("git commit --amend", GIT_EDITOR='true')
- elif output_lines == 0:
- print("No changes between HEAD and %s/%s." % (remote, branch))
- print("Submitting for review would be pointless.")
- sys.exit(1)
- elif output_lines > 1:
- if not yes:
- print("You have more than one commit"
- " that you are about to submit.")
- print("The outstanding commits are:\n\n%s\n" % output)
- print("Is this really what you meant to do?")
- yes_no = do_input("Type 'yes' to confirm: ")
- if yes_no.lower().strip() != "yes":
- print("Aborting.")
- print("Please rebase/squash your changes and try again")
- sys.exit(1)
-
-
-def use_topic(why, topic):
- """Inform the user about why a particular topic has been selected."""
- if VERBOSE:
- print(why % ('"%s"' % topic,))
- return topic
-
-
-def get_topic(target_branch):
-
- branch_name = get_branch_name(target_branch)
-
- branch_parts = branch_name.split("/")
- if len(branch_parts) >= 3 and branch_parts[0] == "review":
- return use_topic("Using change number %s "
- "for the topic of the change submitted",
- "/".join(branch_parts[2:]))
-
- log_output = run_command("git log HEAD^1..HEAD")
- bug_re = r'\b([Bb]ug|[Ll][Pp])\s*[#:]?\s*(\d+)'
-
- match = re.search(bug_re, log_output)
- if match is not None:
- return use_topic("Using bug number %s "
- "for the topic of the change submitted",
- "bug/%s" % match.group(2))
-
- bp_re = r'\b([Bb]lue[Pp]rint|[Bb][Pp])\s*[#:]?\s*([0-9a-zA-Z-_]+)'
- match = re.search(bp_re, log_output)
- if match is not None:
- return use_topic("Using blueprint number %s "
- "for the topic of the change submitted",
- "bp/%s" % match.group(2))
-
- return use_topic("Using local branch name %s "
- "for the topic of the change submitted",
- branch_name)
-
-
-class CannotQueryOpenChangesets(CommandFailed):
- "Cannot fetch review information from gerrit"
- EXIT_CODE = 32
-
-
-class CannotParseOpenChangesets(ChangeSetException):
- "Cannot parse JSON review information from gerrit"
- EXIT_CODE = 33
-
-
-def list_reviews(remote):
-
- (hostname, username, port, project_name) = \
- parse_git_show(remote, "Push")
-
- if port is not None:
- port = "-p %s" % port
- else:
- port = ""
- if username is None:
- userhost = hostname
- else:
- userhost = "%s@%s" % (username, hostname)
-
- review_info = None
- output = run_command_exc(
- CannotQueryOpenChangesets,
- "ssh", "-x", port, userhost,
- "gerrit", "query",
- "--current-patch-set --format=JSON project:%s status:open reviewer:self" % project_name)
-
- review_list = []
- review_field_width = {}
- REVIEW_FIELDS = ('number', 'currentPatchSet', 'branch', 'subject')
- FIELDS = range(0, len(REVIEW_FIELDS))
- if check_color_support():
- review_field_color = (colors.yellow, colors.yellow, colors.green, "")
- color_reset = colors.reset
- else:
- review_field_color = ("", "", "", "")
- color_reset = ""
- review_field_width = [0, 0, 0, 0]
- review_field_format = ["%*s", "%*s", "%*s", "%*s"]
- review_field_justify = [+1, +1, +1, -1] # -1 is justify to right
-
- for line in output.split("\n"):
- # Warnings from ssh wind up in this output
- if line[0] != "{":
- print(line)
- continue
- try:
- review_info = json.loads(line)
- except Exception:
- if VERBOSE:
- print(output)
- raise(CannotParseOpenChangesets, sys.exc_info()[1])
-
- if 'type' in review_info:
- break
-
- tempPS = review_info['currentPatchSet']
- appPS = tempPS['approvals']
- appValue = '-';
- for appLine in appPS:
- appBy = appLine['by']
- appUser = appBy['username']
- if appUser == username:
- appValue = appLine['value']
- review_info['currentPatchSet'] = tempPS['number'] + ' ' + appValue
-
- review_list.append([review_info[f] for f in REVIEW_FIELDS])
- for i in FIELDS:
- review_field_width[i] = max(
- review_field_width[i],
- len(review_info[REVIEW_FIELDS[i]])
- )
-
- review_field_format = " ".join([
- review_field_color[i] +
- review_field_format[i] +
- color_reset
- for i in FIELDS])
-
- review_field_width = [
- review_field_width[i] * review_field_justify[i]
- for i in FIELDS]
- for review_value in review_list:
- # At this point we have review_field_format
- # like "%*s %*s %*s" and we need to supply
- # (width1, value1, width2, value2, ...) tuple to print
- # It's easy to zip() widths with actual values,
- # but we need to flatten the resulting
- # ((width1, value1), (width2, value2), ...) map.
- formatted_fields = []
- for (width, value) in zip(review_field_width, review_value):
- formatted_fields.extend([width, value])
- print(review_field_format % tuple(formatted_fields))
- print("Found %d items for review" % review_info['rowCount'])
-
- return 0
-
-
-class CannotQueryPatchSet(CommandFailed):
- "Cannot query patchset information"
- EXIT_CODE = 34
-
-
-class ReviewInformationNotFound(ChangeSetException):
- "Could not fetch review information for change %s"
- EXIT_CODE = 35
-
-
-class ReviewNotFound(ChangeSetException):
- "Gerrit review %s not found"
- EXIT_CODE = 36
-
-
-class PatchSetGitFetchFailed(CommandFailed):
- """Cannot fetch patchset contents
-
-Does specified change number belong to this project?
-"""
- EXIT_CODE = 37
-
-
-class PatchSetNotFound(ChangeSetException):
- "Review patchset %s not found"
- EXIT_CODE = 38
-
-
-class CheckoutNewBranchFailed(CommandFailed):
- "Cannot checkout to new branch"
- EXIT_CODE = 64
-
-
-class CheckoutExistingBranchFailed(CommandFailed):
- "Cannot checkout existing branch"
- EXIT_CODE = 65
-
-
-class ResetHardFailed(CommandFailed):
- "Failed to hard reset downloaded branch"
- EXIT_CODE = 66
-
-
-def fetch_review(review, masterbranch, remote):
-
- (hostname, username, port, project_name) = \
- parse_git_show(remote, "Push")
-
- if port is not None:
- port = "-p %s" % port
- else:
- port = ""
- if username is None:
- userhost = hostname
- else:
- userhost = "%s@%s" % (username, hostname)
-
- review_arg = review
- patchset_opt = '--current-patch-set'
-
- review, patchset_number = parse_review_number(review)
- if patchset_number is not None:
- patchset_opt = '--patch-sets'
-
- review_info = None
- output = run_command_exc(
- CannotQueryPatchSet,
- "ssh", "-x", port, userhost,
- "gerrit", "query",
- "--format=JSON %s change:%s" % (patchset_opt, review))
-
- review_jsons = output.split("\n")
- found_review = False
- for review_json in review_jsons:
- try:
- review_info = json.loads(review_json)
- found_review = True
- except Exception:
- pass
- if found_review:
- break
- if not found_review:
- if VERBOSE:
- print(output)
- raise ReviewInformationNotFound(review)
-
- try:
- if patchset_number is None:
- refspec = review_info['currentPatchSet']['ref']
- else:
- refspec = [ps for ps
- in review_info['patchSets']
- if ps['number'] == patchset_number][0]['ref']
- except IndexError:
- raise PatchSetNotFound(review_arg)
- except KeyError:
- raise ReviewNotFound(review)
-
- try:
- topic = review_info['topic']
- if topic == masterbranch:
- topic = review
- except KeyError:
- topic = review
- try:
- author = re.sub('\W+', '_', review_info['owner']['name']).lower()
- except KeyError:
- author = 'unknown'
-
- if patchset_number is None:
- branch_name = "review/%s/%s" % (author, topic)
- else:
- branch_name = "review/%s/%s-patch%s" % (author, topic, patchset_number)
-
- print("Downloading %s from gerrit" % refspec)
- run_command_exc(PatchSetGitFetchFailed,
- "git", "fetch", remote, refspec)
- return branch_name
-
-
-def checkout_review(branch_name):
- """Checkout a newly fetched (FETCH_HEAD) change
- into a branch
- """
-
- try:
- run_command_exc(CheckoutNewBranchFailed,
- "git", "checkout", "-b",
- branch_name, "FETCH_HEAD")
-
- except CheckoutNewBranchFailed as e:
- if re.search("already exists\.?", e.output):
- print("Branch already exists - reusing")
- run_command_exc(CheckoutExistingBranchFailed,
- "git", "checkout", branch_name)
- run_command_exc(ResetHardFailed,
- "git", "reset", "--hard", "FETCH_HEAD")
- else:
- raise
-
- print("Switched to branch \"%s\"" % branch_name)
-
-
-class PatchSetGitCherrypickFailed(CommandFailed):
- "There was a problem applying changeset contents to the current branch."
- EXIT_CODE = 69
-
-
-def cherrypick_review(option=None):
- cmd = ["git", "cherry-pick"]
- if option:
- cmd.append(option)
- cmd.append("FETCH_HEAD")
- print(run_command_exc(PatchSetGitCherrypickFailed, *cmd))
-
-
-class CheckoutBackExistingBranchFailed(CommandFailed):
- "Cannot switch back to existing branch"
- EXIT_CODE = 67
-
-
-class DeleteBranchFailed(CommandFailed):
- "Failed to delete branch"
- EXIT_CODE = 68
-
-
-class InvalidPatchsetsToCompare(GitReviewException):
- def __init__(self, patchsetA, patchsetB):
- Exception.__init__(
- self,
- "Invalid patchsets for comparison specified (old=%s,new=%s)" % (
- patchsetA,
- patchsetB))
- EXIT_CODE = 39
-
-
-def compare_review(review_spec, branch, remote, rebase=False):
- new_ps = None # none means latest
-
- if '-' in review_spec:
- review_spec, new_ps = review_spec.split('-')
- review, old_ps = parse_review_number(review_spec)
-
- if old_ps is None or old_ps == new_ps:
- raise InvalidPatchsetsToCompare(old_ps, new_ps)
-
- old_review = build_review_number(review, old_ps)
- new_review = build_review_number(review, new_ps)
-
- old_branch = fetch_review(old_review, branch, remote)
- checkout_review(old_branch)
-
- if rebase:
- print('Rebasing %s' % old_branch)
- rebase = rebase_changes(branch, remote, False)
- if not rebase:
- print('Skipping rebase because of conflicts')
- run_command_exc(CommandFailed, 'git', 'rebase', '--abort')
-
- new_branch = fetch_review(new_review, branch, remote)
- checkout_review(new_branch)
-
- if rebase:
- print('Rebasing also %s' % new_branch)
- if not rebase_changes(branch, remote, False):
- print("Rebasing of the new branch failed, "
- "diff can be messed up (use -R to not rebase at all)!")
- run_command_exc(CommandFailed, 'git', 'rebase', '--abort')
-
- subprocess.check_call(['git', 'difftool', old_branch])
-
-
-def finish_branch(target_branch):
- local_branch = get_branch_name(target_branch)
- if VERBOSE:
- print("Switching back to '%s' and deleting '%s'" % (target_branch,
- local_branch))
- run_command_exc(CheckoutBackExistingBranchFailed,
- "git", "checkout", target_branch)
- print("Switched to branch '%s'" % target_branch)
-
- run_command_exc(DeleteBranchFailed,
- "git", "branch", "-D", local_branch)
- print("Deleted branch '%s'" % local_branch)
-
-
-def convert_bool(one_or_zero):
- "Return a bool on a one or zero string."
- return one_or_zero in ["1", "true", "True"]
-
-
-def print_exit_message(status, needs_update):
-
- if needs_update:
- print("""
-***********************************************************
-A new version of git-review is available on PyPI. Please
-update your copy with:
-
- pip install -U git-review
-
-to ensure proper behavior with gerrit. Thanks!
-***********************************************************
-""")
- sys.exit(status)
-
-
-def main():
- global _no_color_support
- usage = "git review [OPTIONS] ... [BRANCH]"
-
- import argparse
-
- class DownloadFlag(argparse.Action):
- """Additional option parsing: store value in 'dest', but
- at the same time set one of the flag options to True
- """
- def __call__(self, parser, namespace, values, option_string=None):
- setattr(namespace, self.dest, values)
- setattr(namespace, self.const, True)
-
- parser = argparse.ArgumentParser(usage=usage, description=COPYRIGHT)
-
- parser.add_argument("-t", "--topic", dest="topic",
- help="Topic to submit branch to")
- parser.add_argument("-D", "--draft", dest="draft", action="store_true",
- help="Submit review as a draft")
- parser.add_argument("-c", "--compatible", dest="compatible",
- action="store_true",
- help="Push change to refs/for/* for compatibility "
- "with Gerrit versions < 2.3. Ignored if "
- "-D/--draft is used.")
- parser.add_argument("-n", "--dry-run", dest="dry", action="store_true",
- help="Don't actually submit the branch for review")
- parser.add_argument("-i", "--new-changeid", dest="regenerate",
- action="store_true",
- help="Regenerate Change-id before submitting")
- parser.add_argument("-r", "--remote", dest="remote",
- help="git remote to use for gerrit")
- parser.add_argument("-R", "--no-rebase", dest="rebase",
- action="store_false",
- help="Don't rebase changes before submitting.")
- parser.add_argument("-F", "--force-rebase", dest="force_rebase",
- action="store_true",
- help="Force rebase even when not needed.")
- parser.add_argument("-B", "--no-color", dest="no_color_support",
- action="store_true",
- help="No color support.")
-
-
- fetch = parser.add_mutually_exclusive_group()
- fetch.set_defaults(download=False, compare=False, cherrypickcommit=False,
- cherrypickindicate=False, cherrypickonly=False)
- fetch.add_argument("-d", "--download", dest="changeidentifier",
- action=DownloadFlag, metavar="CHANGE",
- const="download",
- help="Download the contents of an existing gerrit "
- "review into a branch")
- fetch.add_argument("-x", "--cherrypick", dest="changeidentifier",
- action=DownloadFlag, metavar="CHANGE",
- const="cherrypickcommit",
- help="Apply the contents of an existing gerrit "
- "review onto the current branch and commit "
- "(cherry pick; not recommended in most "
- "situations)")
- fetch.add_argument("-X", "--cherrypickindicate", dest="changeidentifier",
- action=DownloadFlag, metavar="CHANGE",
- const="cherrypickindicate",
- help="Apply the contents of an existing gerrit "
- "review onto the current branch and commit, "
- "indicating its origin")
- fetch.add_argument("-N", "--cherrypickonly", dest="changeidentifier",
- action=DownloadFlag, metavar="CHANGE",
- const="cherrypickonly",
- help="Apply the contents of an existing gerrit "
- "review to the working directory and prepare "
- "for commit")
- fetch.add_argument("-m", "--compare", dest="changeidentifier",
- action=DownloadFlag, metavar="CHANGE,PS[-NEW_PS]",
- const="compare",
- help="Download specified and latest (or NEW_PS) "
- "patchsets of an existing gerrit review into "
- "a branches, rebase on master "
- "(skipped on conflicts or when -R is specified) "
- "and show their differences")
-
- parser.add_argument("-u", "--update", dest="update", action="store_true",
- help="Force updates from remote locations")
- parser.add_argument("-s", "--setup", dest="setup", action="store_true",
- help="Just run the repo setup commands but don't "
- "submit anything")
- parser.add_argument("-f", "--finish", dest="finish", action="store_true",
- help="Close down this branch and switch back to "
- "master on successful submission")
- parser.add_argument("-l", "--list", dest="list", action="store_true",
- help="List available reviews for the current project")
- parser.add_argument("-y", "--yes", dest="yes", action="store_true",
- help="Indicate that you do, in fact, understand if "
- "you are submitting more than one patch")
- parser.add_argument("-v", "--verbose", dest="verbose", action="store_true",
- help="Output more information about what's going on")
- parser.add_argument("--no-custom-script", dest="custom_script",
- action="store_false", default=True,
- help="Do not run custom scripts.")
- parser.add_argument("--license", dest="license", action="store_true",
- help="Print the license and exit")
- parser.add_argument("--version", action="version",
- version='%s version %s' %
- (os.path.split(sys.argv[0])[-1], version))
- parser.add_argument("branch", nargs="?")
-
- try:
- (top_dir, git_dir) = git_directories()
- except GitDirectoriesException:
- if sys.argv[1:] in ([], ['-h'], ['--help']):
- parser.print_help()
- sys.exit(1)
- raise
-
-# config = get_config(os.path.join(top_dir, ".gitreview"))
- config = DEFAULTS.copy()
- cur_proj = run_command("git remote -v")
- import re
- m = re.search('(?<=29418\/)(\S+)', cur_proj)
- config['project'] = m.group(0)
-
-
- defaultrebase = convert_bool(
- git_config_get_value("gitreview", "rebase",
- default=str(config['defaultrebase'])))
- parser.set_defaults(dry=False,
- draft=False,
- rebase=defaultrebase,
- verbose=False,
- update=False,
- setup=False,
- list=False,
- yes=False,
- branch=config['defaultbranch'],
- remote=config['defaultremote'])
- options = parser.parse_args()
-
- if options.license:
- print(COPYRIGHT)
- sys.exit(0)
-
- branch = options.branch
- global VERBOSE
- global UPDATE
- VERBOSE = options.verbose
- UPDATE = options.update
- remote = options.remote
- yes = options.yes
- status = 0
-
- needs_update = latest_is_newer()
- check_remote(branch, remote,
- config['hostname'], config['port'], config['project'])
-
- if options.no_color_support:
- _no_color_support = True
-
- if options.changeidentifier:
- if options.compare:
- compare_review(options.changeidentifier,
- branch, remote, options.rebase)
- return
- local_branch = fetch_review(options.changeidentifier, branch, remote)
- if options.download:
- checkout_review(local_branch)
- else:
- if options.cherrypickcommit:
- cherrypick_review()
- elif options.cherrypickonly:
- cherrypick_review("-n")
- if options.cherrypickindicate:
- cherrypick_review("-x")
- return
- elif options.list:
- list_reviews(remote)
- return
-
- if options.custom_script:
- run_custom_script("pre")
-
- hook_file = os.path.join(git_dir, "hooks", "commit-msg")
- have_hook = os.path.exists(hook_file) and os.access(hook_file, os.X_OK)
-
- if not have_hook:
- set_hooks_commit_msg(remote, hook_file)
-
- if options.setup:
- if options.finish and not options.dry:
- finish_branch(branch)
- return
-
- if options.rebase:
- if not rebase_changes(branch, remote):
- print_exit_message(1, needs_update)
- if not options.force_rebase and not undo_rebase():
- print_exit_message(1, needs_update)
- assert_one_change(remote, branch, yes, have_hook)
-
- ref = "publish"
-
- if options.draft:
- ref = "drafts"
- if options.custom_script:
- run_custom_script("draft")
- elif options.compatible:
- ref = "for"
-
- cmd = "git push %s HEAD:refs/%s/%s" % (remote, ref, branch)
- topic = options.topic or get_topic(branch)
- if topic != branch:
- cmd += "/%s" % topic
- if options.regenerate:
- print("Amending the commit to regenerate the change id\n")
- regenerate_cmd = "git commit --amend"
- if options.dry:
- print("\tGIT_EDITOR=\"sed -i -e '/^Change-Id:/d'\" %s\n" %
- regenerate_cmd)
- else:
- run_command(regenerate_cmd,
- GIT_EDITOR="sed -i -e "
- "'/^Change-Id:/d'")
-
- if options.dry:
- print("Please use the following command "
- "to send your commits to review:\n")
- print("\t%s\n" % cmd)
- else:
- (status, output) = run_command_status(cmd)
- print(output)
-
- if options.finish and not options.dry and status == 0:
- finish_branch(branch)
- return
-
- if options.custom_script:
- run_custom_script("post")
- print_exit_message(status, needs_update)
-
-
-if __name__ == "__main__":
- try:
- main()
- except GitReviewException as e:
- print(e)
- sys.exit(e.EXIT_CODE)
+++ /dev/null
-Windows Registry Editor Version 5.00\r
-\r
-; Registry file that maps the solarized palette to the 16 avaliable colors\r
-; in a Windows command prompt. Note, hex values in the table are RGB but byte\r
-; ordering of a DWORD is BGR, e.g. "ColorTable<##>"=dword:00<B><G><R>\r
-;\r
-; Solarized color table from http://ethanschoonover.com/solarized.\r
-;\r
-; NR cmd.exe PowerShell SOLARIZED HEX DWORD\r
-; -- ------- ----------- --------- ------- --------\r
-; 00 Black Black base03 #002b36 00362b00\r
-; 01 Blue DarkBlue base0 #839496 00969483\r
-; 02 Green DarkGreen base01 #586e75 00756e58\r
-; 03 Aqua DarkCyan base1 #93a1a1 00a1a193\r
-; 04 Red DarkRed orange #cb4b16 00164bcb\r
-; 05 Purple DarkMagenta violet #6c71c4 00c4716c\r
-; 06 Yellow DarkYellow base00 #657b83 00837b65\r
-; 07 White Gray base2 #eee8d5 00d5e8ee\r
-; 08 Gray DarkGray base02 #073642 00423607\r
-; 09 LightBlue Blue blue #268bd2 00d28b26\r
-; 10 LightGreen Green green #859900 00009985\r
-; 11 LightAqua Cyan cyan #2aa198 0098a12a\r
-; 12 LightRed Red red #dc322f 002f32dc\r
-; 13 LightPurple Magenta magenta #d33682 008236d3\r
-; 14 LightYellow Yellow yellow #b58900 000089b5\r
-; 15 BrightWhite White base3 #fdf6e3 00e3f6fd\r
-;\r
-\r
-[HKEY_CURRENT_USER\Console]\r
-"ColorTable00"=dword:00362b00\r
-"ColorTable01"=dword:00969483\r
-"ColorTable02"=dword:00756e58\r
-"ColorTable03"=dword:00a1a193\r
-"ColorTable04"=dword:00164bcb\r
-"ColorTable05"=dword:00c4716c\r
-"ColorTable06"=dword:00837b65\r
-"ColorTable07"=dword:00d5e8ee\r
-"ColorTable08"=dword:00423607\r
-"ColorTable09"=dword:00d28b26\r
-"ColorTable10"=dword:00009985\r
-"ColorTable11"=dword:0098a12a\r
-"ColorTable12"=dword:002f32dc\r
-"ColorTable13"=dword:008236d3\r
-"ColorTable14"=dword:000089b5\r
-"ColorTable15"=dword:00e3f6fd\r
-"ScreenColors"=dword:00000001\r
-"PopupColors"=dword:000000f6\r
+++ /dev/null
-; Use caps and rwin as ctrl (HHKB alike)
-Capslock::LCtrl
-RWin::RCtrl
-LWin::return
-
-; Letter a -> skandinavian å
-:*?:``a::å
-:*?:``A::Å
-
-; Letter o -> danish/norwegen ø
-:*?:``o::ø
-:*?:``O::Ø
-
-; Letter ' -> danish/norwegen æ
-:*?:``'::æ
-:*?:``"::Æ
-
-; Letter u -> swedish/finish ö
-:*?:``u::ö
-:*?:``U::Ö
-
-; Letter e -> swedish/finish ä
-:*?:``e::ä
-:*?:``E::Ä
" section: plugins {{{1
" ---------------------
silent call plug#begin('~/.cache/vim/bundle')
-"Plug 'tpope/vim-sensible'
-"Plug 'tpope/vim-ragtag'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
-"Plug 'vim-airline/vim-airline'
-"Plug 'vim-airline/vim-airline-themes'
-"Plug 'mileszs/ack.vim'
+Plug 'tpope/vim-commentary'
+Plug 'scrooloose/syntastic'
+Plug 'ctrlpvim/ctrlp.vim'
Plug 'brandonbloom/csearch.vim'
Plug 'chazy/cscope_maps'
-Plug 'majutsushi/tagbar'
-"Plug 'airblade/vim-gitgutter'
-"Plug 'Lokaltog/powerline',{'rtp': 'powerline/binding/vim/'}
-"Plug 'junegunn/fzf.vim'
-Plug 'thanthese/Tortoise-Typing'
Plug 'altercation/vim-colors-solarized'
Plug 'editorconfig/editorconfig-vim'
Plug 'vim-scripts/a.vim'
-Plug 'Shougo/unite.vim'
-Plug 'bronson/vim-trailing-whitespace'
-Plug 'junegunn/vim-easy-align'
-Plug 'kana/vim-tabpagecd'
-" Load on nothing
-Plug 'SirVer/ultisnips', { 'on': [] }
-Plug 'Valloric/YouCompleteMe', { 'on': [] }
-Plug 'heaths/vim-msbuild'
call plug#end()
" section: options {{{1
set showmatch " show matching brackets.
set sidescrolloff=5
set smartcase " case insensitive searches become sensitive with capitals
-set smarttab " sw at the start of the line, sts everywhere else
-setglobal tags=./tags;
+"set smarttab " sw at the start of the line, sts everywhere else
+"setglobal tags=./tags;
set timeoutlen=500 " leader key timeout
set ttimeoutlen=50 " make esc work faster
set visualbell
"let g:airline#extensions#tabline#enabled = 1
let g:editorconfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
-let g:editorconfig_verbose=0
+let g:editorconfig_verbose=1
set colorcolumn=80
highlight ColorColumn ctermbg=9
vnoremap <Leader>p "*p
vnoremap <Leader>P "*P
else
-"nnoremap <Leader>y "*y
-"nnoremap <Leader>p "*p
-"nnoremap <Leader>Y "+y
-"nnoremap <Leader>P "+p
-"nnoremap <Leader>y "*y
-"nnoremap <Leader>yy "*yy
-"noremap <Leader>p "*p
-"noremap <Leader>P "*P
+" nnoremap <Leader>y "*y
+" nnoremap <Leader>p "*p
+" nnoremap <Leader>Y "+y
+" nnoremap <Leader>P "+p
+" nnoremap <Leader>y "*y
+" nnoremap <Leader>yy "*yy
+" noremap <Leader>p "*p
+" noremap <Leader>P "*P
endif
if has("cscope")
+ cnoreabbrev <expr> csa
+ \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs add' : 'csa')
+ cnoreabbrev <expr> csf
+ \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs find' : 'csf')
+ cnoreabbrev <expr> csk
+ \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs kill' : 'csk')
+ cnoreabbrev <expr> csr
+ \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs reset' : 'csr')
+ cnoreabbrev <expr> css
+ \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs show' : 'css')
+ cnoreabbrev <expr> csh
+ \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs help' : 'csh')
+
nnoremap <leader>fs :cscope find s <c-r>=expand("<cword>")<cr><cr>:botright cwindow<cr>
nnoremap <leader>fg :cscope find g <c-r>=expand("<cword>")<cr><cr>:botright cwindow<cr>
nnoremap <leader>fc :cscope find c <c-r>=expand("<cword>")<cr><cr>:botright cwindow<cr>
--- /dev/null
+#!/bin/sh
+make PREFIX=$PREFIX MULTILIB=lib
+make install PREFIX=$PREFIX/apps/luajit MULTILIB=lib
--- /dev/null
+#!/bin/sh
+
+./configure \
+--prefix=$PREFIX \
+--with-features=huge \
+--with-compiledby="ejannza" \
+--enable-multibyte \
+--enable-gui=gtk2 \
+--enable-luainterp \
+--with-lua-prefix=$PREFIX --with-luajit \
+--enable-gpm \
+--enable-cscope \
+--enable-fontset \
+--enable-fail-if-missing
+
+
+make
+make install prefix=$PREFIX/apps/vim
--- /dev/null
+#!/bin/sh
+
+sudo dnf install kernel-$1
+sudo dnf install akmod-wl "kernel-devel-uname-r == $(uname -r)"
+sudo akmods
--- /dev/null
+#!/usr/bin/env perl
+
+# by entheon, do whatever the hell you want with this file
+
+print "\n";
+print "**************************\n";
+print "*XTERM 256Color Test Chart\n";
+print "**************************\n";
+print "* 16 = black\n";
+print "* 255 = white\n";
+print "*\n";
+print "* Usage:\n";
+print "* colortest -w\n";
+print "* wide display\n";
+print "*\n";
+print "* colortest -w -r\n";
+print "* wide display reversed\n";
+print "*\n";
+print "* colortest -w -s\n";
+print "* extra spaces padding\n";
+print "*\n";
+print "* colortest -w -r -s\n";
+print "* available combination\n";
+print "*\n";
+print "**************************\n";
+
+if( $ARGV[0] eq "-w" || $ARGV[1] eq "-w" || $ARGV[2] eq "-w" ) {
+ push(@arr, [( "\e[38;5;16m 16: 00/00/00", "\e[38;5;17m 17: 00/00/5f", "\e[38;5;18m 18: 00/00/87", "\e[38;5;19m 19: 00/00/af", "\e[38;5;20m 20: 00/00/d7", "\e[38;5;21m 21: 00/00/ff")] );
+ push(@arr, [( "\e[38;5;22m 22: 00/5f/00", "\e[38;5;23m 23: 00/5f/5f", "\e[38;5;24m 24: 00/5f/87", "\e[38;5;25m 25: 00/5f/af", "\e[38;5;26m 26: 00/5f/d7", "\e[38;5;27m 27: 00/5f/ff")] );
+ push(@arr, [( "\e[38;5;28m 28: 00/87/00", "\e[38;5;29m 29: 00/87/5f", "\e[38;5;30m 30: 00/87/87", "\e[38;5;31m 31: 00/87/af", "\e[38;5;32m 32: 00/87/d7", "\e[38;5;33m 33: 00/87/ff")] );
+ push(@arr, [( "\e[38;5;34m 34: 00/af/00", "\e[38;5;35m 35: 00/af/5f", "\e[38;5;36m 36: 00/af/87", "\e[38;5;37m 37: 00/af/af", "\e[38;5;38m 38: 00/af/d7", "\e[38;5;39m 39: 00/af/ff")] );
+ push(@arr, [( "\e[38;5;40m 40: 00/d7/00", "\e[38;5;41m 41: 00/d7/5f", "\e[38;5;42m 42: 00/d7/87", "\e[38;5;43m 43: 00/d7/af", "\e[38;5;44m 44: 00/d7/d7", "\e[38;5;45m 45: 00/d7/ff")] );
+ push(@arr, [( "\e[38;5;46m 46: 00/ff/00", "\e[38;5;47m 47: 00/ff/5f", "\e[38;5;48m 48: 00/ff/87", "\e[38;5;49m 49: 00/ff/af", "\e[38;5;50m 50: 00/ff/d7", "\e[38;5;51m 51: 00/ff/ff")] );
+ push(@arr, [( "\e[38;5;52m 52: 5f/00/00", "\e[38;5;53m 53: 5f/00/5f", "\e[38;5;54m 54: 5f/00/87", "\e[38;5;55m 55: 5f/00/af", "\e[38;5;56m 56: 5f/00/d7", "\e[38;5;57m 57: 5f/00/ff")] );
+ push(@arr, [( "\e[38;5;58m 58: 5f/5f/00", "\e[38;5;59m 59: 5f/5f/5f", "\e[38;5;60m 60: 5f/5f/87", "\e[38;5;61m 61: 5f/5f/af", "\e[38;5;62m 62: 5f/5f/d7", "\e[38;5;63m 63: 5f/5f/ff")] );
+ push(@arr, [( "\e[38;5;64m 64: 5f/87/00", "\e[38;5;65m 65: 5f/87/5f", "\e[38;5;66m 66: 5f/87/87", "\e[38;5;67m 67: 5f/87/af", "\e[38;5;68m 68: 5f/87/d7", "\e[38;5;69m 69: 5f/87/ff")] );
+ push(@arr, [( "\e[38;5;70m 70: 5f/af/00", "\e[38;5;71m 71: 5f/af/5f", "\e[38;5;72m 72: 5f/af/87", "\e[38;5;73m 73: 5f/af/af", "\e[38;5;74m 74: 5f/af/d7", "\e[38;5;75m 75: 5f/af/ff")] );
+ push(@arr, [( "\e[38;5;76m 76: 5f/d7/00", "\e[38;5;77m 77: 5f/d7/5f", "\e[38;5;78m 78: 5f/d7/87", "\e[38;5;79m 79: 5f/d7/af", "\e[38;5;80m 80: 5f/d7/d7", "\e[38;5;81m 81: 5f/d7/ff")] );
+ push(@arr, [( "\e[38;5;82m 82: 5f/ff/00", "\e[38;5;83m 83: 5f/ff/5f", "\e[38;5;84m 84: 5f/ff/87", "\e[38;5;85m 85: 5f/ff/af", "\e[38;5;86m 86: 5f/ff/d7", "\e[38;5;87m 87: 5f/ff/ff")] );
+ push(@arr, [( "\e[38;5;88m 88: 87/00/00", "\e[38;5;89m 89: 87/00/5f", "\e[38;5;90m 90: 87/00/87", "\e[38;5;91m 91: 87/00/af", "\e[38;5;92m 92: 87/00/d7", "\e[38;5;93m 93: 87/00/ff")] );
+ push(@arr, [( "\e[38;5;94m 94: 87/5f/00", "\e[38;5;95m 95: 87/5f/5f", "\e[38;5;96m 96: 87/5f/87", "\e[38;5;97m 97: 87/5f/af", "\e[38;5;98m 98: 87/5f/d7", "\e[38;5;99m 99: 87/5f/ff")] );
+ push(@arr, [( "\e[38;5;100m 100: 87/87/00", "\e[38;5;101m 101: 87/87/5f", "\e[38;5;102m 102: 87/87/87", "\e[38;5;103m 103: 87/87/af", "\e[38;5;104m 104: 87/87/d7", "\e[38;5;105m 105: 87/87/ff")] );
+ push(@arr, [( "\e[38;5;106m 106: 87/af/00", "\e[38;5;107m 107: 87/af/5f", "\e[38;5;108m 108: 87/af/87", "\e[38;5;109m 109: 87/af/af", "\e[38;5;110m 110: 87/af/d7", "\e[38;5;111m 111: 87/af/ff")] );
+ push(@arr, [( "\e[38;5;112m 112: 87/d7/00", "\e[38;5;113m 113: 87/d7/5f", "\e[38;5;114m 114: 87/d7/87", "\e[38;5;115m 115: 87/d7/af", "\e[38;5;116m 116: 87/d7/d7", "\e[38;5;117m 117: 87/d7/ff")] );
+ push(@arr, [( "\e[38;5;118m 118: 87/ff/00", "\e[38;5;119m 119: 87/ff/5f", "\e[38;5;120m 120: 87/ff/87", "\e[38;5;121m 121: 87/ff/af", "\e[38;5;122m 122: 87/ff/d7", "\e[38;5;123m 123: 87/ff/ff")] );
+ push(@arr, [( "\e[38;5;124m 124: af/00/00", "\e[38;5;125m 125: af/00/5f", "\e[38;5;126m 126: af/00/87", "\e[38;5;127m 127: af/00/af", "\e[38;5;128m 128: af/00/d7", "\e[38;5;129m 129: af/00/ff")] );
+ push(@arr, [( "\e[38;5;130m 130: af/5f/00", "\e[38;5;131m 131: af/5f/5f", "\e[38;5;132m 132: af/5f/87", "\e[38;5;133m 133: af/5f/af", "\e[38;5;134m 134: af/5f/d7", "\e[38;5;135m 135: af/5f/ff")] );
+ push(@arr, [( "\e[38;5;136m 136: af/87/00", "\e[38;5;137m 137: af/87/5f", "\e[38;5;138m 138: af/87/87", "\e[38;5;139m 139: af/87/af", "\e[38;5;140m 140: af/87/d7", "\e[38;5;141m 141: af/87/ff")] );
+ push(@arr, [( "\e[38;5;142m 142: af/af/00", "\e[38;5;143m 143: af/af/5f", "\e[38;5;144m 144: af/af/87", "\e[38;5;145m 145: af/af/af", "\e[38;5;146m 146: af/af/d7", "\e[38;5;147m 147: af/af/ff")] );
+ push(@arr, [( "\e[38;5;148m 148: af/d7/00", "\e[38;5;149m 149: af/d7/5f", "\e[38;5;150m 150: af/d7/87", "\e[38;5;151m 151: af/d7/af", "\e[38;5;152m 152: af/d7/d7", "\e[38;5;153m 153: af/d7/ff")] );
+ push(@arr, [( "\e[38;5;154m 154: af/ff/00", "\e[38;5;155m 155: af/ff/5f", "\e[38;5;156m 156: af/ff/87", "\e[38;5;157m 157: af/ff/af", "\e[38;5;158m 158: af/ff/d7", "\e[38;5;159m 159: af/ff/ff")] );
+ push(@arr, [( "\e[38;5;160m 160: d7/00/00", "\e[38;5;161m 161: d7/00/5f", "\e[38;5;162m 162: d7/00/87", "\e[38;5;163m 163: d7/00/af", "\e[38;5;164m 164: d7/00/d7", "\e[38;5;165m 165: d7/00/ff")] );
+ push(@arr, [( "\e[38;5;166m 166: d7/5f/00", "\e[38;5;167m 167: d7/5f/5f", "\e[38;5;168m 168: d7/5f/87", "\e[38;5;169m 169: d7/5f/af", "\e[38;5;170m 170: d7/5f/d7", "\e[38;5;171m 171: d7/5f/ff")] );
+ push(@arr, [( "\e[38;5;172m 172: d7/87/00", "\e[38;5;173m 173: d7/87/5f", "\e[38;5;174m 174: d7/87/87", "\e[38;5;175m 175: d7/87/af", "\e[38;5;176m 176: d7/87/d7", "\e[38;5;177m 177: d7/87/ff")] );
+ push(@arr, [( "\e[38;5;178m 178: d7/af/00", "\e[38;5;179m 179: d7/af/5f", "\e[38;5;180m 180: d7/af/87", "\e[38;5;181m 181: d7/af/af", "\e[38;5;182m 182: d7/af/d7", "\e[38;5;183m 183: d7/af/ff")] );
+ push(@arr, [( "\e[38;5;184m 184: d7/d7/00", "\e[38;5;185m 185: d7/d7/5f", "\e[38;5;186m 186: d7/d7/87", "\e[38;5;187m 187: d7/d7/af", "\e[38;5;188m 188: d7/d7/d7", "\e[38;5;189m 189: d7/d7/ff")] );
+ push(@arr, [( "\e[38;5;190m 190: d7/ff/00", "\e[38;5;191m 191: d7/ff/5f", "\e[38;5;192m 192: d7/ff/87", "\e[38;5;193m 193: d7/ff/af", "\e[38;5;194m 194: d7/ff/d7", "\e[38;5;195m 195: d7/ff/ff")] );
+ push(@arr, [( "\e[38;5;196m 196: ff/00/00", "\e[38;5;197m 197: ff/00/5f", "\e[38;5;198m 198: ff/00/87", "\e[38;5;199m 199: ff/00/af", "\e[38;5;200m 200: ff/00/d7", "\e[38;5;201m 201: ff/00/ff")] );
+ push(@arr, [( "\e[38;5;202m 202: ff/5f/00", "\e[38;5;203m 203: ff/5f/5f", "\e[38;5;204m 204: ff/5f/87", "\e[38;5;205m 205: ff/5f/af", "\e[38;5;206m 206: ff/5f/d7", "\e[38;5;207m 207: ff/5f/ff")] );
+ push(@arr, [( "\e[38;5;208m 208: ff/87/00", "\e[38;5;209m 209: ff/87/5f", "\e[38;5;210m 210: ff/87/87", "\e[38;5;211m 211: ff/87/af", "\e[38;5;212m 212: ff/87/d7", "\e[38;5;213m 213: ff/87/ff")] );
+ push(@arr, [( "\e[38;5;214m 214: ff/af/00", "\e[38;5;215m 215: ff/af/5f", "\e[38;5;216m 216: ff/af/87", "\e[38;5;217m 217: ff/af/af", "\e[38;5;218m 218: ff/af/d7", "\e[38;5;219m 219: ff/af/ff")] );
+ push(@arr, [( "\e[38;5;220m 220: ff/d7/00", "\e[38;5;221m 221: ff/d7/5f", "\e[38;5;222m 222: ff/d7/87", "\e[38;5;223m 223: ff/d7/af", "\e[38;5;224m 224: ff/d7/d7", "\e[38;5;225m 225: ff/d7/ff")] );
+ push(@arr, [( "\e[38;5;226m 226: ff/ff/00", "\e[38;5;227m 227: ff/ff/5f", "\e[38;5;228m 228: ff/ff/87", "\e[38;5;229m 229: ff/ff/af", "\e[38;5;230m 230: ff/ff/d7", "\e[38;5;231m 231: ff/ff/ff")] );
+ push(@arr, [( "\e[38;5;232m 232: 08/08/08", "\e[38;5;233m 233: 12/12/12", "\e[38;5;234m 234: 1c/1c/1c", "\e[38;5;235m 235: 26/26/26", "\e[38;5;236m 236: 30/30/30", "\e[38;5;237m 237: 3a/3a/3a")] );
+ push(@arr, [( "\e[38;5;238m 238: 44/44/44", "\e[38;5;239m 239: 4e/4e/4e", "\e[38;5;240m 240: 58/58/58", "\e[38;5;241m 241: 62/62/62", "\e[38;5;242m 242: 6c/6c/6c", "\e[38;5;243m 243: 76/76/76")] );
+ push(@arr, [( "\e[38;5;244m 244: 80/80/80", "\e[38;5;245m 245: 8a/8a/8a", "\e[38;5;246m 246: 94/94/94", "\e[38;5;247m 247: 9e/9e/9e", "\e[38;5;248m 248: a8/a8/a8", "\e[38;5;249m 249: b2/b2/b2")] );
+ push(@arr, [( "\e[38;5;250m 250: bc/bc/bc", "\e[38;5;251m 251: c6/c6/c6", "\e[38;5;252m 252: d0/d0/d0", "\e[38;5;253m 253: da/da/da", "\e[38;5;254m 254: e4/e4/e4", "\e[38;5;255m 255: ee/ee/ee")] );
+
+ if( $ARGV[0] eq "-s" || $ARGV[1] eq "-s" || $ARGV[2] eq "-s" ){
+ $padding = " ";
+ }
+ else {
+
+ }
+
+ # display in reverse order
+ if( $ARGV[0] eq "-r" || $ARGV[1] eq "-r" || $ARGV[2] eq "-r" ){
+ for( $dimone = 0; $dimone < scalar @arr; $dimone++ ) {
+
+ $seed = ($dimone % 6) * -1;
+ for( $dimtwo = 0; $dimtwo < 6; $dimtwo++ ) {
+
+ $movone = $seed;
+ $movtwo = $seed * -1;
+
+ print $arr[$dimone][$dimtwo] . $padding;
+
+ $seed = $seed+1;
+ }
+
+ print "\n";
+ }
+ }
+ else {
+ for( $dimone = 0; $dimone < scalar @arr; $dimone++ ) {
+
+ $seed = ($dimone % 6) * -1;
+ for( $dimtwo = 0; $dimtwo < 6; $dimtwo++ ) {
+
+ $movone = $seed;
+ $movtwo = $seed * -1;
+
+ $newone = $dimone+$movone;
+ $newtwo = $dimtwo+$movtwo;
+
+ if( $newone < scalar @arr ){
+ print $arr[$newone][$newtwo] . $padding;
+ }
+
+ $seed = $seed+1;
+ }
+
+ print "\n";
+ }
+ }
+ print "\n";
+ print "\n";
+
+}
+else {
+ print "\e[38;5;16m 16: 00/00/00\n";
+ print "\e[38;5;17m 17: 00/00/5f\n";
+ print "\e[38;5;18m 18: 00/00/87\n";
+ print "\e[38;5;19m 19: 00/00/af\n";
+ print "\e[38;5;20m 20: 00/00/d7\n";
+ print "\e[38;5;21m 21: 00/00/ff\n";
+ print "\e[38;5;22m 22: 00/5f/00\n";
+ print "\e[38;5;23m 23: 00/5f/5f\n";
+ print "\e[38;5;24m 24: 00/5f/87\n";
+ print "\e[38;5;25m 25: 00/5f/af\n";
+ print "\e[38;5;26m 26: 00/5f/d7\n";
+ print "\e[38;5;27m 27: 00/5f/ff\n";
+ print "\e[38;5;28m 28: 00/87/00\n";
+ print "\e[38;5;29m 29: 00/87/5f\n";
+ print "\e[38;5;30m 30: 00/87/87\n";
+ print "\e[38;5;31m 31: 00/87/af\n";
+ print "\e[38;5;32m 32: 00/87/d7\n";
+ print "\e[38;5;33m 33: 00/87/ff\n";
+ print "\e[38;5;34m 34: 00/af/00\n";
+ print "\e[38;5;35m 35: 00/af/5f\n";
+ print "\e[38;5;36m 36: 00/af/87\n";
+ print "\e[38;5;37m 37: 00/af/af\n";
+ print "\e[38;5;38m 38: 00/af/d7\n";
+ print "\e[38;5;39m 39: 00/af/ff\n";
+ print "\e[38;5;40m 40: 00/d7/00\n";
+ print "\e[38;5;41m 41: 00/d7/5f\n";
+ print "\e[38;5;42m 42: 00/d7/87\n";
+ print "\e[38;5;43m 43: 00/d7/af\n";
+ print "\e[38;5;44m 44: 00/d7/d7\n";
+ print "\e[38;5;45m 45: 00/d7/ff\n";
+ print "\e[38;5;46m 46: 00/ff/00\n";
+ print "\e[38;5;47m 47: 00/ff/5f\n";
+ print "\e[38;5;48m 48: 00/ff/87\n";
+ print "\e[38;5;49m 49: 00/ff/af\n";
+ print "\e[38;5;50m 50: 00/ff/d7\n";
+ print "\e[38;5;51m 51: 00/ff/ff\n";
+ print "\e[38;5;52m 52: 5f/00/00\n";
+ print "\e[38;5;53m 53: 5f/00/5f\n";
+ print "\e[38;5;54m 54: 5f/00/87\n";
+ print "\e[38;5;55m 55: 5f/00/af\n";
+ print "\e[38;5;56m 56: 5f/00/d7\n";
+ print "\e[38;5;57m 57: 5f/00/ff\n";
+ print "\e[38;5;58m 58: 5f/5f/00\n";
+ print "\e[38;5;59m 59: 5f/5f/5f\n";
+ print "\e[38;5;60m 60: 5f/5f/87\n";
+ print "\e[38;5;61m 61: 5f/5f/af\n";
+ print "\e[38;5;62m 62: 5f/5f/d7\n";
+ print "\e[38;5;63m 63: 5f/5f/ff\n";
+ print "\e[38;5;64m 64: 5f/87/00\n";
+ print "\e[38;5;65m 65: 5f/87/5f\n";
+ print "\e[38;5;66m 66: 5f/87/87\n";
+ print "\e[38;5;67m 67: 5f/87/af\n";
+ print "\e[38;5;68m 68: 5f/87/d7\n";
+ print "\e[38;5;69m 69: 5f/87/ff\n";
+ print "\e[38;5;70m 70: 5f/af/00\n";
+ print "\e[38;5;71m 71: 5f/af/5f\n";
+ print "\e[38;5;72m 72: 5f/af/87\n";
+ print "\e[38;5;73m 73: 5f/af/af\n";
+ print "\e[38;5;74m 74: 5f/af/d7\n";
+ print "\e[38;5;75m 75: 5f/af/ff\n";
+ print "\e[38;5;76m 76: 5f/d7/00\n";
+ print "\e[38;5;77m 77: 5f/d7/5f\n";
+ print "\e[38;5;78m 78: 5f/d7/87\n";
+ print "\e[38;5;79m 79: 5f/d7/af\n";
+ print "\e[38;5;80m 80: 5f/d7/d7\n";
+ print "\e[38;5;81m 81: 5f/d7/ff\n";
+ print "\e[38;5;82m 82: 5f/ff/00\n";
+ print "\e[38;5;83m 83: 5f/ff/5f\n";
+ print "\e[38;5;84m 84: 5f/ff/87\n";
+ print "\e[38;5;85m 85: 5f/ff/af\n";
+ print "\e[38;5;86m 86: 5f/ff/d7\n";
+ print "\e[38;5;87m 87: 5f/ff/ff\n";
+ print "\e[38;5;88m 88: 87/00/00\n";
+ print "\e[38;5;89m 89: 87/00/5f\n";
+ print "\e[38;5;90m 90: 87/00/87\n";
+ print "\e[38;5;91m 91: 87/00/af\n";
+ print "\e[38;5;92m 92: 87/00/d7\n";
+ print "\e[38;5;93m 93: 87/00/ff\n";
+ print "\e[38;5;94m 94: 87/5f/00\n";
+ print "\e[38;5;95m 95: 87/5f/5f\n";
+ print "\e[38;5;96m 96: 87/5f/87\n";
+ print "\e[38;5;97m 97: 87/5f/af\n";
+ print "\e[38;5;98m 98: 87/5f/d7\n";
+ print "\e[38;5;99m 99: 87/5f/ff\n";
+ print "\e[38;5;100m 100 :87/87/00\n";
+ print "\e[38;5;101m 101 :87/87/5f\n";
+ print "\e[38;5;102m 102 :87/87/87\n";
+ print "\e[38;5;103m 103 :87/87/af\n";
+ print "\e[38;5;104m 104 :87/87/d7\n";
+ print "\e[38;5;105m 105 :87/87/ff\n";
+ print "\e[38;5;106m 106 :87/af/00\n";
+ print "\e[38;5;107m 107 :87/af/5f\n";
+ print "\e[38;5;108m 108 :87/af/87\n";
+ print "\e[38;5;109m 109 :87/af/af\n";
+ print "\e[38;5;110m 110 :87/af/d7\n";
+ print "\e[38;5;111m 111 :87/af/ff\n";
+ print "\e[38;5;112m 112 :87/d7/00\n";
+ print "\e[38;5;113m 113 :87/d7/5f\n";
+ print "\e[38;5;114m 114 :87/d7/87\n";
+ print "\e[38;5;115m 115 :87/d7/af\n";
+ print "\e[38;5;116m 116 :87/d7/d7\n";
+ print "\e[38;5;117m 117 :87/d7/ff\n";
+ print "\e[38;5;118m 118 :87/ff/00\n";
+ print "\e[38;5;119m 119 :87/ff/5f\n";
+ print "\e[38;5;120m 120 :87/ff/87\n";
+ print "\e[38;5;121m 121 :87/ff/af\n";
+ print "\e[38;5;122m 122 :87/ff/d7\n";
+ print "\e[38;5;123m 123 :87/ff/ff\n";
+ print "\e[38;5;124m 124 :af/00/00\n";
+ print "\e[38;5;125m 125 :af/00/5f\n";
+ print "\e[38;5;126m 126 :af/00/87\n";
+ print "\e[38;5;127m 127 :af/00/af\n";
+ print "\e[38;5;128m 128 :af/00/d7\n";
+ print "\e[38;5;129m 129 :af/00/ff\n";
+ print "\e[38;5;130m 130 :af/5f/00\n";
+ print "\e[38;5;131m 131 :af/5f/5f\n";
+ print "\e[38;5;132m 132 :af/5f/87\n";
+ print "\e[38;5;133m 133 :af/5f/af\n";
+ print "\e[38;5;134m 134 :af/5f/d7\n";
+ print "\e[38;5;135m 135 :af/5f/ff\n";
+ print "\e[38;5;136m 136 :af/87/00\n";
+ print "\e[38;5;137m 137 :af/87/5f\n";
+ print "\e[38;5;138m 138 :af/87/87\n";
+ print "\e[38;5;139m 139 :af/87/af\n";
+ print "\e[38;5;140m 140 :af/87/d7\n";
+ print "\e[38;5;141m 141 :af/87/ff\n";
+ print "\e[38;5;142m 142 :af/af/00\n";
+ print "\e[38;5;143m 143 :af/af/5f\n";
+ print "\e[38;5;144m 144 :af/af/87\n";
+ print "\e[38;5;145m 145 :af/af/af\n";
+ print "\e[38;5;146m 146 :af/af/d7\n";
+ print "\e[38;5;147m 147 :af/af/ff\n";
+ print "\e[38;5;148m 148 :af/d7/00\n";
+ print "\e[38;5;149m 149 :af/d7/5f\n";
+ print "\e[38;5;150m 150 :af/d7/87\n";
+ print "\e[38;5;151m 151 :af/d7/af\n";
+ print "\e[38;5;152m 152 :af/d7/d7\n";
+ print "\e[38;5;153m 153 :af/d7/ff\n";
+ print "\e[38;5;154m 154 :af/ff/00\n";
+ print "\e[38;5;155m 155 :af/ff/5f\n";
+ print "\e[38;5;156m 156 :af/ff/87\n";
+ print "\e[38;5;157m 157 :af/ff/af\n";
+ print "\e[38;5;158m 158 :af/ff/d7\n";
+ print "\e[38;5;159m 159 :af/ff/ff\n";
+ print "\e[38;5;160m 160 :d7/00/00\n";
+ print "\e[38;5;161m 161 :d7/00/5f\n";
+ print "\e[38;5;162m 162 :d7/00/87\n";
+ print "\e[38;5;163m 163 :d7/00/af\n";
+ print "\e[38;5;164m 164 :d7/00/d7\n";
+ print "\e[38;5;165m 165 :d7/00/ff\n";
+ print "\e[38;5;166m 166 :d7/5f/00\n";
+ print "\e[38;5;167m 167 :d7/5f/5f\n";
+ print "\e[38;5;168m 168 :d7/5f/87\n";
+ print "\e[38;5;169m 169 :d7/5f/af\n";
+ print "\e[38;5;170m 170 :d7/5f/d7\n";
+ print "\e[38;5;171m 171 :d7/5f/ff\n";
+ print "\e[38;5;172m 172 :d7/87/00\n";
+ print "\e[38;5;173m 173 :d7/87/5f\n";
+ print "\e[38;5;174m 174 :d7/87/87\n";
+ print "\e[38;5;175m 175 :d7/87/af\n";
+ print "\e[38;5;176m 176 :d7/87/d7\n";
+ print "\e[38;5;177m 177 :d7/87/ff\n";
+ print "\e[38;5;178m 178 :d7/af/00\n";
+ print "\e[38;5;179m 179 :d7/af/5f\n";
+ print "\e[38;5;180m 180 :d7/af/87\n";
+ print "\e[38;5;181m 181 :d7/af/af\n";
+ print "\e[38;5;182m 182 :d7/af/d7\n";
+ print "\e[38;5;183m 183 :d7/af/ff\n";
+ print "\e[38;5;184m 184 :d7/d7/00\n";
+ print "\e[38;5;185m 185 :d7/d7/5f\n";
+ print "\e[38;5;186m 186 :d7/d7/87\n";
+ print "\e[38;5;187m 187 :d7/d7/af\n";
+ print "\e[38;5;188m 188 :d7/d7/d7\n";
+ print "\e[38;5;189m 189 :d7/d7/ff\n";
+ print "\e[38;5;190m 190 :d7/ff/00\n";
+ print "\e[38;5;191m 191 :d7/ff/5f\n";
+ print "\e[38;5;192m 192 :d7/ff/87\n";
+ print "\e[38;5;193m 193 :d7/ff/af\n";
+ print "\e[38;5;194m 194 :d7/ff/d7\n";
+ print "\e[38;5;195m 195 :d7/ff/ff\n";
+ print "\e[38;5;196m 196 :ff/00/00\n";
+ print "\e[38;5;197m 197 :ff/00/5f\n";
+ print "\e[38;5;198m 198 :ff/00/87\n";
+ print "\e[38;5;199m 199 :ff/00/af\n";
+ print "\e[38;5;200m 200 :ff/00/d7\n";
+ print "\e[38;5;201m 201 :ff/00/ff\n";
+ print "\e[38;5;202m 202 :ff/5f/00\n";
+ print "\e[38;5;203m 203 :ff/5f/5f\n";
+ print "\e[38;5;204m 204 :ff/5f/87\n";
+ print "\e[38;5;205m 205 :ff/5f/af\n";
+ print "\e[38;5;206m 206 :ff/5f/d7\n";
+ print "\e[38;5;207m 207 :ff/5f/ff\n";
+ print "\e[38;5;208m 208 :ff/87/00\n";
+ print "\e[38;5;209m 209 :ff/87/5f\n";
+ print "\e[38;5;210m 210 :ff/87/87\n";
+ print "\e[38;5;211m 211 :ff/87/af\n";
+ print "\e[38;5;212m 212 :ff/87/d7\n";
+ print "\e[38;5;213m 213 :ff/87/ff\n";
+ print "\e[38;5;214m 214 :ff/af/00\n";
+ print "\e[38;5;215m 215 :ff/af/5f\n";
+ print "\e[38;5;216m 216 :ff/af/87\n";
+ print "\e[38;5;217m 217 :ff/af/af\n";
+ print "\e[38;5;218m 218 :ff/af/d7\n";
+ print "\e[38;5;219m 219 :ff/af/ff\n";
+ print "\e[38;5;220m 220 :ff/d7/00\n";
+ print "\e[38;5;221m 221 :ff/d7/5f\n";
+ print "\e[38;5;222m 222 :ff/d7/87\n";
+ print "\e[38;5;223m 223 :ff/d7/af\n";
+ print "\e[38;5;224m 224 :ff/d7/d7\n";
+ print "\e[38;5;225m 225 :ff/d7/ff\n";
+ print "\e[38;5;226m 226 :ff/ff/00\n";
+ print "\e[38;5;227m 227 :ff/ff/5f\n";
+ print "\e[38;5;228m 228 :ff/ff/87\n";
+ print "\e[38;5;229m 229 :ff/ff/af\n";
+ print "\e[38;5;230m 230 :ff/ff/d7\n";
+ print "\e[38;5;231m 231 :ff/ff/ff\n";
+ print "\e[38;5;232m 232 :08/08/08\n";
+ print "\e[38;5;233m 233 :12/12/12\n";
+ print "\e[38;5;234m 234 :1c/1c/1c\n";
+ print "\e[38;5;235m 235 :26/26/26\n";
+ print "\e[38;5;236m 236 :30/30/30\n";
+ print "\e[38;5;237m 237 :3a/3a/3a\n";
+ print "\e[38;5;238m 238 :44/44/44\n";
+ print "\e[38;5;239m 239 :4e/4e/4e\n";
+ print "\e[38;5;240m 240 :58/58/58\n";
+ print "\e[38;5;241m 241 :62/62/62\n";
+ print "\e[38;5;242m 242 :6c/6c/6c\n";
+ print "\e[38;5;243m 243 :76/76/76\n";
+ print "\e[38;5;244m 244 :80/80/80\n";
+ print "\e[38;5;245m 245 :8a/8a/8a\n";
+ print "\e[38;5;246m 246 :94/94/94\n";
+ print "\e[38;5;247m 247 :9e/9e/9e\n";
+ print "\e[38;5;248m 248 :a8/a8/a8\n";
+ print "\e[38;5;249m 249 :b2/b2/b2\n";
+ print "\e[38;5;250m 250 :bc/bc/bc\n";
+ print "\e[38;5;251m 251 :c6/c6/c6\n";
+ print "\e[38;5;252m 252 :d0/d0/d0\n";
+ print "\e[38;5;253m 253 :da/da/da\n";
+ print "\e[38;5;254m 254 :e4/e4/e4\n";
+ print "\e[38;5;255m 255 :ee/ee/ee\n";
+ print "\n";
+ print "\n";
+}
+print "\e0m";
+exit;
--- /dev/null
+#!/bin/sh
+# Copyright 2010 - 2012, Tim Henigan <tim.henigan@gmail.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# Perform a directory diff between commits in the repository using
+# the external diff or merge tool specified in the user's config.
+
+USAGE='[--cached] [--copy-back] [-x|--extcmd=<command>] <commit>{0,2} [-- <path>*]
+
+ --cached Compare to the index rather than the working tree.
+
+ --copy-back Copy files back to the working tree when the diff
+ tool exits (in case they were modified by the
+ user). This option is only valid if the diff
+ compared with the working tree.
+
+ -x=<command>
+ --extcmd=<command> Specify a custom command for viewing diffs.
+ git-diffall ignores the configured defaults and
+ runs $command $LOCAL $REMOTE when this option is
+ specified. Additionally, $BASE is set in the
+ environment.
+'
+
+SUBDIRECTORY_OK=1
+. "$(git --exec-path)/git-sh-setup"
+
+TOOL_MODE=diff
+. "$(git --exec-path)/git-mergetool--lib"
+
+merge_tool="$(get_merge_tool)"
+if test -z "$merge_tool"
+then
+ echo "Error: Either the 'diff.tool' or 'merge.tool' option must be set."
+ usage
+fi
+
+start_dir=$(pwd)
+
+# All the file paths returned by the diff command are relative to the root
+# of the working copy. So if the script is called from a subdirectory, it
+# must switch to the root of working copy before trying to use those paths.
+cdup=$(git rev-parse --show-cdup) &&
+cd "$cdup" || {
+ echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree"
+ exit 1
+}
+
+# set up temp dir
+tmp=$(perl -e 'use File::Temp qw(tempdir);
+ $t=tempdir("/tmp/git-diffall.XXXXX") or exit(1);
+ print $t') || exit 1
+#trap 'rm -rf "$tmp"' EXIT
+
+left=
+right=
+paths=
+dashdash_seen=
+compare_staged=
+merge_base=
+left_dir=
+right_dir=
+diff_tool=
+copy_back=
+
+while test $# != 0
+do
+ case "$1" in
+ -h|--h|--he|--hel|--help)
+ usage
+ ;;
+ --cached)
+ compare_staged=1
+ ;;
+ --copy-back)
+ copy_back=1
+ ;;
+ -x|--e|--ex|--ext|--extc|--extcm|--extcmd)
+ if test $# = 1
+ then
+ echo You must specify the tool for use with --extcmd
+ usage
+ else
+ diff_tool=$2
+ shift
+ fi
+ ;;
+ --)
+ dashdash_seen=1
+ ;;
+ -*)
+ echo Invalid option: "$1"
+ usage
+ ;;
+ *)
+ # could be commit, commit range or path limiter
+ case "$1" in
+ *...*)
+ left=${1%...*}
+ right=${1#*...}
+ merge_base=1
+ ;;
+ *..*)
+ left=${1%..*}
+ right=${1#*..}
+ ;;
+ *)
+ if test -n "$dashdash_seen"
+ then
+ paths="$paths$1 "
+ elif test -z "$left"
+ then
+ left=$1
+ elif test -z "$right"
+ then
+ right=$1
+ else
+ paths="$paths$1 "
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ shift
+done
+
+# Determine the set of files which changed
+if test -n "$left" && test -n "$right"
+then
+ left_dir="cmt-$(git rev-parse --short $left)"
+ right_dir="cmt-$(git rev-parse --short $right)"
+
+ if test -n "$compare_staged"
+ then
+ usage
+ elif test -n "$merge_base"
+ then
+ git diff --name-only "$left"..."$right" -- $paths >"$tmp/filelist"
+ else
+ git diff --name-only "$left" "$right" -- $paths >"$tmp/filelist"
+ fi
+elif test -n "$left"
+then
+ left_dir="cmt-$(git rev-parse --short $left)"
+
+ if test -n "$compare_staged"
+ then
+ right_dir="staged"
+ git diff --name-only --cached "$left" -- $paths >"$tmp/filelist"
+ else
+ right_dir="working_tree"
+ git diff --name-only "$left" -- $paths >"$tmp/filelist"
+ fi
+else
+ left_dir="HEAD"
+
+ if test -n "$compare_staged"
+ then
+ right_dir="staged"
+ git diff --name-only --cached -- $paths >"$tmp/filelist"
+ else
+ right_dir="working_tree"
+ git diff --name-only -- $paths >"$tmp/filelist"
+ fi
+fi
+
+# Exit immediately if there are no diffs
+if test ! -s "$tmp/filelist"
+then
+ exit 0
+fi
+
+if test -n "$copy_back" && test "$right_dir" != "working_tree"
+then
+ echo "--copy-back is only valid when diff includes the working tree."
+ exit 1
+fi
+
+# Create the named tmp directories that will hold the files to be compared
+mkdir -p "$tmp/$left_dir" "$tmp/$right_dir"
+
+# Populate the tmp/right_dir directory with the files to be compared
+while read name
+do
+ if test -n "$right"
+ then
+ ls_list=$(git ls-tree $right "$name")
+ if test -n "$ls_list"
+ then
+ mkdir -p "$tmp/$right_dir/$(dirname "$name")"
+ git show "$right":"$name" >"$tmp/$right_dir/$name" || true
+ fi
+ elif test -n "$compare_staged"
+ then
+ ls_list=$(git ls-files -- "$name")
+ if test -n "$ls_list"
+ then
+ mkdir -p "$tmp/$right_dir/$(dirname "$name")"
+ git show :"$name" >"$tmp/$right_dir/$name"
+ fi
+ else
+ if test -e "$name"
+ then
+ mkdir -p "$tmp/$right_dir/$(dirname "$name")"
+ cp "$name" "$tmp/$right_dir/$name"
+ fi
+ fi
+done < "$tmp/filelist"
+
+# Populate the tmp/left_dir directory with the files to be compared
+while read name
+do
+ if test -n "$left"
+ then
+ ls_list=$(git ls-tree $left "$name")
+ if test -n "$ls_list"
+ then
+ mkdir -p "$tmp/$left_dir/$(dirname "$name")"
+ git show "$left":"$name" >"$tmp/$left_dir/$name" || true
+ fi
+ else
+ if test -n "$compare_staged"
+ then
+ ls_list=$(git ls-tree HEAD "$name")
+ if test -n "$ls_list"
+ then
+ mkdir -p "$tmp/$left_dir/$(dirname "$name")"
+ git show HEAD:"$name" >"$tmp/$left_dir/$name"
+ fi
+ else
+ mkdir -p "$tmp/$left_dir/$(dirname "$name")"
+ git show :"$name" >"$tmp/$left_dir/$name"
+ fi
+ fi
+done < "$tmp/filelist"
+
+LOCAL="$tmp/$left_dir"
+REMOTE="$tmp/$right_dir"
+
+if test -n "$diff_tool"
+then
+ export BASE
+ eval $diff_tool '"$LOCAL"' '"$REMOTE"'
+else
+ run_merge_tool "$merge_tool" false
+fi
+
+# Copy files back to the working dir, if requested
+if test -n "$copy_back" && test "$right_dir" = "working_tree"
+then
+ cd "$start_dir"
+ git_top_dir=$(git rev-parse --show-toplevel)
+ find "$tmp/$right_dir" -type f |
+ while read file
+ do
+ cp "$file" "$git_top_dir/${file#$tmp/$right_dir/}"
+ done
+fi
\ No newline at end of file
--- /dev/null
+TOOL=vimdiff
+ARG=$@
+$TOOL $ARG
--- /dev/null
+#!/bin/bash
+TOOL=vim
+ARG=$@
+$TOOL $ARG
--- /dev/null
+#! /bin/bash
+TOOL=vimdiff
+ARG=$@
+$TOOL $ARG
--- /dev/null
+#!/usr/bin/env python
+from __future__ import print_function
+
+COPYRIGHT = """\
+Copyright (C) 2011-2012 OpenStack LLC.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied.
+
+See the License for the specific language governing permissions and
+limitations under the License."""
+
+import datetime
+import json
+import os
+import re
+import shlex
+import subprocess
+import sys
+import time
+
+if sys.version < '3':
+ import ConfigParser
+ import urllib
+ import urlparse
+ urlopen = urllib.urlopen
+ urlparse = urlparse.urlparse
+ do_input = raw_input
+else:
+ import configparser as ConfigParser
+ import urllib.parse
+ import urllib.request
+ urlopen = urllib.request.urlopen
+ urlparse = urllib.parse.urlparse
+ do_input = input
+
+from distutils import version as du_version
+
+version = "1.22"
+
+VERBOSE = False
+UPDATE = False
+CONFIGDIR = os.path.expanduser("~/.config/git-review")
+GLOBAL_CONFIG = "/etc/git-review/git-review.conf"
+USER_CONFIG = os.path.join(CONFIGDIR, "git-review.conf")
+PYPI_URL = "http://pypi.python.org/pypi/git-review/json"
+PYPI_CACHE_TIME = 60 * 60 * 24 # 24 hours
+DEFAULTS = dict(hostname='gerrit.lud.stericsson.com', port='29418', project=False,
+ defaultbranch='master', defaultremote="gerrit",
+ defaultrebase="0")
+
+_branch_name = None
+_has_color = None
+_no_color_support = False
+
+
+class colors:
+ yellow = '\033[33m'
+ green = '\033[92m'
+ reset = '\033[0m'
+
+
+class GitReviewException(Exception):
+ pass
+
+
+class CommandFailed(GitReviewException):
+
+ def __init__(self, *args):
+ Exception.__init__(self, *args)
+ (self.rc, self.output, self.argv, self.envp) = args
+ self.quickmsg = dict([
+ ("argv", " ".join(self.argv)),
+ ("rc", self.rc),
+ ("output", self.output)])
+
+ def __str__(self):
+ return self.__doc__ + """
+The following command failed with exit code %(rc)d
+ "%(argv)s"
+-----------------------
+%(output)s
+-----------------------""" % self.quickmsg
+
+
+class ChangeSetException(GitReviewException):
+
+ def __init__(self, e):
+ GitReviewException.__init__(self)
+ self.e = str(e)
+
+ def __str__(self):
+ return self.__doc__ % self.e
+
+
+def parse_review_number(review):
+ parts = review.split(',')
+ if len(parts) < 2:
+ parts.append(None)
+ return parts
+
+
+def build_review_number(review, patchset):
+ if patchset is not None:
+ return '%s,%s' % (review, patchset)
+ return review
+
+
+def run_command_status(*argv, **env):
+ if VERBOSE:
+ print(datetime.datetime.now(), "Running:", " ".join(argv))
+ if len(argv) == 1:
+ argv = shlex.split(str(argv[0]))
+ newenv = os.environ
+ newenv.update(env)
+ p = subprocess.Popen(argv, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT, env=newenv)
+ (out, nothing) = p.communicate()
+ out = out.decode('utf-8')
+ return (p.returncode, out.strip())
+
+
+def run_command(*argv, **env):
+ (rc, output) = run_command_status(*argv, **env)
+ return output
+
+
+def run_command_exc(klazz, *argv, **env):
+ """Run command *argv, on failure raise 'klazz
+
+ klass should be derived from CommandFailed
+ """
+ (rc, output) = run_command_status(*argv, **env)
+ if rc != 0:
+ raise klazz(rc, output, argv, env)
+ return output
+
+
+def update_latest_version(version_file_path):
+ """Cache the latest version of git-review for the upgrade check."""
+
+ if not os.path.exists(CONFIGDIR):
+ os.makedirs(CONFIGDIR)
+
+ if os.path.exists(version_file_path) and not UPDATE:
+ if (time.time() - os.path.getmtime(version_file_path)) < 28800:
+ return
+
+ latest_version = version
+ try:
+ latest_version = json.load(urlopen(PYPI_URL))['info']['version']
+ except Exception:
+ pass
+
+ with open(version_file_path, "w") as version_file:
+ version_file.write(latest_version)
+
+
+def latest_is_newer():
+ """Check if there is a new version of git-review."""
+
+ # Skip version check if distro package turns it off
+ if os.path.exists(GLOBAL_CONFIG):
+ config = dict(check=False)
+ configParser = ConfigParser.ConfigParser(config)
+ configParser.read(GLOBAL_CONFIG)
+ if not configParser.getboolean("updates", "check"):
+ return False
+
+ version_file_path = os.path.join(CONFIGDIR, "latest-version")
+ update_latest_version(version_file_path)
+
+ latest_version = None
+ with open(version_file_path, "r") as version_file:
+ latest_version = du_version.StrictVersion(version_file.read())
+ if latest_version > du_version.StrictVersion(version):
+ return True
+ return False
+
+
+def git_directories():
+ """Determine (absolute git work directory path, .git subdirectory path)."""
+ cmd = ("git", "rev-parse", "--show-toplevel", "--git-dir")
+ out = run_command_exc(GitDirectoriesException, *cmd)
+ try:
+ return out.split()
+ except ValueError:
+ raise GitDirectoriesException(0, out, cmd, {})
+
+
+class GitDirectoriesException(CommandFailed):
+ "Cannot determine where .git directory is."
+ EXIT_CODE = 70
+
+
+class CustomScriptException(CommandFailed):
+ """Custom script execution failed."""
+ EXIT_CODE = 71
+
+
+def run_custom_script(action):
+ """Get status and output of .git/hooks/$action-review or/and
+ ~/.config/hooks/$action-review if existing.
+ """
+ returns = []
+ script_file = "%s-review" % (action)
+ (top_dir, git_dir) = git_directories()
+ paths = [os.path.join(CONFIGDIR, "hooks", script_file),
+ os.path.join(git_dir, "hooks", script_file)]
+ for fpath in paths:
+ if os.path.isfile(fpath) and os.access(fpath, os.X_OK):
+ status, output = run_command_status(fpath)
+ returns.append((status, output, fpath))
+
+ for (status, output, path) in returns:
+ if status is not None and status != 0:
+ raise CustomScriptException(status, output, [path], {})
+ elif output and VERBOSE:
+ print("script %s output is:" % (path))
+ print(output)
+
+
+def git_config_get_value(section, option, default=None):
+ try:
+ return run_command_exc(GitConfigException,
+ "git", "config",
+ "--get",
+ "%s.%s" % (section, option)).strip()
+ except GitConfigException as exc:
+ if exc.rc == 1:
+ return default
+ raise
+
+
+class GitConfigException(CommandFailed):
+ """Git config value retrieval failed."""
+ EXIT_CODE = 128
+
+
+class CannotInstallHook(CommandFailed):
+ "Problems encountered installing commit-msg hook"
+ EXIT_CODE = 2
+
+
+def set_hooks_commit_msg(remote, target_file):
+ """Install the commit message hook if needed."""
+
+ # Create the hooks directory if it's not there already
+ hooks_dir = os.path.dirname(target_file)
+ if not os.path.isdir(hooks_dir):
+ os.mkdir(hooks_dir)
+
+ (hostname, username, port, project_name) = \
+ parse_git_show(remote, "Push")
+
+ if not os.path.exists(target_file) or UPDATE:
+ if VERBOSE:
+ print("Fetching commit hook from: scp://%s:%s" % (hostname, port))
+ if port is not None:
+ port = "-P %s" % port
+ else:
+ port = ""
+ if username is None:
+ userhost = hostname
+ else:
+ userhost = "%s@%s" % (username, hostname)
+ run_command_exc(
+ CannotInstallHook,
+ "scp", port,
+ userhost + ":hooks/commit-msg",
+ target_file)
+
+ if not os.access(target_file, os.X_OK):
+ os.chmod(target_file, os.path.stat.S_IREAD | os.path.stat.S_IEXEC)
+
+
+def test_remote(username, hostname, port, project):
+ """Tests that a possible gerrit remote works."""
+
+ if port is not None:
+ port = "-p %s" % port
+ else:
+ port = ""
+ if username is None:
+ userhost = hostname
+ else:
+ userhost = "%s@%s" % (username, hostname)
+
+ (status, ssh_output) = run_command_status(
+ "ssh", "-x", port, userhost,
+ "gerrit", "ls-projects")
+
+ if status == 0:
+ if VERBOSE:
+ print("%s@%s:%s worked." % (username, hostname, port))
+ return True
+ else:
+ if VERBOSE:
+ print("%s@%s:%s did not work." % (username, hostname, port))
+ return False
+
+
+def make_remote_url(username, hostname, port, project):
+ """Builds a gerrit remote URL."""
+ if username is None:
+ return "ssh://%s:%s/%s" % (hostname, port, project)
+ else:
+ return "ssh://%s@%s:%s/%s" % (username, hostname, port, project)
+
+
+def add_remote(hostname, port, project, remote):
+ """Adds a gerrit remote."""
+ asked_for_username = False
+
+ username = os.getenv("USERNAME")
+ if not username:
+ username = git_config_get_value("gitreview", "username")
+ if not username:
+ username = os.getenv("USER")
+ if port is None:
+ port = 29418
+
+ remote_url = make_remote_url(username, hostname, port, project)
+ if VERBOSE:
+ print("No remote set, testing %s" % remote_url)
+ if not test_remote(username, hostname, port, project):
+ print("Could not connect to gerrit.")
+ username = do_input("Enter your gerrit username: ")
+ remote_url = make_remote_url(username, hostname, port, project)
+ print("Trying again with %s" % remote_url)
+ if not test_remote(username, hostname, port, project):
+ raise Exception("Could not connect to gerrit at %s" % remote_url)
+ asked_for_username = True
+
+ print("Creating a git remote called \"%s\" that maps to:" % remote)
+ print("\t%s" % remote_url)
+ cmd = "git remote add -f %s %s" % (remote, remote_url)
+ (status, remote_output) = run_command_status(cmd)
+
+ if status != 0:
+ raise Exception("Error running %s" % cmd)
+
+ if asked_for_username:
+ print()
+ print("This repository is now set up for use with git-review.")
+ print("You can set the default username for future repositories with:")
+ print(' git config --global --add gitreview.username "%s"' % username)
+ print()
+
+
+def parse_git_show(remote, verb):
+ fetch_url = ""
+ for line in run_command("git remote show -n %s" % remote).split("\n"):
+ if line.strip().startswith("%s" % verb):
+ fetch_url = line.split()[2]
+
+ parsed_url = urlparse(fetch_url)
+ project_name = parsed_url.path.lstrip("/")
+ if project_name.endswith(".git"):
+ project_name = project_name[:-4]
+
+ hostname = parsed_url.netloc
+ username = None
+ port = parsed_url.port
+
+ if VERBOSE:
+ print("Found origin %s URL:" % verb, fetch_url)
+
+ # Workaround bug in urlparse on OSX
+ if parsed_url.scheme == "ssh" and parsed_url.path[:2] == "//":
+ hostname = parsed_url.path[2:].split("/")[0]
+
+ if "@" in hostname:
+ (username, hostname) = hostname.split("@")
+ if ":" in hostname:
+ (hostname, port) = hostname.split(":")
+
+ # Is origin an ssh location? Let's pull more info
+ if parsed_url.scheme == "ssh" and port is None:
+ port = 22
+
+ return (hostname, username, str(port), project_name)
+
+
+def check_color_support():
+ global _has_color
+ global _no_color_support
+ if _has_color is None:
+ test_command = "git log --color=never --oneline HEAD^1..HEAD"
+ (status, output) = run_command_status(test_command)
+ if status == 0:
+ _has_color = True
+ else:
+ _has_color = False
+
+ if _no_color_support:
+ _has_color = False
+
+ return _has_color
+
+
+def get_config(config_file=None):
+ """Generate the configuration map by starting with some built-in defaults
+ and then loading GLOBAL_CONFIG, USER_CONFIG, and a repository-specific
+ .gitreview file, if they exist. In case of conflict, the configuration file
+ with the narrowest scope wins.
+ """
+ config = DEFAULTS.copy()
+ for filename in (GLOBAL_CONFIG, USER_CONFIG, config_file):
+ if filename is not None and os.path.exists(filename):
+ config.update(load_config_file(filename))
+ return config
+
+
+def load_config_file(config_file):
+ """Load configuration options from a file."""
+ configParser = ConfigParser.ConfigParser()
+ configParser.read(config_file)
+ options = {
+ 'hostname': 'host',
+ 'port': 'port',
+ 'project': 'project',
+ 'defaultbranch': 'defaultbranch',
+ 'defaultremote': 'defaultremote',
+ 'defaultrebase': 'defaultrebase',
+ }
+ config = {}
+ for config_key, option_name in options.items():
+ if configParser.has_option('gerrit', option_name):
+ config[config_key] = configParser.get('gerrit', option_name)
+ return config
+
+
+def update_remote(remote):
+ cmd = "git remote update %s" % remote
+ (status, output) = run_command_status(cmd)
+ if VERBOSE:
+ print(output)
+ if status != 0:
+ print("Problem running '%s'" % cmd)
+ if not VERBOSE:
+ print(output)
+ return False
+ return True
+
+
+def check_remote(branch, remote, hostname, port, project):
+ """Check that a Gerrit Git remote repo exists, if not, set one."""
+
+ has_color = check_color_support()
+ if has_color:
+ color_never = "--color=never"
+ else:
+ color_never = ""
+
+ if remote in run_command("git remote").split("\n"):
+
+ remotes = run_command("git branch -a %s" % color_never).split("\n")
+ for current_remote in remotes:
+ if (current_remote.strip() == "remotes/%s/%s" % (remote, branch)
+ and not UPDATE):
+ return
+ # We have the remote, but aren't set up to fetch. Fix it
+ if VERBOSE:
+ print("Setting up gerrit branch tracking for better rebasing")
+ update_remote(remote)
+ return
+
+ if hostname is False or port is False or project is False:
+ # This means there was no .gitreview file
+ print("No '.gitreview' file found in this repository.")
+ print("We don't know where your gerrit is. Please manually create ")
+ print("a remote named \"%s\" and try again." % remote)
+ sys.exit(1)
+
+ # Gerrit remote not present, try to add it
+ try:
+ add_remote(hostname, port, project, remote)
+ except Exception:
+ print(sys.exc_info()[2])
+ print("We don't know where your gerrit is. Please manually create ")
+ print("a remote named \"%s\" and try again." % remote)
+ raise
+
+
+def rebase_changes(branch, remote, interactive=True):
+
+ remote_branch = "remotes/%s/%s" % (remote, branch)
+
+ if not update_remote(remote):
+ return False
+
+ if interactive:
+ cmd = "git rebase -i %s" % remote_branch
+ else:
+ cmd = "git rebase %s" % remote_branch
+
+ (status, output) = run_command_status(cmd, GIT_EDITOR='true')
+ if status != 0:
+ print("Errors running %s" % cmd)
+ if interactive:
+ print(output)
+ return False
+ return True
+
+
+def undo_rebase():
+ cmd = "git reset --hard ORIG_HEAD"
+ (status, output) = run_command_status(cmd)
+ if status != 0:
+ print("Errors running %s" % cmd)
+ print(output)
+ return False
+ return True
+
+
+def get_branch_name(target_branch):
+ global _branch_name
+ if _branch_name is not None:
+ return _branch_name
+ _branch_name = None
+ has_color = check_color_support()
+ if has_color:
+ color_never = "--color=never"
+ else:
+ color_never = ""
+ for branch in run_command("git branch %s" % color_never).split("\n"):
+ if branch.startswith('*'):
+ _branch_name = branch.split()[1].strip()
+ if _branch_name == "(no":
+ _branch_name = target_branch
+ return _branch_name
+
+
+def assert_one_change(remote, branch, yes, have_hook):
+ has_color = check_color_support()
+ if has_color:
+ color = git_config_get_value("color", "ui")
+ if color is None:
+ color = "auto"
+ else:
+ color = color.lower()
+ if (color == "" or color == "true"):
+ color = "auto"
+ elif color == "false":
+ color = "never"
+ elif color == "auto":
+ # Python is not a tty, we have to force colors
+ color = "always"
+ use_color = "--color=%s" % color
+ else:
+ use_color = ""
+ cmd = "git log %s --decorate --oneline HEAD --not remotes/%s/%s --" % (
+ use_color, remote, branch)
+ (status, output) = run_command_status(cmd)
+ if status != 0:
+ print("Had trouble running %s" % cmd)
+ print(output)
+ sys.exit(1)
+ output_lines = len(output.split("\n"))
+ if output_lines == 1 and not have_hook:
+ print("Your change was committed before the commit hook was installed")
+ print("Amending the commit to add a gerrit change id")
+ run_command("git commit --amend", GIT_EDITOR='true')
+ elif output_lines == 0:
+ print("No changes between HEAD and %s/%s." % (remote, branch))
+ print("Submitting for review would be pointless.")
+ sys.exit(1)
+ elif output_lines > 1:
+ if not yes:
+ print("You have more than one commit"
+ " that you are about to submit.")
+ print("The outstanding commits are:\n\n%s\n" % output)
+ print("Is this really what you meant to do?")
+ yes_no = do_input("Type 'yes' to confirm: ")
+ if yes_no.lower().strip() != "yes":
+ print("Aborting.")
+ print("Please rebase/squash your changes and try again")
+ sys.exit(1)
+
+
+def use_topic(why, topic):
+ """Inform the user about why a particular topic has been selected."""
+ if VERBOSE:
+ print(why % ('"%s"' % topic,))
+ return topic
+
+
+def get_topic(target_branch):
+
+ branch_name = get_branch_name(target_branch)
+
+ branch_parts = branch_name.split("/")
+ if len(branch_parts) >= 3 and branch_parts[0] == "review":
+ return use_topic("Using change number %s "
+ "for the topic of the change submitted",
+ "/".join(branch_parts[2:]))
+
+ log_output = run_command("git log HEAD^1..HEAD")
+ bug_re = r'\b([Bb]ug|[Ll][Pp])\s*[#:]?\s*(\d+)'
+
+ match = re.search(bug_re, log_output)
+ if match is not None:
+ return use_topic("Using bug number %s "
+ "for the topic of the change submitted",
+ "bug/%s" % match.group(2))
+
+ bp_re = r'\b([Bb]lue[Pp]rint|[Bb][Pp])\s*[#:]?\s*([0-9a-zA-Z-_]+)'
+ match = re.search(bp_re, log_output)
+ if match is not None:
+ return use_topic("Using blueprint number %s "
+ "for the topic of the change submitted",
+ "bp/%s" % match.group(2))
+
+ return use_topic("Using local branch name %s "
+ "for the topic of the change submitted",
+ branch_name)
+
+
+class CannotQueryOpenChangesets(CommandFailed):
+ "Cannot fetch review information from gerrit"
+ EXIT_CODE = 32
+
+
+class CannotParseOpenChangesets(ChangeSetException):
+ "Cannot parse JSON review information from gerrit"
+ EXIT_CODE = 33
+
+
+def list_reviews(remote):
+
+ (hostname, username, port, project_name) = \
+ parse_git_show(remote, "Push")
+
+ if port is not None:
+ port = "-p %s" % port
+ else:
+ port = ""
+ if username is None:
+ userhost = hostname
+ else:
+ userhost = "%s@%s" % (username, hostname)
+
+ review_info = None
+ output = run_command_exc(
+ CannotQueryOpenChangesets,
+ "ssh", "-x", port, userhost,
+ "gerrit", "query",
+ "--current-patch-set --format=JSON project:%s status:open reviewer:self" % project_name)
+
+ review_list = []
+ review_field_width = {}
+ REVIEW_FIELDS = ('number', 'currentPatchSet', 'branch', 'subject')
+ FIELDS = range(0, len(REVIEW_FIELDS))
+ if check_color_support():
+ review_field_color = (colors.yellow, colors.yellow, colors.green, "")
+ color_reset = colors.reset
+ else:
+ review_field_color = ("", "", "", "")
+ color_reset = ""
+ review_field_width = [0, 0, 0, 0]
+ review_field_format = ["%*s", "%*s", "%*s", "%*s"]
+ review_field_justify = [+1, +1, +1, -1] # -1 is justify to right
+
+ for line in output.split("\n"):
+ # Warnings from ssh wind up in this output
+ if line[0] != "{":
+ print(line)
+ continue
+ try:
+ review_info = json.loads(line)
+ except Exception:
+ if VERBOSE:
+ print(output)
+ raise(CannotParseOpenChangesets, sys.exc_info()[1])
+
+ if 'type' in review_info:
+ break
+
+ tempPS = review_info['currentPatchSet']
+ appPS = tempPS['approvals']
+ appValue = '-';
+ for appLine in appPS:
+ appBy = appLine['by']
+ appUser = appBy['username']
+ if appUser == username:
+ appValue = appLine['value']
+ review_info['currentPatchSet'] = tempPS['number'] + ' ' + appValue
+
+ review_list.append([review_info[f] for f in REVIEW_FIELDS])
+ for i in FIELDS:
+ review_field_width[i] = max(
+ review_field_width[i],
+ len(review_info[REVIEW_FIELDS[i]])
+ )
+
+ review_field_format = " ".join([
+ review_field_color[i] +
+ review_field_format[i] +
+ color_reset
+ for i in FIELDS])
+
+ review_field_width = [
+ review_field_width[i] * review_field_justify[i]
+ for i in FIELDS]
+ for review_value in review_list:
+ # At this point we have review_field_format
+ # like "%*s %*s %*s" and we need to supply
+ # (width1, value1, width2, value2, ...) tuple to print
+ # It's easy to zip() widths with actual values,
+ # but we need to flatten the resulting
+ # ((width1, value1), (width2, value2), ...) map.
+ formatted_fields = []
+ for (width, value) in zip(review_field_width, review_value):
+ formatted_fields.extend([width, value])
+ print(review_field_format % tuple(formatted_fields))
+ print("Found %d items for review" % review_info['rowCount'])
+
+ return 0
+
+
+class CannotQueryPatchSet(CommandFailed):
+ "Cannot query patchset information"
+ EXIT_CODE = 34
+
+
+class ReviewInformationNotFound(ChangeSetException):
+ "Could not fetch review information for change %s"
+ EXIT_CODE = 35
+
+
+class ReviewNotFound(ChangeSetException):
+ "Gerrit review %s not found"
+ EXIT_CODE = 36
+
+
+class PatchSetGitFetchFailed(CommandFailed):
+ """Cannot fetch patchset contents
+
+Does specified change number belong to this project?
+"""
+ EXIT_CODE = 37
+
+
+class PatchSetNotFound(ChangeSetException):
+ "Review patchset %s not found"
+ EXIT_CODE = 38
+
+
+class CheckoutNewBranchFailed(CommandFailed):
+ "Cannot checkout to new branch"
+ EXIT_CODE = 64
+
+
+class CheckoutExistingBranchFailed(CommandFailed):
+ "Cannot checkout existing branch"
+ EXIT_CODE = 65
+
+
+class ResetHardFailed(CommandFailed):
+ "Failed to hard reset downloaded branch"
+ EXIT_CODE = 66
+
+
+def fetch_review(review, masterbranch, remote):
+
+ (hostname, username, port, project_name) = \
+ parse_git_show(remote, "Push")
+
+ if port is not None:
+ port = "-p %s" % port
+ else:
+ port = ""
+ if username is None:
+ userhost = hostname
+ else:
+ userhost = "%s@%s" % (username, hostname)
+
+ review_arg = review
+ patchset_opt = '--current-patch-set'
+
+ review, patchset_number = parse_review_number(review)
+ if patchset_number is not None:
+ patchset_opt = '--patch-sets'
+
+ review_info = None
+ output = run_command_exc(
+ CannotQueryPatchSet,
+ "ssh", "-x", port, userhost,
+ "gerrit", "query",
+ "--format=JSON %s change:%s" % (patchset_opt, review))
+
+ review_jsons = output.split("\n")
+ found_review = False
+ for review_json in review_jsons:
+ try:
+ review_info = json.loads(review_json)
+ found_review = True
+ except Exception:
+ pass
+ if found_review:
+ break
+ if not found_review:
+ if VERBOSE:
+ print(output)
+ raise ReviewInformationNotFound(review)
+
+ try:
+ if patchset_number is None:
+ refspec = review_info['currentPatchSet']['ref']
+ else:
+ refspec = [ps for ps
+ in review_info['patchSets']
+ if ps['number'] == patchset_number][0]['ref']
+ except IndexError:
+ raise PatchSetNotFound(review_arg)
+ except KeyError:
+ raise ReviewNotFound(review)
+
+ try:
+ topic = review_info['topic']
+ if topic == masterbranch:
+ topic = review
+ except KeyError:
+ topic = review
+ try:
+ author = re.sub('\W+', '_', review_info['owner']['name']).lower()
+ except KeyError:
+ author = 'unknown'
+
+ if patchset_number is None:
+ branch_name = "review/%s/%s" % (author, topic)
+ else:
+ branch_name = "review/%s/%s-patch%s" % (author, topic, patchset_number)
+
+ print("Downloading %s from gerrit" % refspec)
+ run_command_exc(PatchSetGitFetchFailed,
+ "git", "fetch", remote, refspec)
+ return branch_name
+
+
+def checkout_review(branch_name):
+ """Checkout a newly fetched (FETCH_HEAD) change
+ into a branch
+ """
+
+ try:
+ run_command_exc(CheckoutNewBranchFailed,
+ "git", "checkout", "-b",
+ branch_name, "FETCH_HEAD")
+
+ except CheckoutNewBranchFailed as e:
+ if re.search("already exists\.?", e.output):
+ print("Branch already exists - reusing")
+ run_command_exc(CheckoutExistingBranchFailed,
+ "git", "checkout", branch_name)
+ run_command_exc(ResetHardFailed,
+ "git", "reset", "--hard", "FETCH_HEAD")
+ else:
+ raise
+
+ print("Switched to branch \"%s\"" % branch_name)
+
+
+class PatchSetGitCherrypickFailed(CommandFailed):
+ "There was a problem applying changeset contents to the current branch."
+ EXIT_CODE = 69
+
+
+def cherrypick_review(option=None):
+ cmd = ["git", "cherry-pick"]
+ if option:
+ cmd.append(option)
+ cmd.append("FETCH_HEAD")
+ print(run_command_exc(PatchSetGitCherrypickFailed, *cmd))
+
+
+class CheckoutBackExistingBranchFailed(CommandFailed):
+ "Cannot switch back to existing branch"
+ EXIT_CODE = 67
+
+
+class DeleteBranchFailed(CommandFailed):
+ "Failed to delete branch"
+ EXIT_CODE = 68
+
+
+class InvalidPatchsetsToCompare(GitReviewException):
+ def __init__(self, patchsetA, patchsetB):
+ Exception.__init__(
+ self,
+ "Invalid patchsets for comparison specified (old=%s,new=%s)" % (
+ patchsetA,
+ patchsetB))
+ EXIT_CODE = 39
+
+
+def compare_review(review_spec, branch, remote, rebase=False):
+ new_ps = None # none means latest
+
+ if '-' in review_spec:
+ review_spec, new_ps = review_spec.split('-')
+ review, old_ps = parse_review_number(review_spec)
+
+ if old_ps is None or old_ps == new_ps:
+ raise InvalidPatchsetsToCompare(old_ps, new_ps)
+
+ old_review = build_review_number(review, old_ps)
+ new_review = build_review_number(review, new_ps)
+
+ old_branch = fetch_review(old_review, branch, remote)
+ checkout_review(old_branch)
+
+ if rebase:
+ print('Rebasing %s' % old_branch)
+ rebase = rebase_changes(branch, remote, False)
+ if not rebase:
+ print('Skipping rebase because of conflicts')
+ run_command_exc(CommandFailed, 'git', 'rebase', '--abort')
+
+ new_branch = fetch_review(new_review, branch, remote)
+ checkout_review(new_branch)
+
+ if rebase:
+ print('Rebasing also %s' % new_branch)
+ if not rebase_changes(branch, remote, False):
+ print("Rebasing of the new branch failed, "
+ "diff can be messed up (use -R to not rebase at all)!")
+ run_command_exc(CommandFailed, 'git', 'rebase', '--abort')
+
+ subprocess.check_call(['git', 'difftool', old_branch])
+
+
+def finish_branch(target_branch):
+ local_branch = get_branch_name(target_branch)
+ if VERBOSE:
+ print("Switching back to '%s' and deleting '%s'" % (target_branch,
+ local_branch))
+ run_command_exc(CheckoutBackExistingBranchFailed,
+ "git", "checkout", target_branch)
+ print("Switched to branch '%s'" % target_branch)
+
+ run_command_exc(DeleteBranchFailed,
+ "git", "branch", "-D", local_branch)
+ print("Deleted branch '%s'" % local_branch)
+
+
+def convert_bool(one_or_zero):
+ "Return a bool on a one or zero string."
+ return one_or_zero in ["1", "true", "True"]
+
+
+def print_exit_message(status, needs_update):
+
+ if needs_update:
+ print("""
+***********************************************************
+A new version of git-review is available on PyPI. Please
+update your copy with:
+
+ pip install -U git-review
+
+to ensure proper behavior with gerrit. Thanks!
+***********************************************************
+""")
+ sys.exit(status)
+
+
+def main():
+ global _no_color_support
+ usage = "git review [OPTIONS] ... [BRANCH]"
+
+ import argparse
+
+ class DownloadFlag(argparse.Action):
+ """Additional option parsing: store value in 'dest', but
+ at the same time set one of the flag options to True
+ """
+ def __call__(self, parser, namespace, values, option_string=None):
+ setattr(namespace, self.dest, values)
+ setattr(namespace, self.const, True)
+
+ parser = argparse.ArgumentParser(usage=usage, description=COPYRIGHT)
+
+ parser.add_argument("-t", "--topic", dest="topic",
+ help="Topic to submit branch to")
+ parser.add_argument("-D", "--draft", dest="draft", action="store_true",
+ help="Submit review as a draft")
+ parser.add_argument("-c", "--compatible", dest="compatible",
+ action="store_true",
+ help="Push change to refs/for/* for compatibility "
+ "with Gerrit versions < 2.3. Ignored if "
+ "-D/--draft is used.")
+ parser.add_argument("-n", "--dry-run", dest="dry", action="store_true",
+ help="Don't actually submit the branch for review")
+ parser.add_argument("-i", "--new-changeid", dest="regenerate",
+ action="store_true",
+ help="Regenerate Change-id before submitting")
+ parser.add_argument("-r", "--remote", dest="remote",
+ help="git remote to use for gerrit")
+ parser.add_argument("-R", "--no-rebase", dest="rebase",
+ action="store_false",
+ help="Don't rebase changes before submitting.")
+ parser.add_argument("-F", "--force-rebase", dest="force_rebase",
+ action="store_true",
+ help="Force rebase even when not needed.")
+ parser.add_argument("-B", "--no-color", dest="no_color_support",
+ action="store_true",
+ help="No color support.")
+
+
+ fetch = parser.add_mutually_exclusive_group()
+ fetch.set_defaults(download=False, compare=False, cherrypickcommit=False,
+ cherrypickindicate=False, cherrypickonly=False)
+ fetch.add_argument("-d", "--download", dest="changeidentifier",
+ action=DownloadFlag, metavar="CHANGE",
+ const="download",
+ help="Download the contents of an existing gerrit "
+ "review into a branch")
+ fetch.add_argument("-x", "--cherrypick", dest="changeidentifier",
+ action=DownloadFlag, metavar="CHANGE",
+ const="cherrypickcommit",
+ help="Apply the contents of an existing gerrit "
+ "review onto the current branch and commit "
+ "(cherry pick; not recommended in most "
+ "situations)")
+ fetch.add_argument("-X", "--cherrypickindicate", dest="changeidentifier",
+ action=DownloadFlag, metavar="CHANGE",
+ const="cherrypickindicate",
+ help="Apply the contents of an existing gerrit "
+ "review onto the current branch and commit, "
+ "indicating its origin")
+ fetch.add_argument("-N", "--cherrypickonly", dest="changeidentifier",
+ action=DownloadFlag, metavar="CHANGE",
+ const="cherrypickonly",
+ help="Apply the contents of an existing gerrit "
+ "review to the working directory and prepare "
+ "for commit")
+ fetch.add_argument("-m", "--compare", dest="changeidentifier",
+ action=DownloadFlag, metavar="CHANGE,PS[-NEW_PS]",
+ const="compare",
+ help="Download specified and latest (or NEW_PS) "
+ "patchsets of an existing gerrit review into "
+ "a branches, rebase on master "
+ "(skipped on conflicts or when -R is specified) "
+ "and show their differences")
+
+ parser.add_argument("-u", "--update", dest="update", action="store_true",
+ help="Force updates from remote locations")
+ parser.add_argument("-s", "--setup", dest="setup", action="store_true",
+ help="Just run the repo setup commands but don't "
+ "submit anything")
+ parser.add_argument("-f", "--finish", dest="finish", action="store_true",
+ help="Close down this branch and switch back to "
+ "master on successful submission")
+ parser.add_argument("-l", "--list", dest="list", action="store_true",
+ help="List available reviews for the current project")
+ parser.add_argument("-y", "--yes", dest="yes", action="store_true",
+ help="Indicate that you do, in fact, understand if "
+ "you are submitting more than one patch")
+ parser.add_argument("-v", "--verbose", dest="verbose", action="store_true",
+ help="Output more information about what's going on")
+ parser.add_argument("--no-custom-script", dest="custom_script",
+ action="store_false", default=True,
+ help="Do not run custom scripts.")
+ parser.add_argument("--license", dest="license", action="store_true",
+ help="Print the license and exit")
+ parser.add_argument("--version", action="version",
+ version='%s version %s' %
+ (os.path.split(sys.argv[0])[-1], version))
+ parser.add_argument("branch", nargs="?")
+
+ try:
+ (top_dir, git_dir) = git_directories()
+ except GitDirectoriesException:
+ if sys.argv[1:] in ([], ['-h'], ['--help']):
+ parser.print_help()
+ sys.exit(1)
+ raise
+
+# config = get_config(os.path.join(top_dir, ".gitreview"))
+ config = DEFAULTS.copy()
+ cur_proj = run_command("git remote -v")
+ import re
+ m = re.search('(?<=29418\/)(\S+)', cur_proj)
+ config['project'] = m.group(0)
+
+
+ defaultrebase = convert_bool(
+ git_config_get_value("gitreview", "rebase",
+ default=str(config['defaultrebase'])))
+ parser.set_defaults(dry=False,
+ draft=False,
+ rebase=defaultrebase,
+ verbose=False,
+ update=False,
+ setup=False,
+ list=False,
+ yes=False,
+ branch=config['defaultbranch'],
+ remote=config['defaultremote'])
+ options = parser.parse_args()
+
+ if options.license:
+ print(COPYRIGHT)
+ sys.exit(0)
+
+ branch = options.branch
+ global VERBOSE
+ global UPDATE
+ VERBOSE = options.verbose
+ UPDATE = options.update
+ remote = options.remote
+ yes = options.yes
+ status = 0
+
+ needs_update = latest_is_newer()
+ check_remote(branch, remote,
+ config['hostname'], config['port'], config['project'])
+
+ if options.no_color_support:
+ _no_color_support = True
+
+ if options.changeidentifier:
+ if options.compare:
+ compare_review(options.changeidentifier,
+ branch, remote, options.rebase)
+ return
+ local_branch = fetch_review(options.changeidentifier, branch, remote)
+ if options.download:
+ checkout_review(local_branch)
+ else:
+ if options.cherrypickcommit:
+ cherrypick_review()
+ elif options.cherrypickonly:
+ cherrypick_review("-n")
+ if options.cherrypickindicate:
+ cherrypick_review("-x")
+ return
+ elif options.list:
+ list_reviews(remote)
+ return
+
+ if options.custom_script:
+ run_custom_script("pre")
+
+ hook_file = os.path.join(git_dir, "hooks", "commit-msg")
+ have_hook = os.path.exists(hook_file) and os.access(hook_file, os.X_OK)
+
+ if not have_hook:
+ set_hooks_commit_msg(remote, hook_file)
+
+ if options.setup:
+ if options.finish and not options.dry:
+ finish_branch(branch)
+ return
+
+ if options.rebase:
+ if not rebase_changes(branch, remote):
+ print_exit_message(1, needs_update)
+ if not options.force_rebase and not undo_rebase():
+ print_exit_message(1, needs_update)
+ assert_one_change(remote, branch, yes, have_hook)
+
+ ref = "publish"
+
+ if options.draft:
+ ref = "drafts"
+ if options.custom_script:
+ run_custom_script("draft")
+ elif options.compatible:
+ ref = "for"
+
+ cmd = "git push %s HEAD:refs/%s/%s" % (remote, ref, branch)
+ topic = options.topic or get_topic(branch)
+ if topic != branch:
+ cmd += "/%s" % topic
+ if options.regenerate:
+ print("Amending the commit to regenerate the change id\n")
+ regenerate_cmd = "git commit --amend"
+ if options.dry:
+ print("\tGIT_EDITOR=\"sed -i -e '/^Change-Id:/d'\" %s\n" %
+ regenerate_cmd)
+ else:
+ run_command(regenerate_cmd,
+ GIT_EDITOR="sed -i -e "
+ "'/^Change-Id:/d'")
+
+ if options.dry:
+ print("Please use the following command "
+ "to send your commits to review:\n")
+ print("\t%s\n" % cmd)
+ else:
+ (status, output) = run_command_status(cmd)
+ print(output)
+
+ if options.finish and not options.dry and status == 0:
+ finish_branch(branch)
+ return
+
+ if options.custom_script:
+ run_custom_script("post")
+ print_exit_message(status, needs_update)
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except GitReviewException as e:
+ print(e)
+ sys.exit(e.EXIT_CODE)
--- /dev/null
+Windows Registry Editor Version 5.00\r
+\r
+; Registry file that maps the solarized palette to the 16 avaliable colors\r
+; in a Windows command prompt. Note, hex values in the table are RGB but byte\r
+; ordering of a DWORD is BGR, e.g. "ColorTable<##>"=dword:00<B><G><R>\r
+;\r
+; Solarized color table from http://ethanschoonover.com/solarized.\r
+;\r
+; NR cmd.exe PowerShell SOLARIZED HEX DWORD\r
+; -- ------- ----------- --------- ------- --------\r
+; 00 Black Black base03 #002b36 00362b00\r
+; 01 Blue DarkBlue base0 #839496 00969483\r
+; 02 Green DarkGreen base01 #586e75 00756e58\r
+; 03 Aqua DarkCyan base1 #93a1a1 00a1a193\r
+; 04 Red DarkRed orange #cb4b16 00164bcb\r
+; 05 Purple DarkMagenta violet #6c71c4 00c4716c\r
+; 06 Yellow DarkYellow base00 #657b83 00837b65\r
+; 07 White Gray base2 #eee8d5 00d5e8ee\r
+; 08 Gray DarkGray base02 #073642 00423607\r
+; 09 LightBlue Blue blue #268bd2 00d28b26\r
+; 10 LightGreen Green green #859900 00009985\r
+; 11 LightAqua Cyan cyan #2aa198 0098a12a\r
+; 12 LightRed Red red #dc322f 002f32dc\r
+; 13 LightPurple Magenta magenta #d33682 008236d3\r
+; 14 LightYellow Yellow yellow #b58900 000089b5\r
+; 15 BrightWhite White base3 #fdf6e3 00e3f6fd\r
+;\r
+\r
+[HKEY_CURRENT_USER\Console]\r
+"ColorTable00"=dword:00362b00\r
+"ColorTable01"=dword:00969483\r
+"ColorTable02"=dword:00756e58\r
+"ColorTable03"=dword:00a1a193\r
+"ColorTable04"=dword:00164bcb\r
+"ColorTable05"=dword:00c4716c\r
+"ColorTable06"=dword:00837b65\r
+"ColorTable07"=dword:00d5e8ee\r
+"ColorTable08"=dword:00423607\r
+"ColorTable09"=dword:00d28b26\r
+"ColorTable10"=dword:00009985\r
+"ColorTable11"=dword:0098a12a\r
+"ColorTable12"=dword:002f32dc\r
+"ColorTable13"=dword:008236d3\r
+"ColorTable14"=dword:000089b5\r
+"ColorTable15"=dword:00e3f6fd\r
+"ScreenColors"=dword:00000001\r
+"PopupColors"=dword:000000f6\r
--- /dev/null
+; Use caps and rwin as ctrl (HHKB alike)
+Capslock::LCtrl
+RWin::RCtrl
+LWin::return
+
+; Letter a -> skandinavian å
+:*?:``a::å
+:*?:``A::Å
+
+; Letter o -> danish/norwegen ø
+:*?:``o::ø
+:*?:``O::Ø
+
+; Letter ' -> danish/norwegen æ
+:*?:``'::æ
+:*?:``"::Æ
+
+; Letter u -> swedish/finish ö
+:*?:``u::ö
+:*?:``U::Ö
+
+; Letter e -> swedish/finish ä
+:*?:``e::ä
+:*?:``E::Ä