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 unalias gbr
fi fi
# alias gbr="git branch --sort=-committerdate" # 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 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) ^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) ^main --no-merges}; if ($merged) { $_ =~ s/^/[ ] / } else { $_ =~ s/^/[x] / };'; }
function ggn { git grep -Pn --color=always "$@" :/; } function ggn { git grep -Pn --color=always "$@" :/; }
function ggt { git grep -Pn --color=always "$@" t/lib ; } function ggt { git grep -Pn --color=always "$@" t/lib ; }
function ggp { ggn --color=always "$@" "$(git rev-list --all)"; } 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 { 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 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 "$@"; } 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 open_url="jix-shell open_url"
alias colorlog="jix-shell colorlog.pl" alias colorlog="jix-shell colorlog.pl"
alias jix-gettext="jix-shell jix-gettext" alias jix-gettext="jix-shell jix-gettext"
alias arc="jix-shell arc" 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" alias push-to-production="jix-shell push_to_production.sh"
function profiling { function profiling {
local JIX_USERID=233476; # userid of JRY 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; local ROOT=$1;
shift; shift;
if [[ $# -ge 1 ]]; then
local FORMAT=$1;
shift;
else
local FORMAT=;
fi
local FORM=$@; local FORM=$@;
local COMMAND='use Test::More; use Test::JIX::Mojo; local COMMAND='use Test::More; use Test::JIX::Mojo;
use JIX::Env; use JIX::Env;
DB::disable_profile; # backup solution for setting NYTPROF=start=no env variable 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 $t = Test::JIX::Mojo->new("JIX::Mojo");
my $c = JIX::CompanyUser->retrieve( { id => '"$JIX_USERID"' } ); my $c = JIX::CompanyUser->retrieve( { id => '"$JIX_USERID"' } );
$t->ua->inactivity_timeout(600); $t->ua->inactivity_timeout(600);
$t->auto_html5_ok(0); $t->auto_html5_ok(0);
$t->login_companyuser($c); $t->login_admin_companyuser($c);
$t->jix_get_ok([ "'"$ROOT"'", format=>"xml", form => { '"$FORM"' } ]); $t->jix_get_ok([ "'$ROOT'", format => "'$FORMAT'", form => { '"$FORM"' } ]);
for (0..9) { for (0..9) {
$t->login_companyuser($c); $t->login_admin_companyuser($c);
DB::enable_profile; DB::enable_profile;
$t->jix_get_ok([ "'"$ROOT"'", format=>"xml", form => { '"$FORM"' } ]); $t->jix_get_ok([ "'$ROOT'", format => "'$FORMAT'", form => { '"$FORM"' } ]);
DB::disable_profile; DB::disable_profile;
}; };
done_testing();'; done_testing();';
echo "Command:"; echo "Command:";
echo "perl -d:NYTProf -E '$COMMAND'"; echo "perl -d:NYTProf -E '$COMMAND'";
USER=jobdk NYTPROF=start=no perl -d:NYTProf -E "$COMMAND"; jix-shell USER="$ENV_USER" NYTPROF=start=no perl -d:NYTProf -E "$COMMAND";
nytprofhtml; rm -rf nytprof;
jix-shell nytprofhtml;
rm -rf nytprof.out;
} }
# Automatically keep a pointer to my latest SSH agent # Automatically keep a pointer to my latest SSH agent