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