Class: RSCM::Darcs
Constant Summary
RevisionPoller::BASE_INCREMENT, RevisionPoller::CRITICAL_REVISION_SIZE, RevisionPoller::TWENTY_FOUR_HOURS
Instance Attribute Summary collapse
Attributes inherited from Base
#default_options, #store_revisions_command
#logger
Instance Method Summary
collapse
Methods inherited from Base
#==, #available?, #central_exists?, #checked_out_files, #checkout, #checkout_commandline, #checkout_dir, #checkout_dir=, #destroy_central, #destroy_working_copy, #diff, #edit, #install_trigger, #move, #open, #store_revisions_command?, #to_identifier, #to_yaml_properties, #transactional?, #trigger_installed?, #trigger_mechanism, #uninstall_trigger, #update_commandline
#poll
Constructor Details
#initialize(dir = ".") ⇒ Darcs
Returns a new instance of Darcs.
19
20
21
|
# File 'lib/rscm/scm/darcs.rb', line 19
def initialize(dir=".")
@dir = File.expand_path(dir)
end
|
Instance Attribute Details
#dir ⇒ Object
8
9
10
|
# File 'lib/rscm/scm/darcs.rb', line 8
def dir
@dir
end
|
Instance Method Details
#add(relative_filename) ⇒ Object
59
60
61
62
63
|
# File 'lib/rscm/scm/darcs.rb', line 59
def add(relative_filename)
with_working_dir(@checkout_dir) do
darcs("add #{relative_filename}")
end
end
|
#can_create_central? ⇒ Boolean
23
24
25
|
# File 'lib/rscm/scm/darcs.rb', line 23
def can_create_central?
true
end
|
#checked_out? ⇒ Boolean
65
66
67
|
# File 'lib/rscm/scm/darcs.rb', line 65
def checked_out?
File.exists?("#{@checkout_dir}/_darcs")
end
|
#commit(message) ⇒ Object
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/rscm/scm/darcs.rb', line 48
def commit(message)
logfile = Tempfile.new("darcs_logfile")
logfile.print("something nice\n")
logfile.print(message + "\n")
logfile.close
with_working_dir(@checkout_dir) do
darcs("record --all --logfile #{PathConverter.filepath_to_nativepath(logfile.path, false)}")
end
end
|
#create_central ⇒ Object
27
28
29
30
31
|
# File 'lib/rscm/scm/darcs.rb', line 27
def create_central
with_working_dir(@dir) do
darcs("initialize")
end
end
|
#import_central(dir, message) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/rscm/scm/darcs.rb', line 33
def import_central(dir, message)
ENV["EMAIL"] = "[email protected]"
FileUtils.cp_r(Dir.glob("#{dir}/*"), @dir)
with_working_dir(@dir) do
darcs("add --recursive .")
logfile = Tempfile.new("darcs_logfile")
logfile.print("something nice\n")
logfile.print(message + "\n")
logfile.close
darcs("record --all --logfile #{PathConverter.filepath_to_nativepath(logfile.path, false)}")
end
end
|
#installed? ⇒ Boolean
10
11
12
13
14
15
16
17
|
# File 'lib/rscm/scm/darcs.rb', line 10
def installed?
begin
darcs("--version", {})
true
rescue
false
end
end
|
#revisions(from_identifier, to_identifier = Time.infinity) ⇒ Object
87
88
89
90
91
92
93
94
95
|
# File 'lib/rscm/scm/darcs.rb', line 87
def revisions(from_identifier, to_identifier=Time.infinity)
from_identifier = Time.epoch if from_identifier.nil?
to_identifier = Time.infinity if to_identifier.nil?
with_working_dir(@checkout_dir) do
darcs("changes --summary --xml-output") do |stdout|
DarcsLogParser.new.parse_revisions(stdout, from_identifier, to_identifier)
end
end
end
|
#supports_trigger? ⇒ Boolean
97
98
99
|
# File 'lib/rscm/scm/darcs.rb', line 97
def supports_trigger?
true
end
|
#uptodate?(from_identifier) ⇒ Boolean
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/rscm/scm/darcs.rb', line 69
def uptodate?(from_identifier)
if (!checked_out?(@checkout_dir))
false
else
with_working_dir(@checkout_dir) do
darcs("pull --dry-run #{@dir}") do |io|
io.each_line do |line|
if (line =~ /No remote changes to pull in!/)
true
else
false
end
end
end
end
end
end
|