class MGit::OperationProgressManager

Constants

PROGRESS_TYPE

Public Class Methods

is_in_progress?(root, type) click to toggle source

是否处于中间态中

# 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.puts_fail_message(e.msg)
  end
  return is_in_progress
end
load_context(root, type) click to toggle source

加载中间态上下文

@param root [String] 多仓库根目录

@param type [String] 自定义Key值,用于索引中间态信息

@return [OperationProgressContext,String] 中间态对象;错误信息

# 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.puts_fail_message(e.msg)
    error = e.msg
  end
  return context, error
end
remove_progress(root, type) click to toggle source

删除中间态

@param root [String] 多仓库根目录

@param type [String] 自定义Key值,用于索引中间态信息

# 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.puts_fail_message(e.msg)
  end
end
trap_into_progress(root, context) click to toggle source

进入中间态

@param root [String] 多仓库根目录

@param context [OperationProgressContext] 中间态对象

# 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.puts_fail_message(e.msg)
  end
end