mercurial-wrapper 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mercurial.rb +35 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9f732f6cd5fba4c97c771474e64a8e25673cede
|
4
|
+
data.tar.gz: 2aadf35ea2b76fc0d16c713c0ee6055784636d13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9051e5d61e31b8b7173187ed8921e7b138b322e59dd9f18f5b4eddd51edd5d6e42e34bf16315009c5a033df45bf6b9075c18c8d9ca938b6b7f69b6af2d423d10
|
7
|
+
data.tar.gz: 42b6a528630e702c8a207d9a6e95a44ed6eb8978c8da45cf10126c5bbef0823fdb786b927800d3bbb92463236a33bb10be615ffd53ecbe12e0441eb24cc13105
|
data/lib/mercurial.rb
CHANGED
@@ -234,6 +234,41 @@ class Mercurial
|
|
234
234
|
out.unlink if out
|
235
235
|
end
|
236
236
|
|
237
|
+
def log(options={}, basedir = nil)
|
238
|
+
cmd = [hg, 'log']
|
239
|
+
cmd += ['-u', options[:user]] if options[:user]
|
240
|
+
cmd += ['-l', options[:limit].to_s] if options[:limit]
|
241
|
+
cmd += ['-v'] if options[:verbose] if options[:verbose]
|
242
|
+
cmd += ['-b', options[:branch]] if options[:branch]
|
243
|
+
cmd += ['-p', options[:patch].to_s] if options[:patch]
|
244
|
+
cmd += ['-r', options[:revision].to_s] if options[:revision]
|
245
|
+
cmd += [options[:filename]] if options[:filename]
|
246
|
+
lines = execute_command(cmd, basedir).lines.map(&:chomp)
|
247
|
+
return lines if options[:raw]
|
248
|
+
to_log_structure(lines)
|
249
|
+
end
|
250
|
+
|
251
|
+
private
|
252
|
+
|
253
|
+
def to_log_structure(lines)
|
254
|
+
elem = {}
|
255
|
+
result = []
|
256
|
+
iterator = lines.each
|
257
|
+
begin
|
258
|
+
while true
|
259
|
+
line = iterator.next
|
260
|
+
result << elem and elem = {} if line.strip.empty? and not elem.empty?
|
261
|
+
unless line.strip.empty?
|
262
|
+
key, value = line.split(':', 2).map { |item| item.strip.chomp }
|
263
|
+
value = iterator.next if value.empty?
|
264
|
+
elem[key.to_sym] = value
|
265
|
+
end
|
266
|
+
end
|
267
|
+
rescue StopIteration
|
268
|
+
end
|
269
|
+
result
|
270
|
+
end
|
271
|
+
|
237
272
|
end
|
238
273
|
|
239
274
|
|