[gentoo-commits] repo/user/tbc:master commit in: tools/

2016-06-05 Thread M. B.
commit: 7ffea4126bfece837ad78ef214d00ddb20a9c8d2
Author: Matthew Brewer  sina  cn>
AuthorDate: Sun Jun  5 11:01:19 2016 +
Commit: M. B.  sina  cn>
CommitDate: Sun Jun  5 11:01:19 2016 +
URL:https://gitweb.gentoo.org/repo/user/tbc.git/commit/?id=7ffea412

update ortrta.sh

 tools/ortrta.sh | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/ortrta.sh b/tools/ortrta.sh
index 0d5d38f..281df2c 100755
--- a/tools/ortrta.sh
+++ b/tools/ortrta.sh
@@ -9,6 +9,7 @@ errorout() {
 }
 
 repoman_this() {
+   local gitdir=$(git rev-parse --show-toplevel)
local ebuilds=( $(git diff --numstat HEAD^ | cut -f3 | grep '\.ebuild') 
)
local dirs=()
for i in ${ebuilds[@]}; do
@@ -22,7 +23,7 @@ repoman_this() {
done
if [[ ${inIt} -eq 0 ]]; then
dirs+="${dir}"
-   pushd ${dir}
+   pushd "${gitdir}/${dir}"
repoman full
popd 2>&1 > /dev/null
fi
@@ -45,7 +46,7 @@ choose() {

case ${response} in
d )
-   git diff --find-renames --find-copies 
--find-copies-harder --color=always HEAD^ | cat
+   git diff --find-renames --find-copies 
--find-copies-harder --color=always HEAD^
;;
e )
exit 0
@@ -80,7 +81,7 @@ choose() {
 resume() {
count=$(GIT_EDITOR='cat' git rebase --edit-todo | grep -v '^#' | wc -l)
while [[ ${count} -ge 0 ]]; do
-   git diff --color --stat HEAD^ | cat
+   git diff --color --find-renames --find-copies 
--find-copies-harder --stat HEAD^ | cat
echo "left: ${count}"
count=$(( count - 1 ))
choose



[gentoo-commits] repo/user/tbc:master commit in: tools/

2016-06-01 Thread M. B.
commit: 858628b3a2b54f15cd08b396b351f2441fde785e
Author: Matthew Brewer  sina  cn>
AuthorDate: Wed Jun  1 15:45:45 2016 +
Commit: M. B.  sina  cn>
CommitDate: Wed Jun  1 15:45:45 2016 +
URL:https://gitweb.gentoo.org/repo/user/tbc.git/commit/?id=858628b3

update ortrta.sh

 tools/ortrta.sh | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/ortrta.sh b/tools/ortrta.sh
index 7b1d950..0d5d38f 100755
--- a/tools/ortrta.sh
+++ b/tools/ortrta.sh
@@ -35,7 +35,8 @@ repoman_this() {
 
 choose() {
while [[ true ]]; do
-   echo -n "(e)dit, (r)epoman full all ebuilds, (c)ontinue or 
e(x)it? "
+   echo
+   echo -n "(e)dit, (r)epoman full affected dirs, (d)iff, (n)ext 
commit, exit (w)ith saving or e(x)it w/o saving? "
read -n1 -r response

printf '\r'
@@ -43,10 +44,13 @@ choose() {
echo

case ${response} in
+   d )
+   git diff --find-renames --find-copies 
--find-copies-harder --color=always HEAD^ | cat
+   ;;
e )
exit 0
;;
-   c )
+   n )
git rebase --continue 2>&1 | head -n1
return
;;
@@ -54,6 +58,12 @@ choose() {
repoman_this
return
;;
+   w )
+   for i in $(seq $(GIT_EDITOR='cat' git rebase 
--edit-todo | grep -v '^#' | wc -l) -1 0); do
+   git rebase --continue 2>&1 | head -n1
+   echo "left: ${i}"
+   done
+   ;;
x )
echo "Aborting rebase..."
git rebase --abort



[gentoo-commits] repo/user/tbc:master commit in: tools/

2016-05-31 Thread M. B.
commit: f04391f7be5b822c23c07fce1dcbda8640a103ed
Author: Matthew Brewer  sina  cn>
AuthorDate: Tue May 31 13:45:40 2016 +
Commit: M. B.  sina  cn>
CommitDate: Tue May 31 14:06:07 2016 +
URL:https://gitweb.gentoo.org/repo/user/tbc.git/commit/?id=f04391f7

make umounts --lazy for chroot-here.sh

 tools/chroot-here.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/chroot-here.sh b/tools/chroot-here.sh
index 7c20805..63442b6 100755
--- a/tools/chroot-here.sh
+++ b/tools/chroot-here.sh
@@ -64,7 +64,7 @@ function mountDir() {
 function umountDir() {
   local dir=$1
   echo -n "Unmounting ${dir} ... "
-  umount "${PWD}/${dir}" 2&>/dev/null
+  umount --lazy "${PWD}/${dir}" 2&>/dev/null
   echo "done."
 }
 



[gentoo-commits] repo/user/tbc:master commit in: tools/

2016-05-31 Thread M. B.
commit: 17b2f77b821ac7816945f1cdbb2f1fef7310d0df
Author: Matthew Brewer  sina  cn>
AuthorDate: Tue May 31 13:45:40 2016 +
Commit: M. B.  sina  cn>
CommitDate: Tue May 31 13:45:53 2016 +
URL:https://gitweb.gentoo.org/repo/user/tbc.git/commit/?id=17b2f77b

make umounts --lazy for chroot-here.sh

 tools/chroot-here.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/chroot-here.sh b/tools/chroot-here.sh
index 7c20805..63442b6 100755
--- a/tools/chroot-here.sh
+++ b/tools/chroot-here.sh
@@ -64,7 +64,7 @@ function mountDir() {
 function umountDir() {
   local dir=$1
   echo -n "Unmounting ${dir} ... "
-  umount "${PWD}/${dir}" 2&>/dev/null
+  umount --lazy "${PWD}/${dir}" 2&>/dev/null
   echo "done."
 }
 



[gentoo-commits] repo/user/tbc:master commit in: tools/

2016-05-28 Thread M. B.
commit: 446ee0a58356465f62f6f2c69ce86643fee8cc1f
Author: Matthew Brewer  sina  cn>
AuthorDate: Fri May 27 22:43:58 2016 +
Commit: M. B.  sina  cn>
CommitDate: Sat May 28 12:01:59 2016 +
URL:https://gitweb.gentoo.org/repo/user/tbc.git/commit/?id=446ee0a5

new tool for git-edits step-by-step

 tools/ortrta.sh | 107 
 1 file changed, 107 insertions(+)

diff --git a/tools/ortrta.sh b/tools/ortrta.sh
new file mode 100755
index 000..7b1d950
--- /dev/null
+++ b/tools/ortrta.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+# Shell script to perform `git rebase -i `
+# License: WTFPL2
+
+errorout() {
+   echo "Failed: $1"
+   exit 1
+}
+
+repoman_this() {
+   local ebuilds=( $(git diff --numstat HEAD^ | cut -f3 | grep '\.ebuild') 
)
+   local dirs=()
+   for i in ${ebuilds[@]}; do
+   local dir=$(dirname ${i})
+   local inIt=0
+   for j in ${dirs[@]}; do
+   if [[ "${j}" == "${dir}" ]]; then
+   inIt=1
+   break;
+   fi
+   done
+   if [[ ${inIt} -eq 0 ]]; then
+   dirs+="${dir}"
+   pushd ${dir}
+   repoman full
+   popd 2>&1 > /dev/null
+   fi
+   done
+   git add *
+   git commit --amend --no-edit
+   echo
+   git rebase --continue 2>&1 | head -n1
+}
+
+choose() {
+   while [[ true ]]; do
+   echo -n "(e)dit, (r)epoman full all ebuilds, (c)ontinue or 
e(x)it? "
+   read -n1 -r response
+   
+   printf '\r'
+   tput el
+   echo
+   
+   case ${response} in
+   e )
+   exit 0
+   ;;
+   c )
+   git rebase --continue 2>&1 | head -n1
+   return
+   ;;
+   r )
+   repoman_this
+   return
+   ;;
+   x )
+   echo "Aborting rebase..."
+   git rebase --abort
+   echo "Exiting."
+   exit 0
+   ;;
+   * )
+   echo "Wrong key. Try again."
+   ;;
+   esac
+   done
+}
+
+resume() {
+   count=$(GIT_EDITOR='cat' git rebase --edit-todo | grep -v '^#' | wc -l)
+   while [[ ${count} -ge 0 ]]; do
+   git diff --color --stat HEAD^ | cat
+   echo "left: ${count}"
+   count=$(( count - 1 ))
+   choose
+   done
+   if [[ $(LC_ALL=C git rebase --edit-todo 2>&1 | \
+   grep -v '^#\|No rebase in 
progress?' | \
+   wc -l) \
+   -eq 0 ]]; then
+   echo "Done."
+   else
+   echo "Something went wrong here, there's still commits to 
process."
+   fi
+}
+
+commence() {
+   input=$1
+   START=${input:=master}
+   GIT_EDITOR='vim -c "%s/pick/edit/g | wq"' git rebase -i ${START} || 
errorout "git rebase -i ${START}"
+   resume
+}
+
+STATUS=$(LC_ALL=C git status | head -n1 | grep -c 'interactive rebase in 
progress')
+
+case ${STATUS} in
+   1)
+   resume
+   ;;
+   0)
+   commence $1
+   ;;
+   *)
+   errorout "Invalid status \"${STATUS}\"."
+   ;;
+esac



[gentoo-commits] repo/user/tbc:master commit in: tools/

2016-05-27 Thread M. B.
commit: 9d76cbba4afb91b51374316a87fc4135808051f4
Author: Matthew Brewer  sina  cn>
AuthorDate: Fri May 27 22:43:58 2016 +
Commit: M. B.  sina  cn>
CommitDate: Fri May 27 22:43:58 2016 +
URL:https://gitweb.gentoo.org/repo/user/tbc.git/commit/?id=9d76cbba

new tool for git-edits step-by-step

 tools/ortrta.sh | 107 
 1 file changed, 107 insertions(+)

diff --git a/tools/ortrta.sh b/tools/ortrta.sh
new file mode 100755
index 000..7b1d950
--- /dev/null
+++ b/tools/ortrta.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+# Shell script to perform `git rebase -i `
+# License: WTFPL2
+
+errorout() {
+   echo "Failed: $1"
+   exit 1
+}
+
+repoman_this() {
+   local ebuilds=( $(git diff --numstat HEAD^ | cut -f3 | grep '\.ebuild') 
)
+   local dirs=()
+   for i in ${ebuilds[@]}; do
+   local dir=$(dirname ${i})
+   local inIt=0
+   for j in ${dirs[@]}; do
+   if [[ "${j}" == "${dir}" ]]; then
+   inIt=1
+   break;
+   fi
+   done
+   if [[ ${inIt} -eq 0 ]]; then
+   dirs+="${dir}"
+   pushd ${dir}
+   repoman full
+   popd 2>&1 > /dev/null
+   fi
+   done
+   git add *
+   git commit --amend --no-edit
+   echo
+   git rebase --continue 2>&1 | head -n1
+}
+
+choose() {
+   while [[ true ]]; do
+   echo -n "(e)dit, (r)epoman full all ebuilds, (c)ontinue or 
e(x)it? "
+   read -n1 -r response
+   
+   printf '\r'
+   tput el
+   echo
+   
+   case ${response} in
+   e )
+   exit 0
+   ;;
+   c )
+   git rebase --continue 2>&1 | head -n1
+   return
+   ;;
+   r )
+   repoman_this
+   return
+   ;;
+   x )
+   echo "Aborting rebase..."
+   git rebase --abort
+   echo "Exiting."
+   exit 0
+   ;;
+   * )
+   echo "Wrong key. Try again."
+   ;;
+   esac
+   done
+}
+
+resume() {
+   count=$(GIT_EDITOR='cat' git rebase --edit-todo | grep -v '^#' | wc -l)
+   while [[ ${count} -ge 0 ]]; do
+   git diff --color --stat HEAD^ | cat
+   echo "left: ${count}"
+   count=$(( count - 1 ))
+   choose
+   done
+   if [[ $(LC_ALL=C git rebase --edit-todo 2>&1 | \
+   grep -v '^#\|No rebase in 
progress?' | \
+   wc -l) \
+   -eq 0 ]]; then
+   echo "Done."
+   else
+   echo "Something went wrong here, there's still commits to 
process."
+   fi
+}
+
+commence() {
+   input=$1
+   START=${input:=master}
+   GIT_EDITOR='vim -c "%s/pick/edit/g | wq"' git rebase -i ${START} || 
errorout "git rebase -i ${START}"
+   resume
+}
+
+STATUS=$(LC_ALL=C git status | head -n1 | grep -c 'interactive rebase in 
progress')
+
+case ${STATUS} in
+   1)
+   resume
+   ;;
+   0)
+   commence $1
+   ;;
+   *)
+   errorout "Invalid status \"${STATUS}\"."
+   ;;
+esac



[gentoo-commits] repo/user/tbc:master commit in: tools/

2016-05-26 Thread M. B.
commit: 370ac6116636d62c6edf63fd2b8b24a7e6281d8d
Author: Matthew Brewer  sina  cn>
AuthorDate: Fri May 27 04:10:06 2016 +
Commit: M. B.  sina  cn>
CommitDate: Fri May 27 04:10:06 2016 +
URL:https://gitweb.gentoo.org/repo/user/tbc.git/commit/?id=370ac611

update chroot-here.sh

 tools/chroot-here.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/chroot-here.sh b/tools/chroot-here.sh
index 408fef4..c7291a1 100755
--- a/tools/chroot-here.sh
+++ b/tools/chroot-here.sh
@@ -203,8 +203,8 @@ fi
 MAKEOPTS="-j5"
 EMERGE_DEFAULT_OPTS="--verbose --autounmask-write --nospinner --keep-going 
-j5 --load-average=5 --verbose-conflict"
 PYTHON_SINGLE_TARGET="python3_4"
-PYTHON_TARGETS="python2_7 python3_3 python3_4 python3_5 pypy pypy2"
-  EOF
+PYTHON_TARGETS="python2_7 python3_4"
+EOF
 if [[ ${ARCH_FULL} == x86 ]]; then
   PS1="chroot${PS1}" linux32 chroot ./ /bin/bash --login || quit "Chrooting 
failed."
 else



[gentoo-commits] repo/user/tbc:master commit in: tools/

2016-05-25 Thread M. B.
commit: f0603f17b262357c94c49a5f84056bd73dec3434
Author: Matthew Brewer  sina  cn>
AuthorDate: Wed May 25 11:46:08 2016 +
Commit: M. B.  sina  cn>
CommitDate: Wed May 25 12:03:59 2016 +
URL:https://gitweb.gentoo.org/repo/user/tbc.git/commit/?id=f0603f17

add chroot-here.sh to tools (dangerous!)

 tools/chroot-here.sh | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/chroot-here.sh b/tools/chroot-here.sh
index b8721b3..408fef4 100755
--- a/tools/chroot-here.sh
+++ b/tools/chroot-here.sh
@@ -199,12 +199,12 @@ cp -v /etc/resolv.conf etc/ || quit "Couldn't copy 
resolv.conf"
 if [[ ${ARCH_FULL} != x86 && ${ARCH} != amd64 ]]; then
   cp -v "${QEMU_BIN}" ".$(dirname "${QEMU_BIN}")" || quit "Couldn't copy qemu 
binary."
 fi
-  cat <> etc/portage/make.conf || quit "Couldn't write to 
etc/portage/make.conf."
-MAKEOPTS="-j5"
-EMERGE_DEFAULT_OPTS="--verbose --autounmask-write --nospinner --keep-going -j5 
--load-average=5 --verbose-conflict"
-PYTHON_SINGLE_TARGET="python3_4"
-PYTHON_TARGETS="python2_7 python3_3 python3_4 python3_5 pypy pypy2"
-EOF
+  cat <<-EOF >> etc/portage/make.conf || quit "Couldn't write to 
etc/portage/make.conf."
+MAKEOPTS="-j5"
+EMERGE_DEFAULT_OPTS="--verbose --autounmask-write --nospinner --keep-going 
-j5 --load-average=5 --verbose-conflict"
+PYTHON_SINGLE_TARGET="python3_4"
+PYTHON_TARGETS="python2_7 python3_3 python3_4 python3_5 pypy pypy2"
+  EOF
 if [[ ${ARCH_FULL} == x86 ]]; then
   PS1="chroot${PS1}" linux32 chroot ./ /bin/bash --login || quit "Chrooting 
failed."
 else