From e1da2d377e45b5637743370f178803c33059ace1 Mon Sep 17 00:00:00 2001 From: Jonas Ryssel Date: Tue, 20 Aug 2024 09:13:46 +0200 Subject: [PATCH] Update --- .bash_aliases | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/.bash_aliases b/.bash_aliases index 806a482..06f5c70 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -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+(?\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+(?\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,40 +276,51 @@ 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" alias arc="jix-shell arc" - alias solr="ssh -L 1214:localhost:8983 solr@gnu.dev.job.dk firefox http://localhost:1214/solr/" + alias solr="ssh -L 1214:localhost:8983 solr@gnu.dev.job.dk firefox http://localhost:1214/solr/" alias push-to-production="jix-shell push_to_production.sh" 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