Hi Some days ago Tassilo Horn posted on the git mailing list the following question
,---- | Is there a branch which | | a) hasn't been merged into the current branch yet, | b) has a common predecessor with the current branch, | c) changed file XXX in a significant way (expressed maybe as a ratio of | changed lines when diffing that file on the other branch and the | current one and the number of lines in the file). `---- The full article is available https://groups.google.com/d/msgid/git-users/87eekseyal.fsf%40gnu.org. Some days later he posted a shell script which I attach. I am curious could this be «translated» to mercurial? Two essential commands are git branch --remote --list --no-merged HEAD `git log -n1 --since='3 months' $branch` Which I think would be in mercurial: hg log -r tip -T '{count(revset("head()"))}\n' \ `hg log -r"date('-90')"' $branch` But my script did not work, I attach both, maybe somebody finds it useful and tries to make it work? Regards Uwe Brauer
#!/bin/sh # my-check-conflict.sh # Created Wed Nov 18 2020 by Uwe Brauer [email protected] # $Id$ # $Log$ file="$1" # Non-merged branches which have had activity within the last 3 month. active_branches () { git branch --remote --list --no-merged HEAD \h | while read branch; do commit=`git log -n1 --since='3 months' $branch` if [ x"$commit" != "x" ]; then echo $branch fi done } printf "%15s | %6s%% | %s\n" 'LOC changed' '' 'branch' for branch in `active_branches`; do changed_lines=`git diff HEAD..$branch -- $file \ | grep '^[+-][^+-]' \ | wc -l` if [ "$changed_lines" != "0" ]; then file_lines=`cat $file | wc -l` percentage=`echo "scale=4; x=$changed_lines/$file_lines*100; scale=2; (100*x)/100" | bc` printf "%15s | %6s%% | %s\n" "$changed_lines/$file_lines" "$percentage" "$branch" fi done
#!/bin/sh # my-check-conflict.sh # Created Wed Nov 18 2020 by Uwe Brauer [email protected] # $Id$ # $Log$ file="$1" # Non-merged branches which have had activity within the last 3 month. active_branches () { hg log -r tip -T '{count(revset("head()"))}\n' \ | while read branch; do commit=`hg log -r"date('-90')"' $branch` if [ x"$commit" != "x" ]; then echo $branch fi done } printf "%15s | %6s%% | %s\n" 'LOC changed' '' 'branch' for branch in `active_branches`; do changed_lines=`hg diff tip..$branch -- $file \ | grep '^[+-][^+-]' \ | wc -l` if [ "$changed_lines" != "0" ]; then file_lines=`cat $file | wc -l` percentage=`echo "scale=4; x=$changed_lines/$file_lines*100; scale=2; (100*x)/100" | bc` printf "%15s | %6s%% | %s\n" "$changed_lines/$file_lines" "$percentage" "$branch" fi done
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Mercurial mailing list [email protected] https://www.mercurial-scm.org/mailman/listinfo/mercurial
