wifi test

Dependencies:   X_NUCLEO_IKS01A2 mbed-http

Committer:
JMF
Date:
Wed Sep 05 14:28:24 2018 +0000
Revision:
0:24d3eb812fd4
Initial commit

Who changed what in which revision?

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