This commit is contained in:
Jonas Ryssel 2024-08-20 09:13:46 +02:00
parent 3e6ddf9912
commit e1da2d377e

View File

@ -83,8 +83,8 @@ if [ "$(alias | grep '\sgbr=' -c)" != 0 ]; then
unalias gbr
fi
# alias gbr="git branch --sort=-committerdate"
# function gbr2 { git branch --sort=-committerdate | perl -pE 'my $branch = $_ =~ s/^[*+]?\s(\S+)\s*$/$1/r; my $merged = qx{git log \$(git rev-parse $branch) ^master --no-merges}; if ($merged) { $_ =~ s/^/[ ] / } else { $_ =~ s/^/[x] / };'; }
function gbr { git branch --sort=-committerdate --format '%(if)%(HEAD)%(then)*%(else)%(if)%(worktreepath)%(then)+%(else) %(end)%(end) %(align:width=40,position=left)%(refname:short)%(end) %(align:width=10,position=right)%(color:green)(%(committerdate:relative))%(end)' | perl -pE '$_ =~ /^[*+]?\s+(?<branch>\S+)\s*/; my $branch = $+{branch}; my $merged = qx{git log \$(git rev-parse $branch) ^master --no-merges}; if ($merged) { $_ =~ s/^/[ ] / } else { $_ =~ s/^/[x] / };'; }
# function gbr2 { git branch --sort=-committerdate | perl -pE 'my $branch = $_ =~ s/^[*+]?\s(\S+)\s*$/$1/r; my $merged = qx{git log \$(git rev-parse $branch) ^main --no-merges}; if ($merged) { $_ =~ s/^/[ ] / } else { $_ =~ s/^/[x] / };'; }
function gbr { git branch --sort=-committerdate --format '%(if)%(HEAD)%(then)*%(else)%(if)%(worktreepath)%(then)+%(else) %(end)%(end) %(align:width=40,position=left)%(refname:short)%(end) %(align:width=10,position=right)%(color:green)(%(committerdate:relative))%(end)' | perl -pE '$_ =~ /^[*+]?\s+(?<branch>\S+)\s*/; my $branch = $+{branch}; my $merged = qx{git log \$(git rev-parse $branch) ^main --no-merges}; if ($merged) { $_ =~ s/^/[ ] / } else { $_ =~ s/^/[x] / };'; }
function ggn { git grep -Pn --color=always "$@" :/; }
function ggt { git grep -Pn --color=always "$@" t/lib ; }
function ggp { ggn --color=always "$@" "$(git rev-list --all)"; }
@ -276,6 +276,7 @@ if [ "$HOSTNAME" = 'gnu' ] && [ "$USER" = 'jry' ]; then
function prove { jix-shell TEST_METHOD="$TEST_METHOD" BAIL_ON_FAIL="$BAIL_ON_FAIL" prove "$@"; }
function prove-on-backend { jix-shell TEST_METHOD="$TEST_METHOD" BAIL_ON_FAIL="$BAIL_ON_FAIL" USER="$USER" JIX_USERID="$JIX_USERID" prove-on-backend "$@"; }
function perl { jix-shell TEST_METHOD="$TEST_METHOD" BAIL_ON_FAIL="$BAIL_ON_FAIL" USER="$USER" JIX_USERID="$JIX_USERID" perl -MJIX "$@"; }
alias jix-schedule="jix-shell jix-schedule"
alias open_url="jix-shell open_url"
alias colorlog="jix-shell colorlog.pl"
alias jix-gettext="jix-shell jix-gettext"
@ -285,31 +286,41 @@ if [ "$HOSTNAME" = 'gnu' ] && [ "$USER" = 'jry' ]; then
function profiling {
local JIX_USERID=233476; # userid of JRY
local USER=jobdk;
local ENV_USER=jobdk; # Don't call it USER, since that changes the user the process runs at, and then it cannot save the output
local ROOT=$1;
shift;
if [[ $# -ge 1 ]]; then
local FORMAT=$1;
shift;
else
local FORMAT=;
fi
local FORM=$@;
local COMMAND='use Test::More; use Test::JIX::Mojo;
use JIX::Env;
DB::disable_profile; # backup solution for setting NYTPROF=start=no env variable
JIX::Env->USER("'"$USER"'"); # backup solution for setting USER=jobdk env variable
JIX::Env->USER("'$ENV_USER'"); # backup solution for setting USER=jobdk env variable
use JIX::CHI;
JIX::CHI->reset; # Clear all caches
my $t = Test::JIX::Mojo->new("JIX::Mojo");
my $c = JIX::CompanyUser->retrieve( { id => '"$JIX_USERID"' } );
$t->ua->inactivity_timeout(600);
$t->auto_html5_ok(0);
$t->login_companyuser($c);
$t->jix_get_ok([ "'"$ROOT"'", format=>"xml", form => { '"$FORM"' } ]);
$t->login_admin_companyuser($c);
$t->jix_get_ok([ "'$ROOT'", format => "'$FORMAT'", form => { '"$FORM"' } ]);
for (0..9) {
$t->login_companyuser($c);
$t->login_admin_companyuser($c);
DB::enable_profile;
$t->jix_get_ok([ "'"$ROOT"'", format=>"xml", form => { '"$FORM"' } ]);
$t->jix_get_ok([ "'$ROOT'", format => "'$FORMAT'", form => { '"$FORM"' } ]);
DB::disable_profile;
};
done_testing();';
echo "Command:";
echo "perl -d:NYTProf -E '$COMMAND'";
USER=jobdk NYTPROF=start=no perl -d:NYTProf -E "$COMMAND";
nytprofhtml;
jix-shell USER="$ENV_USER" NYTPROF=start=no perl -d:NYTProf -E "$COMMAND";
rm -rf nytprof;
jix-shell nytprofhtml;
rm -rf nytprof.out;
}
# Automatically keep a pointer to my latest SSH agent