jugyo-grit 2.4.2

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/API.txt ADDED
@@ -0,0 +1,101 @@
1
+ == TODO ==
2
+
3
+ * Add remote branch references (Grit::Remote)
4
+ * Add status - what is modified, staged
5
+
6
+ g.checkout('new_branch')
7
+ g.checkout(g.branch('new_branch'))
8
+
9
+ g.branch(name).merge(branch2)
10
+ g.branch(branch2).merge # merges HEAD with branch2
11
+
12
+ g.branch(name).in_branch(message) { # add files } # auto-commits
13
+ g.merge('new_branch')
14
+ g.merge('origin/remote_branch')
15
+ g.merge(b.branch('master'))
16
+ g.merge([branch1, branch2])
17
+
18
+ r = g.add_remote(name, uri) # Git::Remote
19
+ r = g.add_remote(name, Git::Base) # Git::Remote
20
+
21
+ g.remotes # array of Git::Remotes
22
+ g.remote(name).fetch
23
+ g.remote(name).remove
24
+ g.remote(name).merge
25
+ g.remote(name).merge(branch)
26
+
27
+ g.fetch
28
+ g.fetch(g.remotes.first)
29
+
30
+ g.pull
31
+ g.pull(Git::Repo, Git::Branch) # fetch and a merge
32
+
33
+ g.add_tag('tag_name') # returns Git::Tag
34
+
35
+ g.repack
36
+
37
+ g.push
38
+ g.push(g.remote('name'))
39
+
40
+ g.reset # defaults to HEAD
41
+ g.reset_hard(Git::Commit)
42
+
43
+ g.branch('new_branch') # creates new or fetches existing
44
+ g.branch('new_branch').checkout
45
+ g.branch('new_branch').delete
46
+ g.branch('existing_branch').checkout
47
+
48
+
49
+
50
+
51
+
52
+ require 'mojombo-grit'
53
+
54
+ include Grit
55
+ Grit.debug
56
+ Grit.use_pure_ruby
57
+
58
+ repo = Repo.new("/Users/tom/dev/grit")
59
+
60
+ = Commit Log
61
+
62
+ repo.commits('mybranch')
63
+ repo.commits('40d3057d09a7a4d61059bca9dca5ae698de58cbe')
64
+ repo.commits('v0.1')
65
+
66
+ repo.log('mybranch', 100, 20)
67
+
68
+ head = repo.commits.first
69
+ head.id
70
+ # => "e80bbd2ce67651aa18e57fb0b43618ad4baf7750"
71
+ head.parents
72
+ # => [#<Grit::Commit "91169e1f5fa4de2eaea3f176461f5dc784796769">]
73
+ head.tree
74
+ # => #<Grit::Tree "3536eb9abac69c3e4db583ad38f3d30f8db4771f">
75
+ head.author
76
+ # => #<Grit::Actor "Tom Preston-Werner <tom@mojombo.com>">
77
+ head.authored_date
78
+ # => Wed Oct 24 22:02:31 -0700 2007
79
+ head.committer
80
+ # => #<Grit::Actor "Tom Preston-Werner <tom@mojombo.com>">
81
+ head.committed_date
82
+ # => Wed Oct 24 22:02:31 -0700 2007
83
+ head.message
84
+ # => "add Actor inspect"
85
+ contents = tree.contents
86
+ # => [#<Grit::Blob "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666">,
87
+ #<Grit::Blob "81d2c27608b352814cbe979a6acd678d30219678">,
88
+ #<Grit::Tree "c3d07b0083f01a6e1ac969a0f32b8d06f20c62e5">,
89
+ #<Grit::Tree "4d00fe177a8407dbbc64a24dbfc564762c0922d8">]
90
+ blob.id
91
+ # => "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666"
92
+ blob.name
93
+ # => "README.txt"
94
+ blob.mode
95
+ # => "100644"
96
+ blob.size
97
+ # => 7726
98
+ blob.data
99
+
100
+ repo.blob("4ebc8aea50e0a67e000ba29a30809d0a7b9b2666")
101
+ # => #<Grit::Blob "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666">
@@ -0,0 +1,153 @@
1
+ == git
2
+ * Bug Fixes
3
+ * Fix Loose Objects with non-ASCII content in Ruby 1.9
4
+ * Fix bugs in Grit::Repo #objects, #commit_objects, and #diff_objects
5
+ due to passing multiple arguments in a single argv element.
6
+
7
+ == 2.4.1 / 2011-01-13
8
+ * Minor Enhancements
9
+ * Grit::Process is used to implement Grit::Git#check_applies,
10
+ Grit::Git#get_patch, and Grit::Git#apply_patch.
11
+
12
+ == 2.4.0 / 2011-01-06
13
+ * Major Enhancements
14
+ * Add support for parsing git notes.
15
+ * Add `git cat-file --batch` support with Grit::Repo#batch.
16
+ * Grit::Process is a custom written external command invocation heavily
17
+ optimized for running git commands quickly and efficiently.
18
+ * Grit::Git#native takes an :input option for piping data into git
19
+ commands
20
+ * Grit::Git#native takes an :env option for setting the git child
21
+ process's
22
+ environment without futsing with the parent's environment.
23
+ * Grit::Git#native takes an :chdir option for setting the current working
24
+ directory (PWD) of the git child process.
25
+ * Grit::Git#native takes an :raise => true option that causes an exception
26
+ to be raised when the git child process exits non-zero.
27
+ * Minor Enhancements
28
+ * Grit::Index#commit supports custom committer/author names and dates.
29
+ * Performance enhancements with internal command output buffering.
30
+ * Reduce fork/execs needed to execute a smoke command from between 3-4
31
+ to 1.
32
+ * Git child processes are now properly parented under the grit Ruby
33
+ process instead of being dropped under init.
34
+ * Bug Fixes
35
+ * Zero-Padding issue in Grit::Index was fixed.
36
+ * Fix issue where Repo#diff skips the first diff (#42)
37
+ * Fix Repo.init_bare for repo names not ending in .git (#40)
38
+ * Fix a variety of process hangs when git stderr output or data written
39
+ to stdin exceeded PIPE_BUF bytes.
40
+
41
+ == 2.3.2 / 2011-01-06
42
+ * Erroneously released. SemVer violation and misc release screwups.
43
+
44
+ == 2.3.1
45
+ * Skipped for unknown reasons.
46
+
47
+ == 2.3.0 / 2010-09-29
48
+ * Minor Enhancements
49
+ * Add Grit::Repo.init.
50
+ * Bug Fixes
51
+ * Fix Ruby 1.9 compatibility (#24).
52
+
53
+ == 2.2.1 / 2010-08-23
54
+ * Bug Fixes
55
+ * Fix minor regression due to the changed default values in
56
+ Grit::Index#commit.
57
+
58
+ == 2.2.0 / 2010-08-19
59
+ * Minor Enhancements
60
+ * Add Grit::Index#delete to allow deletions of files from the index.
61
+
62
+ == 2.1.0 / 2010-08-04
63
+ * Major Enhancements
64
+ * Add support for parsing annotated tag objects.
65
+ * Add Grit::Repo#recent_tag_name for getting the latest tag name that is
66
+ reachable in a commit.
67
+ * Grit::Diff tracks renames properly if given the :M option.
68
+ * Grit::Commit#diffs and Grit::Commit.diffs both take a git options hash
69
+ that is passed to `git diff`.
70
+ * Minor Enhancements
71
+ * Allow diff to only take one sha
72
+ * Add merge commit diff support
73
+ * Pass along the options to Real Git on a rev-parse miss
74
+ * Raise NoSuchPath with no tree in ls_tree_path
75
+ * Make pure-ruby `ls-tree -r` work with commits
76
+ * Implement select_existing_objects
77
+ * Switch to RakeGem for build management
78
+ * Bug Fixes
79
+ * Add no_quote option for fixing tag listings.
80
+ * Raise custom exceptions on invalid tree objects.
81
+ * Fix Repo#diff (was throwing an error).
82
+
83
+ == 2.0.0 / 2009-10-27
84
+ * Major Enhancements
85
+ * All filesystem calls have been moved into Grit::Git to allow proxying
86
+ * Non-code changes
87
+ * Removed all trailing whitespace in code files
88
+ * Bug Fixes
89
+ * Repo.archive_tar_gz now passes -n option to gzip to be idempotent
90
+ * Fix RubyGit's diff to detect additions and deletions
91
+ [github.com/defunkt]
92
+
93
+ == 1.1.1 / 2009-03-31
94
+ * Changes
95
+ * Don't include test directory in gem package (it's too big)
96
+
97
+ == 1.1.0 / 2009-03-29
98
+ * Backwards breaking changes
99
+ * Diff#a_commit -> Diff#a_blob, Diff#b_commit -> Diff#b_blob
100
+ * Major Enhancments
101
+ * Ruby 1.9 compatibility [github.com/chapados, github.com/js]
102
+ * Minor Enhancements
103
+ * Convert readme to markdown
104
+ * Added a shortcut for commit_stats as Commit#stats [github.com/js]
105
+ * Add a #basename method to Submodule, Blob and Tree for retrieving the
106
+ name [github.com/js]
107
+ * Make Grit::Submodule grasp the concept of non-unix lineendings
108
+ [github.com/js]
109
+ * Added Repo#commit_deltas_from [github.com/js]
110
+ * do some mild shell escaping when running commands [github.com/js]
111
+ * Added two shortcut methods to Tree, for picking trees/blobs only
112
+ [github.com/Voker57]
113
+ * Added <=> method to Blob, needed for sorting tree [github.com/Voker57]
114
+ * Make the number of bytes to be read from git's stdout configurable
115
+ [github.com/josb]
116
+ * Repo.archive_to_file accepts extra parameters making plain zipping
117
+ possible [github.com/darwin]
118
+ * Handle commit stats that summarize commits with binary changes
119
+ [github.com/therealadam]
120
+ * Add a DiffStat class for easy access to diff stats
121
+ [github.com/therealadam]
122
+ * Don't split git logs that contain blank lines into two CommitStats
123
+ [github.com/therealadam]
124
+ * Add DiffStat#net for total change count [github.com/therealadam]
125
+
126
+ == 1.0.3 / 2009-02-13
127
+ * Minor Enhancements
128
+ * Added Grit::Commit#to_patch for plaintext formatted patches.
129
+ * Fixed Grit::Tag to work with annotated tags.
130
+
131
+ == 1.0.2 / 2009-02-10
132
+ * Minor Enhancements
133
+ * Implement Grit.version to use VERSION.yml file
134
+
135
+ == 1.0.1 / 2009-02-10
136
+ * Bug Fixes
137
+ * Add diff-lcs as a dependency
138
+
139
+ == 1.0.0 / 2009-01-27
140
+ * Tons of awesome in here. Also, we suck at updating the history.
141
+ * Let's do better at that from now on.
142
+
143
+ == 0.8.3 / 2008-07-07
144
+ * Capture stderr and log if debug is true (rsanheim)
145
+
146
+ == 0.8.2 / 2008-06-27
147
+ * Allow user provided logger (rsanheim)
148
+
149
+ == 0.8.0 / 2008-04-24
150
+ * Lots of fixes and additions
151
+
152
+ == 0.7.0 / 2008-01-07
153
+ * First public release!
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2007-2009 Tom Preston-Werner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+ This is a listing of all the places I can find that Grit actually does a
2
+ 'git' system call. My goal is to add native Ruby versions of all of them.
3
+
4
+ Completed
5
+ ===========================
6
+ ** lib/grit/blob.rb:36: @size ||= @repo.git.cat_file({:s => true}, id).chomp.to_i
7
+ ** lib/grit/blob.rb:43: @data ||= @repo.git.cat_file({:p => true}, id)
8
+ ** lib/grit/tree.rb:16: output = repo.git.ls_tree({}, treeish, *paths)
9
+
10
+
11
+
12
+ lib/grit/commit.rb:74: repo.git.rev_list({}, ref).strip.split("\n").size
13
+ lib/grit/commit.rb:92: output = repo.git.rev_list(actual_options, ref)
14
+ lib/grit/commit.rb:94: output = repo.git.rev_list(actual_options.merge(:all => true))
15
+
16
+
17
+ Next to do
18
+ ===========================
19
+ lib/grit/tag.rb:28: output = repo.git.for_each_ref(actual_options, "refs/tags")
20
+ lib/grit/head.rb:37: output = repo.git.for_each_ref(actual_options, HEAD_PREFIX)
21
+ lib/grit/head.rb:50: self.new($1, repo.git.rev_parse(options, 'HEAD'))
22
+ lib/grit/config.rb:9: @repo.git.config({}, key, value)
23
+ lib/grit/config.rb:40: @repo.git.config(:list => true).split(/\n/)
24
+
25
+
26
+ May not be fast enough
27
+ =============================
28
+ lib/grit/blob.rb:58: data = repo.git.blame({:p => true}, commit, '--', file)
29
+
30
+
31
+ More Difficult
32
+ ===========================
33
+ lib/grit/commit.rb:39: @id_abbrev ||= @repo.git.rev_parse({:short => true}, self.id).chomp
34
+ lib/grit/commit.rb:150: text = repo.git.diff({:full_index => true}, *paths)
35
+ lib/grit/commit.rb:156: diff = @repo.git.show({:full_index => true, :pretty => 'raw'}, @id)
@@ -0,0 +1,242 @@
1
+ Grit
2
+ ====
3
+
4
+ Grit gives you object oriented read/write access to Git repositories via Ruby.
5
+ The main goals are stability and performance. To this end, some of the
6
+ interactions with Git repositories are done by shelling out to the system's
7
+ `git` command, and other interactions are done with pure Ruby
8
+ reimplementations of core Git functionality. This choice, however, is
9
+ transparent to end users, and you need not know which method is being used.
10
+
11
+ This software was developed to power GitHub, and should be considered
12
+ production ready. An extensive test suite is provided to verify its
13
+ correctness.
14
+
15
+ Grit is maintained by Tom Preston-Werner, Scott Chacon, Chris Wanstrath, and
16
+ PJ Hyett.
17
+
18
+ This documentation is accurate as of Grit 2.3.
19
+
20
+
21
+ ## Requirements
22
+
23
+ * git (http://git-scm.com) tested with 1.7.2.1
24
+
25
+
26
+ ## Install
27
+
28
+ Easiest install is via RubyGems:
29
+
30
+ $ gem install grit
31
+
32
+
33
+ ## Source
34
+
35
+ Grit's Git repo is available on GitHub, which can be browsed at:
36
+
37
+ http://github.com/mojombo/grit
38
+
39
+ and cloned with:
40
+
41
+ git clone git://github.com/mojombo/grit.git
42
+
43
+
44
+ ### Development
45
+
46
+ You will need these gems to get tests to pass:
47
+
48
+ * mocha
49
+
50
+
51
+ ### Contributing
52
+
53
+ If you'd like to hack on Grit, follow these instructions. To get all of the dependencies, install the gem first.
54
+
55
+ 1. Fork the project to your own account
56
+ 1. Clone down your fork
57
+ 1. Create a thoughtfully named topic branch to contain your change
58
+ 1. Hack away
59
+ 1. Add tests and make sure everything still passes by running `rake`
60
+ 1. If you are adding new functionality, document it in README.md
61
+ 1. Do not change the version number, I will do that on my end
62
+ 1. If necessary, rebase your commits into logical chunks, without errors
63
+ 1. Push the branch up to GitHub
64
+ 1. Send a pull request for your branch
65
+
66
+
67
+ ## Usage
68
+
69
+ Grit gives you object model access to your Git repositories. Once you have
70
+ created a `Repo` object, you can traverse it to find parent commits,
71
+ trees, blobs, etc.
72
+
73
+
74
+ ### Initialize a Repo object
75
+
76
+ The first step is to create a `Grit::Repo` object to represent your repo. In
77
+ this documentation I include the `Grit` module to reduce typing.
78
+
79
+ require 'grit'
80
+ repo = Grit::Repo.new("/Users/tom/dev/grit")
81
+
82
+ In the above example, the directory `/Users/tom/dev/grit` is my working
83
+ directory and contains the `.git` directory. You can also initialize Grit with
84
+ a bare repo.
85
+
86
+ repo = Repo.new("/var/git/grit.git")
87
+
88
+
89
+ ### Getting a list of commits
90
+
91
+ From the `Repo` object, you can get a list of commits as an array of `Commit`
92
+ objects.
93
+
94
+ repo.commits
95
+ # => [#<Grit::Commit "e80bbd2ce67651aa18e57fb0b43618ad4baf7750">,
96
+ #<Grit::Commit "91169e1f5fa4de2eaea3f176461f5dc784796769">,
97
+ #<Grit::Commit "038af8c329ef7c1bae4568b98bd5c58510465493">,
98
+ #<Grit::Commit "40d3057d09a7a4d61059bca9dca5ae698de58cbe">,
99
+ #<Grit::Commit "4ea50f4754937bf19461af58ce3b3d24c77311d9">]
100
+
101
+ Called without arguments, `Repo#commits` returns a list of up to ten commits
102
+ reachable by the **master** branch (starting at the latest commit). You can
103
+ ask for commits beginning at a different branch, commit, tag, etc.
104
+
105
+ repo.commits('mybranch')
106
+ repo.commits('40d3057d09a7a4d61059bca9dca5ae698de58cbe')
107
+ repo.commits('v0.1')
108
+
109
+ You can specify the maximum number of commits to return.
110
+
111
+ repo.commits('master', 100)
112
+
113
+ If you need paging, you can specify a number of commits to skip.
114
+
115
+ repo.commits('master', 10, 20)
116
+
117
+ The above will return commits 21-30 from the commit list.
118
+
119
+
120
+ ### The Commit object
121
+
122
+ `Commit` objects contain information about that commit.
123
+
124
+ head = repo.commits.first
125
+
126
+ head.id
127
+ # => "e80bbd2ce67651aa18e57fb0b43618ad4baf7750"
128
+
129
+ head.parents
130
+ # => [#<Grit::Commit "91169e1f5fa4de2eaea3f176461f5dc784796769">]
131
+
132
+ head.tree
133
+ # => #<Grit::Tree "3536eb9abac69c3e4db583ad38f3d30f8db4771f">
134
+
135
+ head.author
136
+ # => #<Grit::Actor "Tom Preston-Werner <tom@mojombo.com>">
137
+
138
+ head.authored_date
139
+ # => Wed Oct 24 22:02:31 -0700 2007
140
+
141
+ head.committer
142
+ # => #<Grit::Actor "Tom Preston-Werner <tom@mojombo.com>">
143
+
144
+ head.committed_date
145
+ # => Wed Oct 24 22:02:31 -0700 2007
146
+
147
+ head.message
148
+ # => "add Actor inspect"
149
+
150
+ You can traverse a commit's ancestry by chaining calls to `#parents`.
151
+
152
+ repo.commits.first.parents[0].parents[0].parents[0]
153
+
154
+ The above corresponds to **master^^^** or **master~3** in Git parlance.
155
+
156
+
157
+ ### The Tree object
158
+
159
+ A tree records pointers to the contents of a directory. Let's say you want
160
+ the root tree of the latest commit on the **master** branch.
161
+
162
+ tree = repo.commits.first.tree
163
+ # => #<Grit::Tree "3536eb9abac69c3e4db583ad38f3d30f8db4771f">
164
+
165
+ tree.id
166
+ # => "3536eb9abac69c3e4db583ad38f3d30f8db4771f"
167
+
168
+ Once you have a tree, you can get the contents.
169
+
170
+ contents = tree.contents
171
+ # => [#<Grit::Blob "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666">,
172
+ #<Grit::Blob "81d2c27608b352814cbe979a6acd678d30219678">,
173
+ #<Grit::Tree "c3d07b0083f01a6e1ac969a0f32b8d06f20c62e5">,
174
+ #<Grit::Tree "4d00fe177a8407dbbc64a24dbfc564762c0922d8">]
175
+
176
+ This tree contains two `Blob` objects and two `Tree` objects. The trees are
177
+ subdirectories and the blobs are files. Trees below the root have additional
178
+ attributes.
179
+
180
+ contents.last.name
181
+ # => "lib"
182
+
183
+ contents.last.mode
184
+ # => "040000"
185
+
186
+ There is a convenience method that allows you to get a named sub-object
187
+ from a tree.
188
+
189
+ tree / "lib"
190
+ # => #<Grit::Tree "e74893a3d8a25cbb1367cf241cc741bfd503c4b2">
191
+
192
+ You can also get a tree directly from the repo if you know its name.
193
+
194
+ repo.tree
195
+ # => #<Grit::Tree "master">
196
+
197
+ repo.tree("91169e1f5fa4de2eaea3f176461f5dc784796769")
198
+ # => #<Grit::Tree "91169e1f5fa4de2eaea3f176461f5dc784796769">
199
+
200
+
201
+ ### The Blob object
202
+
203
+ A blob represents a file. Trees often contain blobs.
204
+
205
+ blob = tree.contents.first
206
+ # => #<Grit::Blob "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666">
207
+
208
+ A blob has certain attributes.
209
+
210
+ blob.id
211
+ # => "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666"
212
+
213
+ blob.name
214
+ # => "README.txt"
215
+
216
+ blob.mode
217
+ # => "100644"
218
+
219
+ blob.size
220
+ # => 7726
221
+
222
+ You can get the data of a blob as a string.
223
+
224
+ blob.data
225
+ # => "Grit is a library to ..."
226
+
227
+ You can also get a blob directly from the repo if you know its name.
228
+
229
+ repo.blob("4ebc8aea50e0a67e000ba29a30809d0a7b9b2666")
230
+ # => #<Grit::Blob "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666">
231
+
232
+
233
+ ### Other
234
+
235
+ There are many more API methods available that are not documented here. Please
236
+ reference the code for more functionality.
237
+
238
+
239
+ Copyright
240
+ ---------
241
+
242
+ Copyright (c) 2010 Tom Preston-Werner. See LICENSE for details.