git-stash-commit 1.0.0 → 1.0.1
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/README.md +5 -6
- data/bench/bench.rb +43 -0
- data/bin/console +0 -0
- data/bin/git-stash-commit +0 -0
- data/bin/rake +0 -0
- data/bin/setup +0 -0
- data/exe/git-stash-commit +0 -0
- data/lib/git/stash/commit.rb +25 -25
- data/lib/git/stash/commit/version.rb +1 -1
- data/lib/git/stash/sclib/branch.rb +0 -0
- data/lib/git/stash/sclib/command.rb +10 -2
- data/lib/git/stash/sclib/define.rb +0 -0
- data/lib/git/stash/sclib/util.rb +24 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20ac3cd1968e1f48667a321a7386d5c7b6e21af2
|
4
|
+
data.tar.gz: 6d0d3ad2d2433db4278424118e738f48d91c5cae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60e6a345db6e3c68013d9b15c638c6c1ae340c2d4cd5a601b3f348bbd719a765c17d7da3b2e036a293536bc3699268d39b71134e0f4c3b09447ae46de65fd125
|
7
|
+
data.tar.gz: b84aa04040528f214ea51ee7d8765edc2d117183df23a336e4e01bbbd3340d82cde6fd4b94e100a49bb1911d5a3ac6af913d42724e681363cc432b8d1ac081f7
|
data/README.md
CHANGED
@@ -57,8 +57,6 @@ unstash branch, if when run 'git stash-commit --from NAME', apply 'stash-commit/
|
|
57
57
|
\
|
58
58
|
* <-- stash-commit/topic@1
|
59
59
|
|
60
|
-
if use the '--patch' option, only patch is commit.
|
61
|
-
|
62
60
|
|
63
61
|
## git-stash-commit commands
|
64
62
|
|
@@ -99,12 +97,13 @@ if conflict of 'stash-commit [--to N] [-p]' command, working branch remains.
|
|
99
97
|
- delete on complete
|
100
98
|
* stash-commit/*topic*@*to*-progresstmp
|
101
99
|
- growth commit branch, contains change files of 'commit --patch', it add to '--to' target branch
|
102
|
-
- delete on
|
100
|
+
- delete on complete
|
103
101
|
* stash-commit/*topic*@*to*-progresstmp-patch-remain
|
104
|
-
- commit remain branch, contains remain change files of 'commit --patch', it apply the current
|
102
|
+
- commit remain branch, contains remain change files of 'commit --patch', it apply the current working tree state
|
103
|
+
- delete on complete
|
105
104
|
|
106
|
-
if fixed CONFLICT, add to it and run 'git stash-commit --continue'
|
107
|
-
if cancel this time, run 'git stash-commit --abort'
|
105
|
+
if fixed CONFLICT, add to it and run 'git stash-commit --continue'
|
106
|
+
if cancel this time, run 'git stash-commit --abort'
|
108
107
|
if skip this time, run 'git stash-commit --skip'
|
109
108
|
|
110
109
|
these options behave like rebase.
|
data/bench/bench.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'benchmark'
|
4
|
+
require 'git/stash/sclib/command.rb'
|
5
|
+
|
6
|
+
N = 20
|
7
|
+
|
8
|
+
puts ":#{Cmd::branchName}:"
|
9
|
+
puts ":#{Cmd::revision}:"
|
10
|
+
puts ":#{Cmd::branchExist? 'develop'}:"
|
11
|
+
puts ":#{Cmd::branchRefExist? 'develop'}:"
|
12
|
+
puts ":#{Cmd::getTmp}:"
|
13
|
+
puts ":#{Cmd::getPatchRemain}:"
|
14
|
+
puts ":#{Cmd::getBackup}:"
|
15
|
+
puts ":#{Cmd::changesCount}:"
|
16
|
+
puts ":#{Cmd::parentChildBranch? 'HEAD', 'HEAD~'}:"
|
17
|
+
puts ":#{Cmd::sameBranch? 'HEAD', 'HEAD'}:"
|
18
|
+
puts ":#{Cmd::mergeBaseHash 'master~', 'master'}:"
|
19
|
+
|
20
|
+
def registBench(r, title, &cb)
|
21
|
+
r.report title do
|
22
|
+
for i in 1..N-1
|
23
|
+
cb.call
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Benchmark.bm 20 do |r|
|
29
|
+
# 目安: これが限界一番軽い
|
30
|
+
registBench(r, 'tune limit' ){Cmd::tuneLimit}
|
31
|
+
#
|
32
|
+
registBench(r, 'branchName' ){Cmd::branchName}
|
33
|
+
registBench(r, 'revision' ){Cmd::revision}
|
34
|
+
registBench(r, 'branchExist' ){Cmd::branchExist? 'develop'}
|
35
|
+
registBench(r, 'branchRefExist' ){Cmd::branchRefExist? 'develop'}
|
36
|
+
registBench(r, 'getTmp' ){Cmd::getTmp}
|
37
|
+
registBench(r, 'getPatchRemain' ){Cmd::getPatchRemain}
|
38
|
+
registBench(r, 'getBackup' ){Cmd::getBackup}
|
39
|
+
registBench(r, 'changesCount' ){Cmd::changesCount}
|
40
|
+
registBench(r, 'parentChildBranch'){Cmd::parentChildBranch? 'HEAD', 'HEAD~'}
|
41
|
+
registBench(r, 'sameBranch' ){Cmd::sameBranch? 'HEAD', 'HEAD'}
|
42
|
+
registBench(r, 'mergeBaseHash' ){Cmd::mergeBaseHash 'master~', 'master'}
|
43
|
+
end
|
data/bin/console
CHANGED
File without changes
|
data/bin/git-stash-commit
CHANGED
File without changes
|
data/bin/rake
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
data/exe/git-stash-commit
CHANGED
File without changes
|
data/lib/git/stash/commit.rb
CHANGED
@@ -276,7 +276,7 @@ def tryStashCommitContinueTo(tmp, patch)
|
|
276
276
|
# rebase --skip後かもしれない
|
277
277
|
if Cmd::sameBranch? patch.name, root.name
|
278
278
|
puts "stop, '#{PATCH_REMAIN_SUFFIX}' rebase --skip found, from starting stash-commit --patch"
|
279
|
-
raise
|
279
|
+
raise ''
|
280
280
|
end
|
281
281
|
# rebase --abort後かもしれない
|
282
282
|
if !Cmd::parentChildBranch? patch.name, root.name
|
@@ -288,7 +288,7 @@ def tryStashCommitContinueTo(tmp, patch)
|
|
288
288
|
# rebase --skip後かもしれない
|
289
289
|
if Cmd::sameBranch? tmp.name, stash.name
|
290
290
|
puts "stop, '#{TMP_SUFFIX}' rebase --skip found, from starting stash-commit --to"
|
291
|
-
raise
|
291
|
+
raise ''
|
292
292
|
end
|
293
293
|
# rebase --abort後かもしれない
|
294
294
|
if !Cmd::parentChildBranch? tmp.name, stash.name
|
@@ -360,7 +360,7 @@ def tryStashCommitSkipTo(tmp, patch)
|
|
360
360
|
# rebase --continue後かもしれない
|
361
361
|
if Cmd::parentChildBranch? patch.name, root.name
|
362
362
|
puts "stop, '#{PATCH_REMAIN_SUFFIX}' rebase --continue found, from starting stash-commit --patch"
|
363
|
-
raise
|
363
|
+
raise ''
|
364
364
|
end
|
365
365
|
# rebase --abort後はスルー
|
366
366
|
end
|
@@ -369,7 +369,7 @@ def tryStashCommitSkipTo(tmp, patch)
|
|
369
369
|
# rebase --continue後かもしれない
|
370
370
|
if Cmd::parentChildBranch? tmp.name, stash.name
|
371
371
|
puts "stop, '#{TMP_SUFFIX}' rebase --continue found, from starting stash-commit --to"
|
372
|
-
raise
|
372
|
+
raise ''
|
373
373
|
end
|
374
374
|
# rebase --abort後はスルー
|
375
375
|
end
|
@@ -541,7 +541,7 @@ class ArgvIterator
|
|
541
541
|
else
|
542
542
|
puts '* error: argument is not enoufh'
|
543
543
|
usage
|
544
|
-
raise
|
544
|
+
raise ''
|
545
545
|
end
|
546
546
|
end
|
547
547
|
end
|
@@ -611,7 +611,7 @@ def main(argv)
|
|
611
611
|
else
|
612
612
|
puts "* error: unknown option:#{arg}"
|
613
613
|
usage
|
614
|
-
raise
|
614
|
+
raise ''
|
615
615
|
end
|
616
616
|
end
|
617
617
|
|
@@ -625,16 +625,16 @@ def main(argv)
|
|
625
625
|
# -----------------------------
|
626
626
|
if rebase != nil
|
627
627
|
begin
|
628
|
-
raise if !validateRebase
|
628
|
+
raise '' if !validateRebase
|
629
629
|
case rebase
|
630
630
|
when Rebase::CONTINUE
|
631
|
-
raise if !tryStashCommitContinue branch
|
631
|
+
raise '' if !tryStashCommitContinue branch
|
632
632
|
when Rebase::SKIP
|
633
|
-
raise if !tryStashCommitSkip branch
|
633
|
+
raise '' if !tryStashCommitSkip branch
|
634
634
|
when Rebase::ABORT
|
635
|
-
raise if !tryStashCommitAbort branch
|
635
|
+
raise '' if !tryStashCommitAbort branch
|
636
636
|
end
|
637
|
-
return
|
637
|
+
return
|
638
638
|
rescue => e
|
639
639
|
puts "* failed: stash-commit #{rebase}"
|
640
640
|
raise e
|
@@ -645,9 +645,9 @@ def main(argv)
|
|
645
645
|
# --------
|
646
646
|
if renameOld != nil
|
647
647
|
begin
|
648
|
-
raise if !validateRename branch, renameOld, renameNew
|
649
|
-
raise if !tryStashCommitRename branch, renameOld, renameNew
|
650
|
-
return
|
648
|
+
raise '' if !validateRename branch, renameOld, renameNew
|
649
|
+
raise '' if !tryStashCommitRename branch, renameOld, renameNew
|
650
|
+
return
|
651
651
|
rescue => e
|
652
652
|
puts '* failed: stash-commit --rename'
|
653
653
|
raise e
|
@@ -658,9 +658,9 @@ def main(argv)
|
|
658
658
|
# -------------
|
659
659
|
if from != nil
|
660
660
|
begin
|
661
|
-
raise if !validateFromTo from or !validateStashCommitFrom branch
|
662
|
-
raise if !tryStashCommitFrom branch, from
|
663
|
-
return
|
661
|
+
raise '' if !validateFromTo from or !validateStashCommitFrom branch
|
662
|
+
raise '' if !tryStashCommitFrom branch, from
|
663
|
+
return
|
664
664
|
rescue => e
|
665
665
|
puts '* failed: stash-commit --from (index | name)'
|
666
666
|
raise e
|
@@ -668,9 +668,9 @@ def main(argv)
|
|
668
668
|
elsif to != nil
|
669
669
|
# --to 指定がある時
|
670
670
|
begin
|
671
|
-
raise if !validateFromTo to or !validateStashCommitTo branch
|
672
|
-
raise if !tryStashCommitToGrow branch, to, commitMessage, commit
|
673
|
-
return
|
671
|
+
raise '' if !validateFromTo to or !validateStashCommitTo branch
|
672
|
+
raise '' if !tryStashCommitToGrow branch, to, commitMessage, commit
|
673
|
+
return
|
674
674
|
rescue => e
|
675
675
|
puts '* failed: stash-commit --to (index | name)'
|
676
676
|
raise e
|
@@ -678,11 +678,11 @@ def main(argv)
|
|
678
678
|
else
|
679
679
|
# --to 指定がない時
|
680
680
|
begin
|
681
|
-
raise if !validateStashCommitTo branch
|
681
|
+
raise '' if !validateStashCommitTo branch
|
682
682
|
(MAX+1).times do |i|
|
683
683
|
if i == MAX
|
684
684
|
puts '* error: branch is too many'
|
685
|
-
raise
|
685
|
+
raise ''
|
686
686
|
end
|
687
687
|
|
688
688
|
stashBranch = Cmd::stashName branch, i
|
@@ -691,8 +691,8 @@ def main(argv)
|
|
691
691
|
next
|
692
692
|
end
|
693
693
|
|
694
|
-
raise if !tryStashCommitTo stashBranch, commitMessage, commit
|
695
|
-
return
|
694
|
+
raise '' if !tryStashCommitTo stashBranch, commitMessage, commit
|
695
|
+
return
|
696
696
|
end
|
697
697
|
rescue => e
|
698
698
|
puts '* failed: stash-commit'
|
@@ -710,7 +710,7 @@ module Stash
|
|
710
710
|
module Commit
|
711
711
|
|
712
712
|
begin
|
713
|
-
|
713
|
+
main ARGV
|
714
714
|
puts 'done!'
|
715
715
|
rescue => e
|
716
716
|
if $debugMode
|
File without changes
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
$:.unshift File.dirname(__FILE__)
|
4
4
|
require 'define.rb'
|
5
|
+
require 'util.rb'
|
5
6
|
require 'open3'
|
6
7
|
|
7
8
|
module Cmd
|
@@ -22,7 +23,8 @@ module Cmd
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def execRetQuiet(cmd)
|
25
|
-
execRet "#{cmd} > /dev/null 2>&1"
|
26
|
+
return execRet "#{cmd} > /dev/null 2>&1" if !win?
|
27
|
+
execRet "#{cmd} > nul 2>%1"
|
26
28
|
end
|
27
29
|
|
28
30
|
# 他のコマンド
|
@@ -88,7 +90,13 @@ module Cmd
|
|
88
90
|
end
|
89
91
|
private
|
90
92
|
def findFirstCommitStashRef(&pred)
|
91
|
-
|
93
|
+
ret = ''
|
94
|
+
if !win? then
|
95
|
+
ret = `find #{gitdir}/refs/#{PREFIX} -type f 2> /dev/null`
|
96
|
+
else
|
97
|
+
ret = `find #{gitdir}/refs/#{PREFIX} -type f 2> nul`
|
98
|
+
end
|
99
|
+
ret.each_line do |_line|
|
92
100
|
line = _line.strip
|
93
101
|
line = line.sub(/^.*\.git\/refs\//, '')
|
94
102
|
return line if pred.call line
|
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
def os
|
4
|
+
@os ||= (
|
5
|
+
host_os = RbConfig::CONFIG['host_os']
|
6
|
+
case host_os
|
7
|
+
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
8
|
+
:windows
|
9
|
+
when /darwin|mac os/
|
10
|
+
:macosx
|
11
|
+
when /linux/
|
12
|
+
:linux
|
13
|
+
when /solaris|bsd/
|
14
|
+
:unix
|
15
|
+
else
|
16
|
+
:unknown
|
17
|
+
end
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def win?
|
22
|
+
os == :windows
|
23
|
+
end
|
24
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-stash-commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wordi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- LICENSE.txt
|
54
54
|
- README.md
|
55
55
|
- Rakefile
|
56
|
+
- bench/bench.rb
|
56
57
|
- bin/console
|
57
58
|
- bin/git-stash-commit
|
58
59
|
- bin/rake
|
@@ -64,6 +65,7 @@ files:
|
|
64
65
|
- lib/git/stash/sclib/branch.rb
|
65
66
|
- lib/git/stash/sclib/command.rb
|
66
67
|
- lib/git/stash/sclib/define.rb
|
68
|
+
- lib/git/stash/sclib/util.rb
|
67
69
|
homepage: https://github.com/wordijp/git-stash-commit
|
68
70
|
licenses:
|
69
71
|
- MIT
|
@@ -84,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
86
|
version: '0'
|
85
87
|
requirements: []
|
86
88
|
rubyforge_project:
|
87
|
-
rubygems_version: 2.5.
|
89
|
+
rubygems_version: 2.5.2
|
88
90
|
signing_key:
|
89
91
|
specification_version: 4
|
90
92
|
summary: git sub command, stash change files as commit of branch
|