Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gittools update and venv version check #471

Merged
merged 4 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bin/gencode
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -e

tmpfile=`mktemp`

# Fix sort order difference on different platforms.
export LC_ALL=C

Expand All @@ -13,6 +15,13 @@ if [[ -n $check ]]; then
bin/gencode_docs_examples check
fi

venv/bin/pip3 freeze > $tmpfile
if ! diff etc/requirements.txt $tmpfile; then
echo etc/requirements.txt differences found
echo please run bin/setup_base
false
fi

bin/gencode_java
bin/gencode_python gencode/python schema/*.json
bin/gencode_docs
Expand Down
2 changes: 1 addition & 1 deletion bin/git-branch-remote
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ git branch -a | while read branch; do
if git branch | fgrep $branch > /dev/null; then
lremote=$(git config branch.$branch.remote) || true
if [[ -z $lremote ]]; then
echo " git branch --set-upstream-to=$leader $branch # Reconnect orphaned remote branch"
echo " git branch --set-upstream=$leader $branch # Reconnect orphaned remote branch"
fi
continue # Branch locally, ignore remote...
fi
Expand Down
6 changes: 4 additions & 2 deletions bin/git-branch-status
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ current=$(git branch --show-current)
git for-each-ref --format="%(refname:short) %(upstream:short)" refs/heads | \
while read local remote; do
if [[ -n $remote ]]; then
git rev-list --left-right ${local}...${remote} -- 2>/dev/null >/tmp/git_upstream_status_delta || continue
git rev-list --left-right ${local}...${remote} -- 2>/dev/null >/tmp/git_upstream_status_delta || continue
LEFT_AHEAD=$(grep -c '^<' /tmp/git_upstream_status_delta)
RIGHT_AHEAD=$(grep -c '^>' /tmp/git_upstream_status_delta)
if [ "$LEFT_AHEAD" != 0 -a "$RIGHT_AHEAD" != 0 ]; then
Expand Down Expand Up @@ -56,6 +56,8 @@ git for-each-ref --format="%(refname:short) %(upstream:short)" refs/heads | \
description="(git config branch.$local.description 'TEST DESCRIPTION')"
fi

difflines=$(git diff --stat master $local -- | egrep "files? changed" | sed -E 's/[a-z ]*//g')

# Add a space after description if it exists
if [[ -n $description ]]; then
description="$description "
Expand All @@ -66,5 +68,5 @@ git for-each-ref --format="%(refname:short) %(upstream:short)" refs/heads | \
local="${local}*"
fi

printf "%-15s%-35s%s(%s)\n" $local "$OFFSET$POFF" "$description" "$merged"
printf "%-15s%-30s%-20s%s(%s)\n" $local "$OFFSET$POFF" "$difflines" "$description" "$merged"
done
6 changes: 5 additions & 1 deletion bin/git-branch-update
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ while read local remote; do
fi

if [[ -z $pmsg && -z $remote ]]; then
pmsg=" (remote not configured, use 'git push --set-upstream-to $origin $local' to configure)"
pmsg=" (remote not configured, use 'git push --set-upstream $origin $local' to configure)"
fi

echo Updating branch $local$pmsg...
Expand All @@ -69,6 +69,10 @@ while read local remote; do
masterdiff=$(git diff $parent | wc -l) || true
if [[ $local != $parent && $masterdiff -eq 0 ]]; then
echo " git branch -D $local # Branch is identical to $parent, use to delete"
masteroff=$(git rev-list $parent...$local -- | wc -l) || true
if [[ $masteroff -ne 0 ]]; then
echo " git switch $local && git reset --hard $parent && git push --force # To squash redundant commits"
fi
fi
fi

Expand Down