Test pour écran OLED 128 x 64 SSD1306 avec sonde thermique DS18B20

Committer:
diltech
Date:
Sat May 28 13:22:32 2022 +0000
Revision:
0:8ae2868c8c6c
Projet initial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
diltech 0:8ae2868c8c6c 1 #!/bin/sh
diltech 0:8ae2868c8c6c 2 #
diltech 0:8ae2868c8c6c 3 # Copyright (c) 2006, 2008 Junio C Hamano
diltech 0:8ae2868c8c6c 4 #
diltech 0:8ae2868c8c6c 5 # The "pre-rebase" hook is run just before "git rebase" starts doing
diltech 0:8ae2868c8c6c 6 # its job, and can prevent the command from running by exiting with
diltech 0:8ae2868c8c6c 7 # non-zero status.
diltech 0:8ae2868c8c6c 8 #
diltech 0:8ae2868c8c6c 9 # The hook is called with the following parameters:
diltech 0:8ae2868c8c6c 10 #
diltech 0:8ae2868c8c6c 11 # $1 -- the upstream the series was forked from.
diltech 0:8ae2868c8c6c 12 # $2 -- the branch being rebased (or empty when rebasing the current branch).
diltech 0:8ae2868c8c6c 13 #
diltech 0:8ae2868c8c6c 14 # This sample shows how to prevent topic branches that are already
diltech 0:8ae2868c8c6c 15 # merged to 'next' branch from getting rebased, because allowing it
diltech 0:8ae2868c8c6c 16 # would result in rebasing already published history.
diltech 0:8ae2868c8c6c 17
diltech 0:8ae2868c8c6c 18 publish=next
diltech 0:8ae2868c8c6c 19 basebranch="$1"
diltech 0:8ae2868c8c6c 20 if test "$#" = 2
diltech 0:8ae2868c8c6c 21 then
diltech 0:8ae2868c8c6c 22 topic="refs/heads/$2"
diltech 0:8ae2868c8c6c 23 else
diltech 0:8ae2868c8c6c 24 topic=`git symbolic-ref HEAD` ||
diltech 0:8ae2868c8c6c 25 exit 0 ;# we do not interrupt rebasing detached HEAD
diltech 0:8ae2868c8c6c 26 fi
diltech 0:8ae2868c8c6c 27
diltech 0:8ae2868c8c6c 28 case "$topic" in
diltech 0:8ae2868c8c6c 29 refs/heads/??/*)
diltech 0:8ae2868c8c6c 30 ;;
diltech 0:8ae2868c8c6c 31 *)
diltech 0:8ae2868c8c6c 32 exit 0 ;# we do not interrupt others.
diltech 0:8ae2868c8c6c 33 ;;
diltech 0:8ae2868c8c6c 34 esac
diltech 0:8ae2868c8c6c 35
diltech 0:8ae2868c8c6c 36 # Now we are dealing with a topic branch being rebased
diltech 0:8ae2868c8c6c 37 # on top of master. Is it OK to rebase it?
diltech 0:8ae2868c8c6c 38
diltech 0:8ae2868c8c6c 39 # Does the topic really exist?
diltech 0:8ae2868c8c6c 40 git show-ref -q "$topic" || {
diltech 0:8ae2868c8c6c 41 echo >&2 "No such branch $topic"
diltech 0:8ae2868c8c6c 42 exit 1
diltech 0:8ae2868c8c6c 43 }
diltech 0:8ae2868c8c6c 44
diltech 0:8ae2868c8c6c 45 # Is topic fully merged to master?
diltech 0:8ae2868c8c6c 46 not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
diltech 0:8ae2868c8c6c 47 if test -z "$not_in_master"
diltech 0:8ae2868c8c6c 48 then
diltech 0:8ae2868c8c6c 49 echo >&2 "$topic is fully merged to master; better remove it."
diltech 0:8ae2868c8c6c 50 exit 1 ;# we could allow it, but there is no point.
diltech 0:8ae2868c8c6c 51 fi
diltech 0:8ae2868c8c6c 52
diltech 0:8ae2868c8c6c 53 # Is topic ever merged to next? If so you should not be rebasing it.
diltech 0:8ae2868c8c6c 54 only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
diltech 0:8ae2868c8c6c 55 only_next_2=`git rev-list ^master ${publish} | sort`
diltech 0:8ae2868c8c6c 56 if test "$only_next_1" = "$only_next_2"
diltech 0:8ae2868c8c6c 57 then
diltech 0:8ae2868c8c6c 58 not_in_topic=`git rev-list "^$topic" master`
diltech 0:8ae2868c8c6c 59 if test -z "$not_in_topic"
diltech 0:8ae2868c8c6c 60 then
diltech 0:8ae2868c8c6c 61 echo >&2 "$topic is already up to date with master"
diltech 0:8ae2868c8c6c 62 exit 1 ;# we could allow it, but there is no point.
diltech 0:8ae2868c8c6c 63 else
diltech 0:8ae2868c8c6c 64 exit 0
diltech 0:8ae2868c8c6c 65 fi
diltech 0:8ae2868c8c6c 66 else
diltech 0:8ae2868c8c6c 67 not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
diltech 0:8ae2868c8c6c 68 /usr/bin/perl -e '
diltech 0:8ae2868c8c6c 69 my $topic = $ARGV[0];
diltech 0:8ae2868c8c6c 70 my $msg = "* $topic has commits already merged to public branch:\n";
diltech 0:8ae2868c8c6c 71 my (%not_in_next) = map {
diltech 0:8ae2868c8c6c 72 /^([0-9a-f]+) /;
diltech 0:8ae2868c8c6c 73 ($1 => 1);
diltech 0:8ae2868c8c6c 74 } split(/\n/, $ARGV[1]);
diltech 0:8ae2868c8c6c 75 for my $elem (map {
diltech 0:8ae2868c8c6c 76 /^([0-9a-f]+) (.*)$/;
diltech 0:8ae2868c8c6c 77 [$1 => $2];
diltech 0:8ae2868c8c6c 78 } split(/\n/, $ARGV[2])) {
diltech 0:8ae2868c8c6c 79 if (!exists $not_in_next{$elem->[0]}) {
diltech 0:8ae2868c8c6c 80 if ($msg) {
diltech 0:8ae2868c8c6c 81 print STDERR $msg;
diltech 0:8ae2868c8c6c 82 undef $msg;
diltech 0:8ae2868c8c6c 83 }
diltech 0:8ae2868c8c6c 84 print STDERR " $elem->[1]\n";
diltech 0:8ae2868c8c6c 85 }
diltech 0:8ae2868c8c6c 86 }
diltech 0:8ae2868c8c6c 87 ' "$topic" "$not_in_next" "$not_in_master"
diltech 0:8ae2868c8c6c 88 exit 1
diltech 0:8ae2868c8c6c 89 fi
diltech 0:8ae2868c8c6c 90
diltech 0:8ae2868c8c6c 91 <<\DOC_END
diltech 0:8ae2868c8c6c 92
diltech 0:8ae2868c8c6c 93 This sample hook safeguards topic branches that have been
diltech 0:8ae2868c8c6c 94 published from being rewound.
diltech 0:8ae2868c8c6c 95
diltech 0:8ae2868c8c6c 96 The workflow assumed here is:
diltech 0:8ae2868c8c6c 97
diltech 0:8ae2868c8c6c 98 * Once a topic branch forks from "master", "master" is never
diltech 0:8ae2868c8c6c 99 merged into it again (either directly or indirectly).
diltech 0:8ae2868c8c6c 100
diltech 0:8ae2868c8c6c 101 * Once a topic branch is fully cooked and merged into "master",
diltech 0:8ae2868c8c6c 102 it is deleted. If you need to build on top of it to correct
diltech 0:8ae2868c8c6c 103 earlier mistakes, a new topic branch is created by forking at
diltech 0:8ae2868c8c6c 104 the tip of the "master". This is not strictly necessary, but
diltech 0:8ae2868c8c6c 105 it makes it easier to keep your history simple.
diltech 0:8ae2868c8c6c 106
diltech 0:8ae2868c8c6c 107 * Whenever you need to test or publish your changes to topic
diltech 0:8ae2868c8c6c 108 branches, merge them into "next" branch.
diltech 0:8ae2868c8c6c 109
diltech 0:8ae2868c8c6c 110 The script, being an example, hardcodes the publish branch name
diltech 0:8ae2868c8c6c 111 to be "next", but it is trivial to make it configurable via
diltech 0:8ae2868c8c6c 112 $GIT_DIR/config mechanism.
diltech 0:8ae2868c8c6c 113
diltech 0:8ae2868c8c6c 114 With this workflow, you would want to know:
diltech 0:8ae2868c8c6c 115
diltech 0:8ae2868c8c6c 116 (1) ... if a topic branch has ever been merged to "next". Young
diltech 0:8ae2868c8c6c 117 topic branches can have stupid mistakes you would rather
diltech 0:8ae2868c8c6c 118 clean up before publishing, and things that have not been
diltech 0:8ae2868c8c6c 119 merged into other branches can be easily rebased without
diltech 0:8ae2868c8c6c 120 affecting other people. But once it is published, you would
diltech 0:8ae2868c8c6c 121 not want to rewind it.
diltech 0:8ae2868c8c6c 122
diltech 0:8ae2868c8c6c 123 (2) ... if a topic branch has been fully merged to "master".
diltech 0:8ae2868c8c6c 124 Then you can delete it. More importantly, you should not
diltech 0:8ae2868c8c6c 125 build on top of it -- other people may already want to
diltech 0:8ae2868c8c6c 126 change things related to the topic as patches against your
diltech 0:8ae2868c8c6c 127 "master", so if you need further changes, it is better to
diltech 0:8ae2868c8c6c 128 fork the topic (perhaps with the same name) afresh from the
diltech 0:8ae2868c8c6c 129 tip of "master".
diltech 0:8ae2868c8c6c 130
diltech 0:8ae2868c8c6c 131 Let's look at this example:
diltech 0:8ae2868c8c6c 132
diltech 0:8ae2868c8c6c 133 o---o---o---o---o---o---o---o---o---o "next"
diltech 0:8ae2868c8c6c 134 / / / /
diltech 0:8ae2868c8c6c 135 / a---a---b A / /
diltech 0:8ae2868c8c6c 136 / / / /
diltech 0:8ae2868c8c6c 137 / / c---c---c---c B /
diltech 0:8ae2868c8c6c 138 / / / \ /
diltech 0:8ae2868c8c6c 139 / / / b---b C \ /
diltech 0:8ae2868c8c6c 140 / / / / \ /
diltech 0:8ae2868c8c6c 141 ---o---o---o---o---o---o---o---o---o---o---o "master"
diltech 0:8ae2868c8c6c 142
diltech 0:8ae2868c8c6c 143
diltech 0:8ae2868c8c6c 144 A, B and C are topic branches.
diltech 0:8ae2868c8c6c 145
diltech 0:8ae2868c8c6c 146 * A has one fix since it was merged up to "next".
diltech 0:8ae2868c8c6c 147
diltech 0:8ae2868c8c6c 148 * B has finished. It has been fully merged up to "master" and "next",
diltech 0:8ae2868c8c6c 149 and is ready to be deleted.
diltech 0:8ae2868c8c6c 150
diltech 0:8ae2868c8c6c 151 * C has not merged to "next" at all.
diltech 0:8ae2868c8c6c 152
diltech 0:8ae2868c8c6c 153 We would want to allow C to be rebased, refuse A, and encourage
diltech 0:8ae2868c8c6c 154 B to be deleted.
diltech 0:8ae2868c8c6c 155
diltech 0:8ae2868c8c6c 156 To compute (1):
diltech 0:8ae2868c8c6c 157
diltech 0:8ae2868c8c6c 158 git rev-list ^master ^topic next
diltech 0:8ae2868c8c6c 159 git rev-list ^master next
diltech 0:8ae2868c8c6c 160
diltech 0:8ae2868c8c6c 161 if these match, topic has not merged in next at all.
diltech 0:8ae2868c8c6c 162
diltech 0:8ae2868c8c6c 163 To compute (2):
diltech 0:8ae2868c8c6c 164
diltech 0:8ae2868c8c6c 165 git rev-list master..topic
diltech 0:8ae2868c8c6c 166
diltech 0:8ae2868c8c6c 167 if this is empty, it is fully merged to "master".
diltech 0:8ae2868c8c6c 168
diltech 0:8ae2868c8c6c 169 DOC_END