schacon-git 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/git/base.rb +11 -0
- data/lib/git/lib.rb +19 -0
- data/lib/git/log.rb +22 -1
- metadata +1 -1
data/lib/git/base.rb
CHANGED
@@ -367,6 +367,17 @@ module Git
|
|
367
367
|
self.lib.gc
|
368
368
|
end
|
369
369
|
|
370
|
+
def apply(file)
|
371
|
+
if File.exists?(file)
|
372
|
+
self.lib.apply(file)
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
def apply_mail(file)
|
377
|
+
if File.exists?(file)
|
378
|
+
self.lib.apply_mail(file)
|
379
|
+
end
|
380
|
+
end
|
370
381
|
|
371
382
|
## LOWER LEVEL INDEX OPERATIONS ##
|
372
383
|
|
data/lib/git/lib.rb
CHANGED
@@ -67,6 +67,9 @@ module Git
|
|
67
67
|
arr_opts = ['--pretty=oneline']
|
68
68
|
arr_opts << "-#{opts[:count]}" if opts[:count]
|
69
69
|
arr_opts << "--since=\"#{opts[:since]}\"" if opts[:since].is_a? String
|
70
|
+
arr_opts << "--until=\"#{opts[:until]}\"" if opts[:until].is_a? String
|
71
|
+
arr_opts << "--grep=\"#{opts[:grep]}\"" if opts[:grep].is_a? String
|
72
|
+
arr_opts << "--author=\"#{opts[:author]}\"" if opts[:author].is_a? String
|
70
73
|
arr_opts << "#{opts[:between][0].to_s}..#{opts[:between][1].to_s}" if (opts[:between] && opts[:between].size == 2)
|
71
74
|
arr_opts << opts[:object] if opts[:object].is_a? String
|
72
75
|
arr_opts << '-- ' + opts[:path_limiter] if opts[:path_limiter].is_a? String
|
@@ -78,6 +81,9 @@ module Git
|
|
78
81
|
arr_opts = ['--pretty=raw']
|
79
82
|
arr_opts << "-#{opts[:count]}" if opts[:count]
|
80
83
|
arr_opts << "--since=\"#{opts[:since]}\"" if opts[:since].is_a? String
|
84
|
+
arr_opts << "--until=\"#{opts[:until]}\"" if opts[:until].is_a? String
|
85
|
+
arr_opts << "--grep=\"#{opts[:grep]}\"" if opts[:grep].is_a? String
|
86
|
+
arr_opts << "--author=\"#{opts[:author]}\"" if opts[:author].is_a? String
|
81
87
|
arr_opts << "#{opts[:between][0].to_s}..#{opts[:between][1].to_s}" if (opts[:between] && opts[:between].size == 2)
|
82
88
|
arr_opts << opts[:object] if opts[:object].is_a? String
|
83
89
|
arr_opts << '-- ' + opts[:path_limiter] if opts[:path_limiter].is_a? String
|
@@ -387,6 +393,18 @@ module Git
|
|
387
393
|
command('reset', arr_opts)
|
388
394
|
end
|
389
395
|
|
396
|
+
def apply(patch_file)
|
397
|
+
arr_opts = []
|
398
|
+
arr_opts << patch_file.to_s if patch_file
|
399
|
+
command('apply', arr_opts)
|
400
|
+
end
|
401
|
+
|
402
|
+
def apply_mail(patch_file)
|
403
|
+
arr_opts = []
|
404
|
+
arr_opts << patch_file.to_s if patch_file
|
405
|
+
command('am', arr_opts)
|
406
|
+
end
|
407
|
+
|
390
408
|
def stashes_all
|
391
409
|
arr = []
|
392
410
|
filename = File.join(@git_dir, 'logs/refs/stash')
|
@@ -429,6 +447,7 @@ module Git
|
|
429
447
|
def checkout(branch, opts = {})
|
430
448
|
arr_opts = []
|
431
449
|
arr_opts << '-f' if opts[:force]
|
450
|
+
arr_opts << ["-b '#{opts[:new_branch]}'"] if opts[:new_branch]
|
432
451
|
arr_opts << branch.to_s
|
433
452
|
|
434
453
|
command('checkout', arr_opts)
|
data/lib/git/log.rb
CHANGED
@@ -11,6 +11,7 @@ module Git
|
|
11
11
|
@path = nil
|
12
12
|
@count = nil
|
13
13
|
@since = nil
|
14
|
+
@until = nil
|
14
15
|
@between = nil
|
15
16
|
|
16
17
|
@dirty_flag = nil
|
@@ -26,6 +27,18 @@ module Git
|
|
26
27
|
@object = objectish
|
27
28
|
return self
|
28
29
|
end
|
30
|
+
|
31
|
+
def author(regex)
|
32
|
+
dirty_log
|
33
|
+
@author = regex
|
34
|
+
return self
|
35
|
+
end
|
36
|
+
|
37
|
+
def grep(regex)
|
38
|
+
dirty_log
|
39
|
+
@grep = regex
|
40
|
+
return self
|
41
|
+
end
|
29
42
|
|
30
43
|
def path(path)
|
31
44
|
dirty_log
|
@@ -39,6 +52,12 @@ module Git
|
|
39
52
|
return self
|
40
53
|
end
|
41
54
|
|
55
|
+
def until(date)
|
56
|
+
dirty_log
|
57
|
+
@until = date
|
58
|
+
return self
|
59
|
+
end
|
60
|
+
|
42
61
|
def between(sha1, sha2 = nil)
|
43
62
|
dirty_log
|
44
63
|
@between = [sha1, sha2]
|
@@ -85,7 +104,9 @@ module Git
|
|
85
104
|
# actually run the 'git log' command
|
86
105
|
def run_log
|
87
106
|
log = @base.lib.full_log_commits(:count => @count, :object => @object,
|
88
|
-
:path_limiter => @path, :since => @since,
|
107
|
+
:path_limiter => @path, :since => @since,
|
108
|
+
:author => @author, :grep => @grep,
|
109
|
+
:until => @until, :between => @between)
|
89
110
|
@commits = log.map { |c| Git::Object::Commit.new(@base, c['sha'], c) }
|
90
111
|
end
|
91
112
|
|