78 |
78 |
|
79 |
79 |
def entries(path=nil, identifier=nil)
|
80 |
80 |
path ||= ''
|
|
81 |
identifier ||= 'tip'
|
81 |
82 |
entries = Entries.new
|
82 |
|
cmd = "#{HG_BIN} -R #{target('')} --cwd #{target('')} locate"
|
83 |
|
cmd << " -r " + (identifier ? identifier.to_s : "tip")
|
84 |
|
cmd << " " + shell_quote("path:#{path}") unless path.empty?
|
|
83 |
cmd = "#{HG_BIN} --cwd #{target('')} locate"
|
|
84 |
cmd << " -r #{identifier}"
|
|
85 |
cmd << " " + shell_quote("glob:#{path}**") unless path.empty?
|
85 |
86 |
shellout(cmd) do |io|
|
86 |
87 |
io.each_line do |line|
|
87 |
88 |
# HG uses antislashs as separator on Windows
|
... | ... | |
157 |
158 |
else
|
158 |
159 |
identifier_to = identifier_from.to_i - 1
|
159 |
160 |
end
|
160 |
|
cmd = "#{HG_BIN} -R #{target('')} diff -r #{identifier_to} -r #{identifier_from} --nodates"
|
161 |
|
cmd << " -I #{target(path)}" unless path.empty?
|
|
161 |
cmd = "#{HG_BIN} --cwd #{target('')} diff -r #{identifier_to} -r #{identifier_from} --nodates"
|
|
162 |
cmd << " -I #{path}" unless path.empty?
|
162 |
163 |
diff = []
|
163 |
164 |
shellout(cmd) do |io|
|
164 |
165 |
io.each_line do |line|
|
... | ... | |
170 |
171 |
end
|
171 |
172 |
|
172 |
173 |
def cat(path, identifier=nil)
|
173 |
|
cmd = "#{HG_BIN} -R #{target('')} cat"
|
174 |
|
cmd << " -r " + (identifier ? identifier.to_s : "tip")
|
175 |
|
cmd << " #{target(path)}"
|
|
174 |
identifier ||= 'tip'
|
|
175 |
cmd = "#{HG_BIN} --cwd #{target('')} cat"
|
|
176 |
cmd << " -r #{identifier}"
|
|
177 |
cmd << " #{path}"
|
176 |
178 |
cat = nil
|
177 |
179 |
shellout(cmd) do |io|
|
178 |
180 |
io.binmode
|
... | ... | |
181 |
183 |
return nil if $? && $?.exitstatus != 0
|
182 |
184 |
cat
|
183 |
185 |
end
|
|
186 |
|
|
187 |
def size(path, identifier=nil)
|
|
188 |
path ||= ''
|
|
189 |
identifier ||= 'tip'
|
|
190 |
cmd = "#{HG_BIN} --cwd #{target('')} size"
|
|
191 |
cmd << " -r #{identifier}"
|
|
192 |
cmd << " #{path}"
|
|
193 |
size = nil
|
|
194 |
shellout(cmd) do |io|
|
|
195 |
size = io.read
|
|
196 |
end
|
|
197 |
return nil if $? && $?.exitstatus != 0
|
|
198 |
size.to_i
|
|
199 |
end
|
184 |
200 |
|
185 |
201 |
def annotate(path, identifier=nil)
|
186 |
202 |
path ||= ''
|
187 |
|
cmd = "#{HG_BIN} -R #{target('')}"
|
|
203 |
identifier ||= 'tip'
|
|
204 |
cmd = "#{HG_BIN} --cwd #{target('')} "
|
188 |
205 |
cmd << " annotate -n -u"
|
189 |
|
cmd << " -r " + (identifier ? identifier.to_s : "tip")
|
190 |
|
cmd << " -r #{identifier.to_i}" if identifier
|
191 |
|
cmd << " #{target(path)}"
|
|
206 |
cmd << " -r #{identifier}"
|
|
207 |
cmd << " #{path} "
|
192 |
208 |
blame = Annotate.new
|
193 |
209 |
shellout(cmd) do |io|
|
194 |
210 |
io.each_line do |line|
|