big_keeper 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +50 -0
  3. data/Gemfile +6 -0
  4. data/Gemfile.lock +106 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +41 -0
  7. data/Rakefile +2 -0
  8. data/big_keeper.gemspec +40 -0
  9. data/bin/big-keeper +14 -0
  10. data/bin/setup +8 -0
  11. data/docs/en-US/FEATURE.md +0 -0
  12. data/docs/zh-CN/BIGKEEPER_FILE.md +62 -0
  13. data/docs/zh-CN/FEATURE.md +88 -0
  14. data/docs/zh-CN/README.md +76 -0
  15. data/lib/big_keeper/command/feature_finish.rb +47 -0
  16. data/lib/big_keeper/command/feature_pull.rb +23 -0
  17. data/lib/big_keeper/command/feature_push.rb +39 -0
  18. data/lib/big_keeper/command/feature_start.rb +60 -0
  19. data/lib/big_keeper/command/feature_switch.rb +43 -0
  20. data/lib/big_keeper/command/feature_update.rb +60 -0
  21. data/lib/big_keeper/command/hotfix_start.rb +0 -0
  22. data/lib/big_keeper/command/podfile_lock.rb +16 -0
  23. data/lib/big_keeper/command/release_home.rb +51 -0
  24. data/lib/big_keeper/command/release_module.rb +27 -0
  25. data/lib/big_keeper/command/start_module_release.sh +44 -0
  26. data/lib/big_keeper/model/gitflow_type.rb +19 -0
  27. data/lib/big_keeper/model/operate_type.rb +19 -0
  28. data/lib/big_keeper/model/podfile_type.rb +44 -0
  29. data/lib/big_keeper/service/git_service.rb +75 -0
  30. data/lib/big_keeper/service/module_service.rb +90 -0
  31. data/lib/big_keeper/service/stash_service.rb +42 -0
  32. data/lib/big_keeper/util/bigkeeper_parser.rb +167 -0
  33. data/lib/big_keeper/util/git_operator.rb +95 -0
  34. data/lib/big_keeper/util/gitflow_operator.rb +40 -0
  35. data/lib/big_keeper/util/info_plist_operator.rb +46 -0
  36. data/lib/big_keeper/util/podfile_detector.rb +140 -0
  37. data/lib/big_keeper/util/podfile_operator.rb +111 -0
  38. data/lib/big_keeper/version.rb +3 -0
  39. data/lib/big_keeper.rb +151 -0
  40. data/resources/readme/big-keeper-readme.001.png +0 -0
  41. data/resources/readme/big-keeper-readme.002.png +0 -0
  42. data/resources/readme/big-keeper-readme.003.png +0 -0
  43. data/resources/readme/big-keeper-readme.004.png +0 -0
  44. data/resources/readme/big-keeper-readme.005.png +0 -0
  45. data/resources/readme/big-keeper-readme.006.png +0 -0
  46. data/resources/readme/big-keeper-readme.007.png +0 -0
  47. metadata +191 -0
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'big_keeper/util/podfile_operator'
4
+ require 'big_keeper/util/gitflow_operator'
5
+ require 'big_keeper/util/bigkeeper_parser'
6
+
7
+ require 'big_keeper/model/podfile_type'
8
+
9
+ require 'big_keeper/service/stash_service'
10
+ require 'big_keeper/service/module_service'
11
+
12
+
13
+ module BigKeeper
14
+ def self.feature_start(path, version, user, name, modules)
15
+ begin
16
+ # Parse Bigkeeper file
17
+ BigkeeperParser.parse("#{path}/Bigkeeper")
18
+
19
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
20
+ feature_name = "#{version}_#{user}_#{name}"
21
+ branch_name = "#{GitflowType.name(GitflowType::FEATURE)}/#{feature_name}"
22
+
23
+ GitService.new.verify_branch(path, branch_name, OperateType::START)
24
+
25
+ stash_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
26
+ BigkeeperParser.module_names, ModuleType::PATH)
27
+
28
+ # Stash current branch
29
+ StashService.new.stash(path, branch_name, user, stash_modules)
30
+
31
+ # Handle modules
32
+ if modules
33
+ # Verify input modules
34
+ BigkeeperParser.verify_modules(modules)
35
+ else
36
+ # Get all modules if not specified
37
+ modules = BigkeeperParser.module_names
38
+ end
39
+
40
+ # Start home feature
41
+ GitflowOperator.new.start(path, feature_name, GitflowType::FEATURE)
42
+
43
+ # Modify podfile as path and Start modules feature
44
+ modules.each do |module_name|
45
+ ModuleService.new.add(path, user, module_name, feature_name, GitflowType::FEATURE)
46
+ end
47
+
48
+ # pod install
49
+ p `pod install --project-directory=#{path}`
50
+
51
+ # Push home changes to remote
52
+ GitOperator.new.commit(path, "init #{GitflowType.name(GitflowType::FEATURE)} #{feature_name}")
53
+ GitOperator.new.push(path, branch_name)
54
+
55
+ # Open home workspace
56
+ p `open #{path}/*.xcworkspace`
57
+ ensure
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/ruby
2
+
3
+ module BigKeeper
4
+ def self.feature_switch(path, version, user, name)
5
+ begin
6
+ # Parse Bigkeeper file
7
+ BigkeeperParser.parse("#{path}/Bigkeeper")
8
+
9
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
10
+ feature_name = "#{version}_#{user}_#{name}"
11
+ branch_name = "#{GitflowType.name(GitflowType::FEATURE)}/#{feature_name}"
12
+
13
+ GitService.new.verify_branch(path, branch_name, OperateType::SWITCH)
14
+
15
+ stath_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
16
+ BigkeeperParser.module_names, ModuleType::PATH)
17
+
18
+ # Stash current branch
19
+ StashService.new.stash(path, branch_name, user, stath_modules)
20
+
21
+ # Switch to new feature
22
+ GitOperator.new.git_checkout(path, branch_name)
23
+ GitOperator.new.pull(path, branch_name)
24
+
25
+ modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
26
+ BigkeeperParser.module_names, ModuleType::PATH)
27
+
28
+ modules.each do |module_name|
29
+ ModuleService.new.switch(path, user, module_name, branch_name)
30
+ end
31
+
32
+ # Apply stash
33
+ StashService.new.apply_stash(path, branch_name, user, modules)
34
+
35
+ # pod install
36
+ p `pod install --project-directory=#{path}`
37
+
38
+ # Open home workspace
39
+ p `open #{path}/*.xcworkspace`
40
+ ensure
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'big_keeper/util/podfile_operator'
4
+ require 'big_keeper/util/gitflow_operator'
5
+ require 'big_keeper/util/bigkeeper_parser'
6
+
7
+ require 'big_keeper/model/podfile_type'
8
+
9
+ require 'big_keeper/service/stash_service'
10
+ require 'big_keeper/service/module_service'
11
+
12
+
13
+ module BigKeeper
14
+ def self.feature_update(path, user, modules)
15
+ begin
16
+ # Parse Bigkeeper file
17
+ BigkeeperParser.parse("#{path}/Bigkeeper")
18
+
19
+ branch_name = GitOperator.new.current_branch(path)
20
+ raise "Not a feature branch, exit." unless branch_name.include? 'feature'
21
+
22
+ feature_name = branch_name.gsub(/feature\//, '')
23
+
24
+ current_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
25
+ BigkeeperParser.module_names, ModuleType::PATH)
26
+
27
+ # Handle modules
28
+ if modules
29
+ # Verify input modules
30
+ BigkeeperParser.verify_modules(modules)
31
+ else
32
+ # Get all modules if not specified
33
+ modules = BigkeeperParser.module_names
34
+ end
35
+
36
+ add_modules = modules - current_modules
37
+ del_modules = current_modules - modules
38
+
39
+ if add_modules.empty? and del_modules.empty?
40
+ p "There is nothing changed with modules #{modules}."
41
+ else
42
+ # Modify podfile as path and Start modules feature
43
+ add_modules.each do |module_name|
44
+ ModuleService.new.add(path, user, module_name, feature_name, GitflowType::FEATURE)
45
+ end
46
+
47
+ del_modules.each do |module_name|
48
+ ModuleService.new.del(path, user, module_name, feature_name, GitflowType::FEATURE)
49
+ end
50
+
51
+ # pod install
52
+ p `pod install --project-directory=#{path}`
53
+
54
+ # Open home workspace
55
+ p `open #{path}/*.xcworkspace`
56
+ end
57
+ ensure
58
+ end
59
+ end
60
+ end
File without changes
@@ -0,0 +1,16 @@
1
+
2
+ require './big_keeper/util/podfile_detector'
3
+ require './big_keeper/util/gitflow_operator'
4
+ require './big_keeper/util/bigkeeper_parser'
5
+ require './big_keeper/model/podfile_type'
6
+
7
+ module BigKeeper
8
+ def self.podfile_lock(path)
9
+ begin
10
+ # Parse Bigkeeper file
11
+ BigkeeperParser.parse("#{path}/Bigkeeper")
12
+ unlock_pod_list = PodfileDetector.new.get_unlock_pod_list
13
+ p unlock_pod_list
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/ruby
2
+ require 'big_keeper/util/podfile_operator'
3
+ require 'big_keeper/util/gitflow_operator'
4
+ require 'big_keeper/model/podfile_type'
5
+ require 'big_keeper/util/info_plist_operator'
6
+
7
+ # 1.切换主工程的分支到 release分支
8
+ # 2.替换当前 podfile 中每个 module 为 pod #{module_name}, :git => '#{source.base}', :tag => '#{source.addition}'
9
+ # 3.替换 info.plist 中的 build version
10
+
11
+ module BigKeeper
12
+ def self.release_home_start(path, version, user)
13
+ BigkeeperParser.parse("#{path}/Bigkeeper")
14
+ start_release(path, version, BigkeeperParser::module_names, GitInfo.new(BigkeeperParser::home_git, GitType::TAG, version), user)
15
+ end
16
+
17
+ def self.release_home_finish(path, version)
18
+ GitOperator.new.commit(path, "release: V #{version}")
19
+ GitOperator.new.push(path, "release/#{version}")
20
+ GitflowOperator.new.finish_release(path, version)
21
+ GitOperator.new.tag(path, version)
22
+ end
23
+
24
+ private
25
+ def self.start_release(project_path, version, modules, source, user)
26
+ # step 0 Stash current branch
27
+ StashService.new.stash(project_path, GitOperator.new.current_branch(project_path), user, modules)
28
+
29
+ # step 1 checkout release
30
+ if GitOperator.new.current_branch(project_path) != "release/#{version}"
31
+ if GitOperator.new.has_branch(project_path, "release/#{version}")
32
+ GitOperator.new.git_checkout(project_path, "release/#{version}")
33
+ else
34
+ GitflowOperator.new.start(project_path, version, GitflowType::RELEASE)
35
+ GitOperator.new.push(project_path, "release/#{version}")
36
+ end
37
+ end
38
+
39
+ # step 2 replace_modules
40
+ PodfileOperator.new.replace_all_module_release(%Q(#{project_path}/Podfile),
41
+ modules,
42
+ version,
43
+ source)
44
+
45
+ # step 3 change Info.plist value
46
+ InfoPlistOperator.new.change_version_build(project_path, version)
47
+
48
+ p `pod install --project-directory=#{project_path}`
49
+ p `open #{project_path}/*.xcworkspace`
50
+ end
51
+ end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby
2
+ require 'big_keeper/util/podfile_operator'
3
+ require 'big_keeper/util/gitflow_operator'
4
+ require 'big_keeper/model/podfile_type'
5
+ require 'big_keeper/util/info_plist_operator'
6
+
7
+ # 替换当前 podfile 中某个 module 为 pod #{module_name}, :git => '#{source.base}', :tag => '#{source.addition}'
8
+
9
+ module BigKeeper
10
+ def self.start_module_release(path, module_name)
11
+ BigkeeperParser.parse("#{path}/Bigkeeper")
12
+
13
+ module_release(path,
14
+ module_name,
15
+ GitInfo.new(BigkeeperParser.home_git, GitType::BRANCH, 'develop'))
16
+ end
17
+
18
+ private
19
+ def self.module_release(project_path, module_name, source)
20
+ PodfileOperator.new.find_and_replace(%Q(#{project_path}/Podfile),
21
+ module_name,
22
+ ModuleType::GIT,
23
+ source)
24
+ p `pod install --project-directory=#{project_path}`
25
+ p `open #{project_path}/*.xcworkspace`
26
+ end
27
+ end
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+
3
+ cd $(dirname $0)
4
+
5
+ diff=`git diff`
6
+
7
+
8
+ if [ ${#diff} != 0 ];
9
+ then
10
+ echo "还有东西没有提交"
11
+ exit 1
12
+ fi
13
+
14
+ echo "--------tag list--------"
15
+ git tag -l
16
+ echo "--------tag list--------"
17
+
18
+ echo "根据上面的tag输入新tag"
19
+ read thisTag
20
+
21
+ # 获取podspec文件名
22
+ podSpecName=`ls|grep ".podspec$"|sed "s/\.podspec//g"`
23
+ echo $podSpecName
24
+
25
+ # 修改版本号
26
+ sed -i "" "s/s.version *= *[\"\'][^\"]*[\"\']/s.version=\"$thisTag\"/g" $podSpecName.podspec
27
+
28
+ pod cache clean --all
29
+
30
+ pod lib lint --allow-warnings --verbose --use-libraries
31
+
32
+
33
+ # 验证失败退出
34
+ if [ $? != 0 ];then
35
+ exit 1
36
+ fi
37
+
38
+
39
+ git commit $podSpecName.podspec -m "update podspec"
40
+ git push
41
+ git tag -m "update podspec" $thisTag
42
+ git push --tags
43
+
44
+ pod repo push specs $podSpecName.podspec --allow-warnings
@@ -0,0 +1,19 @@
1
+ module BigKeeper
2
+ module GitflowType
3
+ FEATURE = 1
4
+ HOTFIX = 2
5
+ RELEASE = 3
6
+
7
+ def self.name(type)
8
+ if FEATURE == type
9
+ "feature"
10
+ elsif HOTFIX == type
11
+ "hotfix"
12
+ elsif RELEASE == type
13
+ "release"
14
+ else
15
+ name
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module BigKeeper
2
+ module OperateType
3
+ START = 1
4
+ UPDATE = 2
5
+ SWITCH = 3
6
+
7
+ def self.name(type)
8
+ if START == type
9
+ "start"
10
+ elsif UPDATE == type
11
+ "update"
12
+ elsif SWITCH == type
13
+ "switch"
14
+ else
15
+ name
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,44 @@
1
+ module BigKeeper
2
+ module ModuleType
3
+ PATH = 1
4
+ GIT = 2
5
+ SPEC = 3
6
+
7
+ def self.regex(type)
8
+ if PATH == type
9
+ "\s*:path\s*=>\s*"
10
+ elsif GIT == type
11
+ "\s*:git\s*=>\s*"
12
+ elsif SPEC == type
13
+ "\s*'"
14
+ else
15
+ name
16
+ end
17
+ end
18
+ end
19
+
20
+ module GitType
21
+ MASTER = 1
22
+ BRANCH = 2
23
+ TAG = 3
24
+ COMMIT = 4
25
+ end
26
+
27
+ class GitInfo
28
+ def initialize(base, type, addition)
29
+ @base, @type, @addition = base, type, addition
30
+ end
31
+
32
+ def type
33
+ @type
34
+ end
35
+
36
+ def base
37
+ @base
38
+ end
39
+
40
+ def addition
41
+ @addition
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,75 @@
1
+ require 'big_keeper/util/git_operator'
2
+ require 'big_keeper/model/gitflow_type'
3
+ require 'big_keeper/model/operate_type'
4
+
5
+ module BigKeeper
6
+ # Operator for got
7
+ class GitService
8
+ def verify_branch(path, branch_name, type)
9
+ GitOperator.new.git_fetch(path)
10
+
11
+ if OperateType::START == type
12
+ if GitOperator.new.current_branch(path) == branch_name
13
+ raise %(Current branch is '#{branch_name}' already. Use 'update' please)
14
+ end
15
+ if GitOperator.new.has_branch(path, branch_name)
16
+ raise %(Branch '#{branch_name}' already exists. Use 'switch' please)
17
+ end
18
+ elsif OperateType::SWITCH == type
19
+ if !GitOperator.new.has_branch(path, branch_name)
20
+ raise %(Can't find a branch named '#{branch_name}'. Use 'start' please)
21
+ end
22
+ if GitOperator.new.current_branch(path) == branch_name
23
+ raise %(Current branch is '#{branch_name}' already. Use 'update' please)
24
+ end
25
+ elsif OperateType::UPDATE == type
26
+ if !GitOperator.new.has_branch(path, branch_name)
27
+ raise %(Can't find a branch named '#{branch_name}'. Use 'start' please)
28
+ end
29
+ if GitOperator.new.current_branch(path) != branch_name
30
+ raise %(Current branch is not '#{branch_name}'. Use 'switch' please)
31
+ end
32
+ else
33
+ raise %(Not a valid command for '#{branch_name}'.)
34
+ end
35
+ end
36
+
37
+ def branchs_with_type(path, type)
38
+ branchs = []
39
+ Dir.chdir(path) do
40
+ IO.popen('git branch -a') do |io|
41
+ io.each do |line|
42
+ branchs << line.rstrip if line =~ /(\* | )#{GitflowType.name(type)}*/
43
+ end
44
+ end
45
+ end
46
+ branchs
47
+ end
48
+
49
+ def verify_rebase(path, branch_name, name)
50
+ Dir.chdir(path) do
51
+ IO.popen("git rebase #{branch_name} --ignore-whitespace") do |io|
52
+ unless io.gets
53
+ raise "#{name} is already in a rebase-apply, Please:\n\
54
+ 1.Resolve it;\n\
55
+ 2.Commit the changes;\n\
56
+ 3.Push to remote;\n\
57
+ 4.Create a MR;\n\
58
+ 5.Run 'finish' again."
59
+ end
60
+ io.each do |line|
61
+ next unless line.include? 'Merge conflict'
62
+ raise "Merge conflict in #{name}, Please:\n\
63
+ 1.Resolve it;\n\
64
+ 2.Commit the changes;\n\
65
+ 3.Push to remote;\n\
66
+ 4.Create a MR;\n\
67
+ 5.Run 'finish' again."
68
+ end
69
+ end
70
+ `git push -f origin #{branch_name}`
71
+ GitOperator.new.git_checkout(path, 'develop')
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,90 @@
1
+ require 'big_keeper/service/git_service'
2
+
3
+ module BigKeeper
4
+ # Operator for got
5
+ class ModuleService
6
+ def pull(path, user, module_name, branch_name)
7
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
8
+
9
+ if !File.exist? module_full_path
10
+ module_git = BigkeeperParser.module_git(module_name)
11
+ GitOperator.new.clone(File.expand_path("#{module_full_path}/../"), module_git)
12
+ GitOperator.new.git_checkout(module_full_path, branch_name)
13
+ else
14
+ module_branch_name = GitOperator.new.current_branch(module_full_path)
15
+ if module_branch_name != branch_name
16
+ p "Current branch of #{module_name} is #{module_branch_name},\
17
+ stash it and checkout #{branch_name}..."
18
+ BigStash::StashOperator.new(module_full_path).stash(module_branch_name)
19
+ GitOperator.new.git_checkout(module_full_path, branch_name)
20
+ end
21
+ p "Start pulling #{module_name}..."
22
+ GitOperator.new.pull(module_full_path, branch_name)
23
+ p "Finish pulling #{module_name}..."
24
+ end
25
+ end
26
+
27
+ def switch(path, user, module_name, branch_name)
28
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
29
+
30
+ p "Start switching #{module_name}..."
31
+ if !File.exist? module_full_path
32
+ module_git = BigkeeperParser.module_git(module_name)
33
+ GitOperator.new.clone(File.expand_path("#{module_full_path}/../"), module_git)
34
+ GitOperator.new.git_checkout(module_full_path, branch_name)
35
+ else
36
+ GitOperator.new.git_checkout(module_full_path, branch_name)
37
+ GitOperator.new.pull(module_full_path, branch_name)
38
+ end
39
+ p "Finish switching #{module_name}..."
40
+ end
41
+
42
+ def finish(path, user, module_name)
43
+ module_git = BigkeeperParser.module_git(module_name)
44
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
45
+ branch_name = GitOperator.new.current_branch(module_full_path)
46
+
47
+ PodfileOperator.new.find_and_replace("#{path}/Podfile",
48
+ %Q('#{module_name}'),
49
+ ModuleType::GIT,
50
+ GitInfo.new(module_git, GitType::BRANCH, branch_name))
51
+
52
+ GitService.new.verify_rebase(module_full_path, 'develop', module_name)
53
+
54
+ `open #{BigkeeperParser.module_pulls(module_name)}`
55
+ end
56
+
57
+ def add(path, user, module_name, name, type)
58
+ branch_name = "#{GitflowType.name(type)}/#{name}"
59
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
60
+
61
+ GitflowOperator.new.start(module_full_path, name, type)
62
+ GitOperator.new.push(module_full_path, branch_name)
63
+
64
+ BigStash::StashOperator.new(module_full_path).apply_stash(branch_name)
65
+
66
+ module_path = BigkeeperParser.module_path(user, module_name)
67
+ PodfileOperator.new.find_and_replace("#{path}/Podfile",
68
+ %('#{module_name}'),
69
+ ModuleType::PATH,
70
+ module_path)
71
+ end
72
+
73
+ def del(path, user, module_name, name, type)
74
+ branch_name = "#{GitflowType.name(type)}/#{name}"
75
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
76
+
77
+ BigStash::StashOperator.new(module_full_path).stash(branch_name)
78
+
79
+ GitOperator.new.git_checkout(module_full_path, 'develop')
80
+ GitOperator.new.del(module_full_path, branch_name)
81
+
82
+ module_git = BigkeeperParser.module_git(module_name)
83
+
84
+ PodfileOperator.new.find_and_replace("#{path}/Podfile",
85
+ %Q('#{module_name}'),
86
+ ModuleType::GIT,
87
+ GitInfo.new(module_git, GitType::BRANCH, 'develop'))
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,42 @@
1
+ require 'big_stash/stash_operator'
2
+ require 'big_keeper/util/bigkeeper_parser'
3
+ require 'big_keeper/util/git_operator'
4
+
5
+ module BigKeeper
6
+ # Operator for got
7
+ class StashService
8
+ def stash(path, new_branch_name, user, modules)
9
+ # Stash modules
10
+ modules.each do |module_name|
11
+ module_path = BigkeeperParser.module_full_path(path, user, module_name)
12
+ branch_name = GitOperator.new.current_branch(module_path)
13
+
14
+ if branch_name != new_branch_name
15
+ p %Q(Current branch of '#{module_name}' is '#{branch_name}', start to stash...)
16
+ BigStash::StashOperator.new(module_path).stash(branch_name)
17
+ else
18
+ p %Q(Current branch name of '#{module_name}' is the same with new branch, continue...)
19
+ end
20
+ end
21
+
22
+ # Stash home
23
+ branch_name = GitOperator.new.current_branch(path)
24
+ if branch_name != new_branch_name
25
+ p %Q(Current branch of home is '#{branch_name}', start to stash...)
26
+ BigStash::StashOperator.new(path).stash(branch_name)
27
+ else
28
+ p "Current branch name of home is the same with new branch, continue..."
29
+ end
30
+ end
31
+
32
+ def apply_stash(path, user, branch_name, modules)
33
+ # Stash modules
34
+ modules.each do |module_name|
35
+ module_path = BigkeeperParser.module_full_path(path, user, module_name)
36
+ BigStash::StashOperator.new(module_path).apply_stash(branch_name)
37
+ end
38
+ # Stash home
39
+ BigStash::StashOperator.new(path).apply_stash(branch_name)
40
+ end
41
+ end
42
+ end