Method: Fact::ClearCase#get_version_info

Defined in:
lib/fact/clearcase.rb

#get_version_info(file_version) ⇒ Object

Get version information. The argument must be a hash with keys :file and :version. Returns a version info hash.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/fact/clearcase.rb', line 57

def get_version_info(file_version)

  # Get the properties of the latest version of the file
  version_str = create_cc_version(file_version[:file],file_version[:version])
  format_str  = '"version=%Sn, activity=%[activity]p, date=%Sd, type=%m, predecessor=%PVn, user=%Fu, checkout=%Tf"'
  curr_version_info = parse_describe_file(@cleartool.invoke("desc -fmt #{format_str} #{version_str}"))
  return if curr_version_info.nil?

  # Retreive all the change set to find the earliest version of the file in the change set
  change_set = get_activity_change_set(curr_version_info[:activity])
  return if change_set.nil?

  # Get the file name component of the file version string
  file = file_version[:file]

  # Get versions array for the file
  versions = change_set[file]

  # Adding additional information to the existing hash
  curr_version_info[:name] = file
  curr_version_info[:changeset_predecessor] = get_previous_version(file, versions.first)
  curr_version_info[:versions_count] = versions.size

  return curr_version_info
end