Class: MultiGit::Repository Abstract
- Inherits:
-
Object
- Object
- MultiGit::Repository
- Extended by:
- Utils::AbstractMethods
- Defined in:
- lib/multi_git/repository.rb
Overview
Abstract base class for all repository implementations.
Direct Known Subclasses
GitBackend::Repository, JGitBackend::Repository, MultiGit::RuggedBackend::Repository
Object interface collapse
-
#include?(oid) ⇒ Boolean
abstract
Checks whether this repository contains a given oid.
-
#parse(expression) ⇒ String
abstract
Resolves an expression into an oid.
-
#read(expression) ⇒ MultiGit::Object
abstract
Reads an object from the database.
-
#write(content) ⇒ MultiGit::Object
(also: #<<)
abstract
Writes something to the repository.
References interface collapse
-
#branch(name) ⇒ Ref
Opens a branch.
-
#each_branch(filter = :all) {|branch| ... } ⇒ Enumerable<Ref>
Yields either all, local or remote branches.
-
#each_tag {|tag| ... } ⇒ Enumerable<Ref>
Yields all tags.
-
#head ⇒ Ref
Gets the HEAD ref.
-
#ref(name) ⇒ MultiGit::Ref
(also: #[])
abstract
Opens a reference.
-
#tag(name) ⇒ Ref
Opens a tag.
Instance Method Summary collapse
-
#bare? ⇒ Object
abstract
Is this repository bare?.
-
#config ⇒ Config
abstract
Returns the config.
-
#git_dir ⇒ String
abstract
Returns the repository directory (the place where the internal stuff is stored).
-
#git_work_tree ⇒ String
abstract
Returns the working directory (the place where your files are).
Methods included from Utils::AbstractMethods
Instance Method Details
#bare? ⇒ Object
Is this repository bare?
61 |
# File 'lib/multi_git/repository.rb', line 61 abstract :bare? |
#branch(name) ⇒ Ref
Opens a branch
162 163 164 165 166 167 168 |
# File 'lib/multi_git/repository.rb', line 162 def branch(name) if name.include? '/' ref('refs/remotes/'+name) else ref('refs/heads/'+name) end end |
#config ⇒ Config
Returns the config
44 |
# File 'lib/multi_git/repository.rb', line 44 abstract :config |
#each_branch(filter = :all) {|branch| ... } ⇒ Enumerable<Ref>
Yields either all, local or remote branches. If called with a regular expression it will be used to filter the branches by name.
188 |
# File 'lib/multi_git/repository.rb', line 188 abstract :each_branch |
#each_tag {|tag| ... } ⇒ Enumerable<Ref>
Yields all tags.
197 |
# File 'lib/multi_git/repository.rb', line 197 abstract :each_tag |
#git_dir ⇒ String
Returns the repository directory (the place where the internal stuff is stored)
50 |
# File 'lib/multi_git/repository.rb', line 50 abstract :git_dir |
#git_work_tree ⇒ String
Returns the working directory (the place where your files are)
56 |
# File 'lib/multi_git/repository.rb', line 56 abstract :git_work_tree |
#head ⇒ Ref
Gets the HEAD ref.
142 143 144 |
# File 'lib/multi_git/repository.rb', line 142 def head return ref('HEAD') end |
#include?(oid) ⇒ Boolean
Checks whether this repository contains a given oid.
83 |
# File 'lib/multi_git/repository.rb', line 83 abstract :include? |
#parse(expression) ⇒ String
Resolves an expression into an oid.
95 |
# File 'lib/multi_git/repository.rb', line 95 abstract :parse |
#read(expression) ⇒ MultiGit::Object
Reads an object from the database.
76 |
# File 'lib/multi_git/repository.rb', line 76 abstract :read |
#ref(name) ⇒ MultiGit::Ref Also known as: []
Opens a reference. A reference is usually known as branch or tag.
138 |
# File 'lib/multi_git/repository.rb', line 138 abstract :ref |
#tag(name) ⇒ Ref
Opens a tag
174 175 176 |
# File 'lib/multi_git/repository.rb', line 174 def tag(name) ref('refs/tags/'+name) end |
#write(content) ⇒ MultiGit::Object Also known as: <<
Writes something to the repository.
If called with a String or an IO, this method creates a Blob with the given content. This is the easiest way to create blobs.
If called with a Object, this method determines if the object does already exist and writes it otherwise.
If called with a Builder, this method inserts the content of the builder to the repository. This is the easiest way to create trees/commits.
112 |
# File 'lib/multi_git/repository.rb', line 112 abstract :write |