learn-test 3.2.1.pre.5 → 3.2.1.pre.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/learn-test-wip +8 -115
- data/lib/learn_test/git_wip.rb +4 -5
- data/lib/learn_test/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8794c9f5f79754792e07d3d25d4394cb893f1156c2f90ddf49fa791e3295ed5b
|
4
|
+
data.tar.gz: 106bb411827dd6cc527f5f2703f1720a7cb5abd4f950fae6f9429da46beef4c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0499f0e0986bc8e1a2e8425bfdf364c701540b8f7e799055b7929868fecec7a5c4812a0df10deaf310f5efff8d22d7caa5e3b046f96b719757d32c81f2269e8
|
7
|
+
data.tar.gz: 51369aeb558ad730d61618dbcf426c99250d4368c7b3baec7e0d858e39a29cf18d378cabad353bb2ea13164a3adaa60731ca5ec8de1d3ca6b22cfdacb4eca005
|
data/bin/learn-test-wip
CHANGED
@@ -15,15 +15,12 @@
|
|
15
15
|
# Please see http://www.gnu.org/licenses/gpl-2.0.txt
|
16
16
|
#
|
17
17
|
|
18
|
-
USAGE='[
|
18
|
+
USAGE='[ save <message> [ --editor | --untracked | --no-gpg-sign ] | delete ] [ [--] <file>... ]'
|
19
19
|
LONG_USAGE="Manage Work In Progress branches
|
20
20
|
|
21
21
|
Commands:
|
22
22
|
git wip - create a new WIP commit
|
23
23
|
git wip save <message> - create a new WIP commit with custom message
|
24
|
-
git wip info [<branch>] - brief WIP info
|
25
|
-
git wip log [<branch>] - show changes on the WIP branch
|
26
|
-
git wip delete [<branch>] - delete a WIP branch
|
27
24
|
|
28
25
|
Options for save:
|
29
26
|
-e --editor - be less verbose, assume called from an editor
|
@@ -31,19 +28,19 @@ Options for save:
|
|
31
28
|
-i --ignored - capture also ignored files
|
32
29
|
--no-gpg-sign - do not sign commit; that is, countermand
|
33
30
|
'commit.gpgSign = true'
|
34
|
-
|
35
|
-
Options for log:
|
36
|
-
-p --pretty - show a pretty graph
|
37
|
-
-r --reflog - show changes in reflog
|
38
|
-
-s --stat - show diffstat
|
39
31
|
"
|
40
32
|
|
41
33
|
source "$(git --exec-path)/git-sh-setup"
|
42
34
|
|
43
35
|
require_work_tree
|
44
36
|
|
45
|
-
TMP
|
46
|
-
|
37
|
+
TMP=$(mktemp -d -t .git-wip)
|
38
|
+
|
39
|
+
cleanup () {
|
40
|
+
rm -f "$TMP-*"
|
41
|
+
}
|
42
|
+
|
43
|
+
trap cleanup 0
|
47
44
|
|
48
45
|
WIP_INDEX="$TMP-INDEX"
|
49
46
|
|
@@ -65,10 +62,6 @@ report_soft_error () {
|
|
65
62
|
die "$@"
|
66
63
|
}
|
67
64
|
|
68
|
-
cleanup () {
|
69
|
-
rm -f "$TMP-*"
|
70
|
-
}
|
71
|
-
|
72
65
|
get_work_branch () {
|
73
66
|
ref=$(git symbolic-ref -q HEAD) \
|
74
67
|
|| report_soft_error "git-wip requires a branch"
|
@@ -82,10 +75,6 @@ get_work_branch () {
|
|
82
75
|
echo $branch
|
83
76
|
}
|
84
77
|
|
85
|
-
get_wip_branch () {
|
86
|
-
return 0
|
87
|
-
}
|
88
|
-
|
89
78
|
check_files () {
|
90
79
|
local -a files="$@"
|
91
80
|
|
@@ -220,86 +209,6 @@ do_save () {
|
|
220
209
|
dbg "SUCCESS"
|
221
210
|
}
|
222
211
|
|
223
|
-
do_info () {
|
224
|
-
local branch=$1
|
225
|
-
|
226
|
-
die "info not implemented"
|
227
|
-
}
|
228
|
-
|
229
|
-
do_log () {
|
230
|
-
local work_branch=$1
|
231
|
-
[ -z $branch ] && work_branch=$(get_work_branch)
|
232
|
-
local wip_branch="$WIP_PREFIX$work_branch"
|
233
|
-
|
234
|
-
local log_cmd="log"
|
235
|
-
local graph=""
|
236
|
-
local pretty=""
|
237
|
-
local stat=""
|
238
|
-
while [ -n "$1" ]
|
239
|
-
do
|
240
|
-
case "$1" in
|
241
|
-
-p|--pretty)
|
242
|
-
graph="--graph"
|
243
|
-
pretty="--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
|
244
|
-
;;
|
245
|
-
-s|--stat)
|
246
|
-
stat="--stat"
|
247
|
-
;;
|
248
|
-
-r|--reflog)
|
249
|
-
log_cmd="reflog"
|
250
|
-
;;
|
251
|
-
*)
|
252
|
-
break
|
253
|
-
;;
|
254
|
-
esac
|
255
|
-
shift
|
256
|
-
done
|
257
|
-
|
258
|
-
if [ $log_cmd = reflog ]
|
259
|
-
then
|
260
|
-
echo git reflog $stat $pretty $wip_branch | sh
|
261
|
-
return $?
|
262
|
-
fi
|
263
|
-
|
264
|
-
if ! work_last=$(git rev-parse --verify $work_branch)
|
265
|
-
then
|
266
|
-
die "'$work_branch' branch has no commits."
|
267
|
-
fi
|
268
|
-
|
269
|
-
dbg work_last=$work_last
|
270
|
-
|
271
|
-
if ! wip_last=$(git rev-parse --quiet --verify $wip_branch)
|
272
|
-
then
|
273
|
-
die "'$work_branch' branch has no commits."
|
274
|
-
fi
|
275
|
-
|
276
|
-
dbg wip_last=$wip_last
|
277
|
-
|
278
|
-
local base=$(git merge-base $wip_last $work_last)
|
279
|
-
|
280
|
-
dbg base=$base
|
281
|
-
|
282
|
-
echo git log $graph $stat $pretty $@ $wip_last $work_last "^$base~1" | sh
|
283
|
-
}
|
284
|
-
|
285
|
-
do_delete () {
|
286
|
-
local branch=$1
|
287
|
-
|
288
|
-
die "delete not implemented"
|
289
|
-
}
|
290
|
-
|
291
|
-
do_help () {
|
292
|
-
local rc=$1
|
293
|
-
|
294
|
-
cat <<END
|
295
|
-
Usage: git wip $USAGE
|
296
|
-
|
297
|
-
$LONG_USAGE
|
298
|
-
END
|
299
|
-
exit $rc
|
300
|
-
}
|
301
|
-
|
302
|
-
|
303
212
|
if test $# -eq 0
|
304
213
|
then
|
305
214
|
dbg "no arguments"
|
@@ -320,13 +229,6 @@ save)
|
|
320
229
|
shift
|
321
230
|
fi
|
322
231
|
;;
|
323
|
-
info|log|delete)
|
324
|
-
WIP_COMMAND=$1
|
325
|
-
shift
|
326
|
-
;;
|
327
|
-
help)
|
328
|
-
do_help 0
|
329
|
-
;;
|
330
232
|
--*)
|
331
233
|
;;
|
332
234
|
*)
|
@@ -338,15 +240,6 @@ case $WIP_COMMAND in
|
|
338
240
|
save)
|
339
241
|
do_save "$WIP_MESSAGE" $@
|
340
242
|
;;
|
341
|
-
info)
|
342
|
-
do_info $@
|
343
|
-
;;
|
344
|
-
log)
|
345
|
-
do_log $@
|
346
|
-
;;
|
347
|
-
delete)
|
348
|
-
do_delete $@
|
349
|
-
;;
|
350
243
|
*)
|
351
244
|
usage
|
352
245
|
exit 1
|
data/lib/learn_test/git_wip.rb
CHANGED
@@ -9,10 +9,10 @@ module LearnTest
|
|
9
9
|
git = Git.open('./', log: log)
|
10
10
|
working_branch = git.current_branch
|
11
11
|
|
12
|
-
Open3.popen3('learn-test-wip save "Automatic test submission" --editor') do |_stdin,
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
Open3.popen3('learn-test-wip save "Automatic test submission" --editor') do |_stdin, stdout, stderr, wait_thr|
|
13
|
+
while out = stdout.gets do
|
14
|
+
puts out
|
15
|
+
end
|
16
16
|
|
17
17
|
while err = stderr.gets do
|
18
18
|
puts err
|
@@ -21,7 +21,6 @@ module LearnTest
|
|
21
21
|
if wait_thr.value.exitstatus.zero?
|
22
22
|
git.push('origin', "wip/#{working_branch}:refs/heads/wip")
|
23
23
|
git.config['remote.origin.url'].gsub('.git', '/tree/wip')
|
24
|
-
true
|
25
24
|
else
|
26
25
|
puts 'There was an error running learn-test-wip'
|
27
26
|
false
|
data/lib/learn_test/version.rb
CHANGED