# File lib/fastcst/command/undo.rb, line 25
25:         def run
26:             repo = Repository.new @repo_dir
27:             rev_path = repo['Path']
28:             id = rev_path.pop
29:             cs_path, md = repo.find_changeset(id)
30:             
31:             if not File.exist?(File.join(cs_path, "undo.yaml"))
32:                 UI.failure :constraint, "No undo.yaml file so there's no undo possible."
33:             elsif not File.exist?(File.join(cs_path, "undo.fcs"))
34:                 UI.failure :constraint, "No undo.fcs file so there's no undo possible."
35:             elsif cs_path
36:                 # get the undo revision and apply it to both directories
37:                 journal_file = File.join(cs_path, "undo.yaml")
38:                 data_file = File.join(cs_path, "undo.fcs")
39:                 
40:                 UI.start_finish("Applying undo revision for #{md['Revision']}") do
41:                     journal_in = Zlib::GzipReader.new(File.open(journal_file))
42:                     data_in = Zlib::GzipReader.new(File.open(data_file))
43:                     
44:                     ChangeSet.apply_changeset(journal_in, data_in, ".")
45:                 end
46:                 
47:                 UI.start_finish("Applying undo revision to originals rirectory") do
48:                     journal_in = Zlib::GzipReader.new(File.open(journal_file))
49:                     data_in = Zlib::GzipReader.new(File.open(data_file))
50:                     
51:                     ChangeSet.apply_changeset(journal_in, data_in, repo.originals_dir)
52:                 end
53:                 
54:                 # now update the path to have the new 
55:                 repo['Path'] = rev_path
56:             else
57:                 UI.failure :constraint, "It appears that you have a revision listed in your path with a missing directory."
58:             end
59:         end