Class: MGit::OperationProgressManager
- Inherits:
-
Object
- Object
- MGit::OperationProgressManager
- Defined in:
- lib/m-git/foundation/operation_progress_manager.rb
Constant Summary collapse
- PROGRESS_TYPE =
{ :merge => 'merge_in_progress', :rebase => 'rebase_in_progress', :pull => 'pull_in_progress' }.freeze
Class Method Summary collapse
-
.is_in_progress?(root, type) ⇒ Boolean
是否处于中间态中.
-
.load_context(root, type) ⇒ OperationProgressContext,String
加载中间态上下文.
-
.remove_progress(root, type) ⇒ Object
删除中间态.
-
.trap_into_progress(root, context) ⇒ Object
进入中间态.
Class Method Details
.is_in_progress?(root, type) ⇒ Boolean
是否处于中间态中
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/m-git/foundation/operation_progress_manager.rb', line 101 def is_in_progress?(root, type) is_in_progress = false begin MGitConfig.query(root) { |config| is_in_progress = !config[type].nil? } rescue Error => e Output.(e.msg) end return is_in_progress end |
.load_context(root, type) ⇒ OperationProgressContext,String
加载中间态上下文
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/m-git/foundation/operation_progress_manager.rb', line 121 def load_context(root, type) context = nil error = nil begin MGitConfig.query(root) { |config| dict = config[type] context = OperationProgressContext.new(type) context.deserialize(dict) } rescue Error => e Output.(e.msg) error = e.msg end return context, error end |
.remove_progress(root, type) ⇒ Object
删除中间态
90 91 92 93 94 95 96 97 98 |
# File 'lib/m-git/foundation/operation_progress_manager.rb', line 90 def remove_progress(root, type) begin MGitConfig.update(root) { |config| config.delete(type) } rescue Error => e Output.(e.msg) end end |
.trap_into_progress(root, context) ⇒ Object
进入中间态
74 75 76 77 78 79 80 81 82 |
# File 'lib/m-git/foundation/operation_progress_manager.rb', line 74 def trap_into_progress(root, context) begin MGitConfig.update(root) { |config| config[context.type] = context.serialize } rescue Error => e Output.(e.msg) end end |