git_reflow 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +4 -4
- data/Rakefile +4 -7
- data/bin/console +7 -0
- data/bin/setup +6 -0
- data/{bin → exe}/git-reflow +0 -0
- data/git_reflow.gemspec +7 -7
- data/lib/git_reflow/commands/setup.rb +5 -1
- data/lib/git_reflow/git_server/git_hub/pull_request.rb +14 -2
- data/lib/git_reflow/git_server/pull_request.rb +52 -4
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow.rb +1 -7
- data/spec/git_reflow_spec.rb +45 -10
- data/spec/lgtm_git_reflow_spec.rb +496 -0
- data/spec/lib/git_server/git_hub/pull_request_spec.rb +166 -15
- data/spec/lib/git_server/pull_request_spec.rb +321 -22
- metadata +18 -17
- data/bin/gitreflow-common +0 -314
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_reflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentino Stoll
|
8
8
|
- Robert Stern
|
9
9
|
- Nicholas Hance
|
10
10
|
autorequire:
|
11
|
-
bindir:
|
11
|
+
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-04-
|
13
|
+
date: 2016-04-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: appraisal
|
@@ -30,16 +30,16 @@ dependencies:
|
|
30
30
|
name: bundler
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- - "
|
33
|
+
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
35
|
+
version: '1.11'
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - "
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '1.11'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: chronic
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,16 +72,16 @@ dependencies:
|
|
72
72
|
name: rake
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- - "
|
75
|
+
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
77
|
+
version: '10.0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- - "
|
82
|
+
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: '0'
|
84
|
+
version: '10.0'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: rdoc
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,14 +102,14 @@ dependencies:
|
|
102
102
|
requirements:
|
103
103
|
- - "~>"
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: 3.0
|
105
|
+
version: '3.0'
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 3.0
|
112
|
+
version: '3.0'
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: webmock
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -227,7 +227,6 @@ email:
|
|
227
227
|
- dev@reenhanced.com
|
228
228
|
executables:
|
229
229
|
- git-reflow
|
230
|
-
- gitreflow-common
|
231
230
|
extensions: []
|
232
231
|
extra_rdoc_files:
|
233
232
|
- README.rdoc
|
@@ -240,9 +239,10 @@ files:
|
|
240
239
|
- LICENSE
|
241
240
|
- README.rdoc
|
242
241
|
- Rakefile
|
243
|
-
- bin/
|
244
|
-
- bin/
|
242
|
+
- bin/console
|
243
|
+
- bin/setup
|
245
244
|
- circle.yml
|
245
|
+
- exe/git-reflow
|
246
246
|
- git_reflow.gemspec
|
247
247
|
- lib/git_reflow.rb
|
248
248
|
- lib/git_reflow/base.rb
|
@@ -282,6 +282,7 @@ files:
|
|
282
282
|
- spec/fixtures/repositories/commits.json.erb
|
283
283
|
- spec/fixtures/repositories/statuses.json
|
284
284
|
- spec/git_reflow_spec.rb
|
285
|
+
- spec/lgtm_git_reflow_spec.rb
|
285
286
|
- spec/lib/git_reflow/config_spec.rb
|
286
287
|
- spec/lib/git_reflow/git_helpers_spec.rb
|
287
288
|
- spec/lib/git_reflow/git_server_spec.rb
|
@@ -311,7 +312,6 @@ rdoc_options:
|
|
311
312
|
- "-ri"
|
312
313
|
require_paths:
|
313
314
|
- lib
|
314
|
-
- lib
|
315
315
|
required_ruby_version: !ruby/object:Gem::Requirement
|
316
316
|
requirements:
|
317
317
|
- - ">="
|
@@ -347,6 +347,7 @@ test_files:
|
|
347
347
|
- spec/fixtures/repositories/commits.json.erb
|
348
348
|
- spec/fixtures/repositories/statuses.json
|
349
349
|
- spec/git_reflow_spec.rb
|
350
|
+
- spec/lgtm_git_reflow_spec.rb
|
350
351
|
- spec/lib/git_reflow/config_spec.rb
|
351
352
|
- spec/lib/git_reflow/git_helpers_spec.rb
|
352
353
|
- spec/lib/git_reflow/git_server_spec.rb
|
data/bin/gitreflow-common
DELETED
@@ -1,314 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
# git-flow -- A collection of Git extensions to provide high-level
|
3
|
-
# repository operations for Vincent Driessen's branching model.
|
4
|
-
#
|
5
|
-
# Original blog post presenting this model is found at:
|
6
|
-
# http://nvie.com/git-model
|
7
|
-
#
|
8
|
-
# Feel free to contribute to this project at:
|
9
|
-
# http://github.com/nvie/gitreflow
|
10
|
-
#
|
11
|
-
# Copyright 2010 Vincent Driessen. All rights reserved.
|
12
|
-
#
|
13
|
-
# Redistribution and use in source and binary forms, with or without
|
14
|
-
# modification, are permitted provided that the following conditions are met:
|
15
|
-
#
|
16
|
-
# 1. Redistributions of source code must retain the above copyright notice,
|
17
|
-
# this list of conditions and the following disclaimer.
|
18
|
-
#
|
19
|
-
# 2. Redistributions in binary form must reproduce the above copyright
|
20
|
-
# notice, this list of conditions and the following disclaimer in the
|
21
|
-
# documentation and/or other materials provided with the distribution.
|
22
|
-
#
|
23
|
-
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
|
24
|
-
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
25
|
-
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
26
|
-
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
27
|
-
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
28
|
-
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
29
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
30
|
-
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
31
|
-
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
32
|
-
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
33
|
-
#
|
34
|
-
# The views and conclusions contained in the software and documentation are
|
35
|
-
# those of the authors and should not be interpreted as representing official
|
36
|
-
# policies, either expressed or implied, of Vincent Driessen.
|
37
|
-
#
|
38
|
-
|
39
|
-
#
|
40
|
-
# Common functionality
|
41
|
-
#
|
42
|
-
|
43
|
-
# shell output
|
44
|
-
warn() { echo "$@" >&2; }
|
45
|
-
die() { warn "$@"; exit 1; }
|
46
|
-
|
47
|
-
escape() {
|
48
|
-
echo "$1" | sed 's/\([\.\+\$\*]\)/\\\1/g'
|
49
|
-
}
|
50
|
-
|
51
|
-
# set logic
|
52
|
-
has() {
|
53
|
-
local item=$1; shift
|
54
|
-
echo " $@ " | grep -q " $(escape $item) "
|
55
|
-
}
|
56
|
-
|
57
|
-
# basic math
|
58
|
-
min() { [ "$1" -le "$2" ] && echo "$1" || echo "$2"; }
|
59
|
-
max() { [ "$1" -ge "$2" ] && echo "$1" || echo "$2"; }
|
60
|
-
|
61
|
-
# basic string matching
|
62
|
-
startswith() { [ "$1" != "${1#$2}" ]; }
|
63
|
-
endswith() { [ "$1" != "${1%$2}" ]; }
|
64
|
-
|
65
|
-
#
|
66
|
-
# Git specific common functionality
|
67
|
-
#
|
68
|
-
|
69
|
-
git_local_branches() { git branch --no-color | sed 's/^[* ] //'; }
|
70
|
-
git_remote_branches() { git branch -r --no-color | sed 's/^[* ] //'; }
|
71
|
-
git_all_branches() { ( git branch --no-color; git branch -r --no-color) | sed 's/^[* ] //'; }
|
72
|
-
git_all_tags() { git tag; }
|
73
|
-
|
74
|
-
git_current_branch() {
|
75
|
-
git branch --no-color | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g'
|
76
|
-
}
|
77
|
-
|
78
|
-
git_is_clean_working_tree() {
|
79
|
-
if ! git diff --no-ext-diff --ignore-submodules --quiet --exit-code; then
|
80
|
-
return 1
|
81
|
-
elif ! git diff-index --cached --quiet --ignore-submodules HEAD --; then
|
82
|
-
return 2
|
83
|
-
else
|
84
|
-
return 0
|
85
|
-
fi
|
86
|
-
}
|
87
|
-
|
88
|
-
git_repo_is_headless() {
|
89
|
-
! git rev-parse --quiet --verify HEAD >/dev/null 2>&1
|
90
|
-
}
|
91
|
-
|
92
|
-
git_local_branch_exists() {
|
93
|
-
has $1 $(git_local_branches)
|
94
|
-
}
|
95
|
-
|
96
|
-
git_remote_branch_exists() {
|
97
|
-
has $1 $(git_remote_branches)
|
98
|
-
}
|
99
|
-
|
100
|
-
git_branch_exists() {
|
101
|
-
has $1 $(git_all_branches)
|
102
|
-
}
|
103
|
-
|
104
|
-
git_tag_exists() {
|
105
|
-
has $1 $(git_all_tags)
|
106
|
-
}
|
107
|
-
|
108
|
-
#
|
109
|
-
# git_compare_branches()
|
110
|
-
#
|
111
|
-
# Tests whether branches and their "origin" counterparts have diverged and need
|
112
|
-
# merging first. It returns error codes to provide more detail, like so:
|
113
|
-
#
|
114
|
-
# 0 Branch heads point to the same commit
|
115
|
-
# 1 First given branch needs fast-forwarding
|
116
|
-
# 2 Second given branch needs fast-forwarding
|
117
|
-
# 3 Branch needs a real merge
|
118
|
-
# 4 There is no merge base, i.e. the branches have no common ancestors
|
119
|
-
#
|
120
|
-
git_compare_branches() {
|
121
|
-
local commit1=$(git rev-parse "$1")
|
122
|
-
local commit2=$(git rev-parse "$2")
|
123
|
-
if [ "$commit1" != "$commit2" ]; then
|
124
|
-
local base=$(git merge-base "$commit1" "$commit2")
|
125
|
-
if [ $? -ne 0 ]; then
|
126
|
-
return 4
|
127
|
-
elif [ "$commit1" = "$base" ]; then
|
128
|
-
return 1
|
129
|
-
elif [ "$commit2" = "$base" ]; then
|
130
|
-
return 2
|
131
|
-
else
|
132
|
-
return 3
|
133
|
-
fi
|
134
|
-
else
|
135
|
-
return 0
|
136
|
-
fi
|
137
|
-
}
|
138
|
-
|
139
|
-
#
|
140
|
-
# git_is_branch_merged_into()
|
141
|
-
#
|
142
|
-
# Checks whether branch $1 is succesfully merged into $2
|
143
|
-
#
|
144
|
-
git_is_branch_merged_into() {
|
145
|
-
local subject=$1
|
146
|
-
local base=$2
|
147
|
-
local all_merges="$(git branch --no-color --contains $subject | sed 's/^[* ] //')"
|
148
|
-
has $base $all_merges
|
149
|
-
}
|
150
|
-
|
151
|
-
#
|
152
|
-
# gitreflow specific common functionality
|
153
|
-
#
|
154
|
-
|
155
|
-
# check if this repo has been inited for gitreflow
|
156
|
-
gitreflow_has_master_configured() {
|
157
|
-
local master=$(git config --get gitreflow.branch.master)
|
158
|
-
[ "$master" != "" ] && git_local_branch_exists "$master"
|
159
|
-
}
|
160
|
-
|
161
|
-
gitreflow_has_develop_configured() {
|
162
|
-
local develop=$(git config --get gitreflow.branch.develop)
|
163
|
-
[ "$develop" != "" ] && git_local_branch_exists "$develop"
|
164
|
-
}
|
165
|
-
|
166
|
-
gitreflow_has_prefixes_configured() {
|
167
|
-
git config --get gitreflow.prefix.feature >/dev/null 2>&1 && \
|
168
|
-
git config --get gitreflow.prefix.release >/dev/null 2>&1 && \
|
169
|
-
git config --get gitreflow.prefix.hotfix >/dev/null 2>&1 && \
|
170
|
-
git config --get gitreflow.prefix.support >/dev/null 2>&1 && \
|
171
|
-
git config --get gitreflow.prefix.versiontag >/dev/null 2>&1
|
172
|
-
}
|
173
|
-
|
174
|
-
gitreflow_is_initialized() {
|
175
|
-
gitreflow_has_master_configured && \
|
176
|
-
gitreflow_has_develop_configured && \
|
177
|
-
[ "$(git config --get gitreflow.branch.master)" != \
|
178
|
-
"$(git config --get gitreflow.branch.develop)" ] && \
|
179
|
-
gitreflow_has_prefixes_configured
|
180
|
-
}
|
181
|
-
|
182
|
-
# loading settings that can be overridden using git config
|
183
|
-
gitreflow_load_settings() {
|
184
|
-
export DOT_GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
|
185
|
-
export MASTER_BRANCH=$(git config --get gitreflow.branch.master)
|
186
|
-
export DEVELOP_BRANCH=$(git config --get gitreflow.branch.develop)
|
187
|
-
export ORIGIN=$(git config --get gitreflow.origin || echo origin)
|
188
|
-
}
|
189
|
-
|
190
|
-
#
|
191
|
-
# gitreflow_resolve_nameprefix
|
192
|
-
#
|
193
|
-
# Inputs:
|
194
|
-
# $1 = name prefix to resolve
|
195
|
-
# $2 = branch prefix to use
|
196
|
-
#
|
197
|
-
# Searches branch names from git_local_branches() to look for a unique
|
198
|
-
# branch name whose name starts with the given name prefix.
|
199
|
-
#
|
200
|
-
# There are multiple exit codes possible:
|
201
|
-
# 0: The unambiguous full name of the branch is written to stdout
|
202
|
-
# (success)
|
203
|
-
# 1: No match is found.
|
204
|
-
# 2: Multiple matches found. These matches are written to stderr
|
205
|
-
#
|
206
|
-
gitreflow_resolve_nameprefix() {
|
207
|
-
local name=$1
|
208
|
-
local prefix=$2
|
209
|
-
local matches
|
210
|
-
local num_matches
|
211
|
-
|
212
|
-
# first, check if there is a perfect match
|
213
|
-
if git_local_branch_exists "$prefix$name"; then
|
214
|
-
echo "$name"
|
215
|
-
return 0
|
216
|
-
fi
|
217
|
-
|
218
|
-
matches=$(echo "$(git_local_branches)" | grep "^$(escape "$prefix$name")")
|
219
|
-
num_matches=$(echo "$matches" | wc -l)
|
220
|
-
if [ -z "$matches" ]; then
|
221
|
-
# no prefix match, so take it literally
|
222
|
-
warn "No branch matches prefix '$name'"
|
223
|
-
return 1
|
224
|
-
else
|
225
|
-
if [ $num_matches -eq 1 ]; then
|
226
|
-
echo "${matches#$prefix}"
|
227
|
-
return 0
|
228
|
-
else
|
229
|
-
# multiple matches, cannot decide
|
230
|
-
warn "Multiple branches match prefix '$name':"
|
231
|
-
for match in $matches; do
|
232
|
-
warn "- $match"
|
233
|
-
done
|
234
|
-
return 2
|
235
|
-
fi
|
236
|
-
fi
|
237
|
-
}
|
238
|
-
|
239
|
-
#
|
240
|
-
# Assertions for use in git-flow subcommands
|
241
|
-
#
|
242
|
-
|
243
|
-
require_git_repo() {
|
244
|
-
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
245
|
-
die "fatal: Not a git repository"
|
246
|
-
fi
|
247
|
-
}
|
248
|
-
|
249
|
-
require_gitreflow_initialized() {
|
250
|
-
if ! gitreflow_is_initialized; then
|
251
|
-
die "fatal: Not a gitreflow-enabled repo yet. Please run \"git flow init\" first."
|
252
|
-
fi
|
253
|
-
}
|
254
|
-
|
255
|
-
require_clean_working_tree() {
|
256
|
-
git_is_clean_working_tree
|
257
|
-
local result=$?
|
258
|
-
if [ $result -eq 1 ]; then
|
259
|
-
die "fatal: Working tree contains unstaged changes. Aborting."
|
260
|
-
fi
|
261
|
-
if [ $result -eq 2 ]; then
|
262
|
-
die "fatal: Index contains uncommitted changes. Aborting."
|
263
|
-
fi
|
264
|
-
}
|
265
|
-
|
266
|
-
require_local_branch() {
|
267
|
-
if ! git_local_branch_exists $1; then
|
268
|
-
die "fatal: Local branch '$1' does not exist and is required."
|
269
|
-
fi
|
270
|
-
}
|
271
|
-
|
272
|
-
require_remote_branch() {
|
273
|
-
if ! has $1 $(git_remote_branches); then
|
274
|
-
die "Remote branch '$1' does not exist and is required."
|
275
|
-
fi
|
276
|
-
}
|
277
|
-
|
278
|
-
require_branch() {
|
279
|
-
if ! has $1 $(git_all_branches); then
|
280
|
-
die "Branch '$1' does not exist and is required."
|
281
|
-
fi
|
282
|
-
}
|
283
|
-
|
284
|
-
require_branch_absent() {
|
285
|
-
if has $1 $(git_all_branches); then
|
286
|
-
die "Branch '$1' already exists. Pick another name."
|
287
|
-
fi
|
288
|
-
}
|
289
|
-
|
290
|
-
require_tag_absent() {
|
291
|
-
for tag in $(git_all_tags); do
|
292
|
-
if [ "$1" = "$tag" ]; then
|
293
|
-
die "Tag '$1' already exists. Pick another name."
|
294
|
-
fi
|
295
|
-
done
|
296
|
-
}
|
297
|
-
|
298
|
-
require_branches_equal() {
|
299
|
-
require_local_branch "$1"
|
300
|
-
require_remote_branch "$2"
|
301
|
-
git_compare_branches "$1" "$2"
|
302
|
-
local status=$?
|
303
|
-
if [ $status -gt 0 ]; then
|
304
|
-
warn "Branches '$1' and '$2' have diverged."
|
305
|
-
if [ $status -eq 1 ]; then
|
306
|
-
die "And branch '$1' may be fast-forwarded."
|
307
|
-
elif [ $status -eq 2 ]; then
|
308
|
-
# Warn here, since there is no harm in being ahead
|
309
|
-
warn "And local branch '$1' is ahead of '$2'."
|
310
|
-
else
|
311
|
-
die "Branches need merging first."
|
312
|
-
fi
|
313
|
-
fi
|
314
|
-
}
|