Class: Amp::Core::Repositories::AbstractLocalRepository
- Inherits:
-
Object
- Object
- Amp::Core::Repositories::AbstractLocalRepository
- Includes:
- CommonLocalRepoMethods
- Defined in:
- lib/amp-core/repository/abstract/abstract_local_repo.rb
Overview
This class contains the functionality of all repositories ever. Methods here rely on certain base methods that are unimplemented, left as an exercise for the reader.
Instance Attribute Summary
Attributes included from CommonLocalRepoMethods
Instance Method Summary collapse
-
#[](revision) ⇒ AbstractChangeset
Returns a changeset for the given revision.
-
#commit(opts = {}) ⇒ String
Commits a changeset or set of files to the repository.
-
#default_branch_name ⇒ String
Regarding branch support.
-
#file_modified?(file, opts = {}) ⇒ Boolean
Has the file been modified from node1 to node2?.
-
#get_file(file, revision) ⇒ AbstractVersionedFile
Gets a given file at the given revision, in the form of an AbstractVersionedFile object.
-
#mark_conflicted(*filenames) ⇒ Boolean
In whatever conflict-resolution system your repository format defines, mark a given file as in conflict.
-
#mark_resolved(*filenames) ⇒ Boolean
In whatever conflict-resolution system your repository format defines, mark a given file as no longer in conflict (resolved).
-
#pull(remote_repo, options = {}) ⇒ Boolean
Pulls changesets from a remote repository Does not apply them to the working directory.
-
#push(remote_repo, options = {}) ⇒ Boolean
Pushes changesets to a remote repository.
-
#root ⇒ String
Returns the root of the repository (not the .hg/.git root).
-
#size ⇒ Fixnum
Returns the number of changesets in the repository.
-
#staging_area ⇒ AbstractStagingArea
Returns the staging area for the repository, which provides the ability to add/remove files in the next commit.
-
#try_resolve_conflict(filename) ⇒ Object
Attempts to resolve the given file, according to how mercurial manages merges.
-
#uncommitted_merge_files ⇒ Array<Array<String, Symbol>>
Returns all files that have not been merged.
-
#working_write(filename, text) ⇒ Object
Write
text
tofilename
, wherefilename
is local to the root.
Methods included from CommonLocalRepoMethods
#add, #each, #fix_files, #init, #initialize, #relative_join, #remove, #run_hook, #status, #walk, #working_join
Instance Method Details
#[](revision) ⇒ AbstractChangeset
Returns a changeset for the given revision. Must support at least integer indexing as well as a string “node ID”, if the repository system has such IDs. Also “tip” should return the tip of the revision tree.
131 132 133 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 131 def [](revision) raise NotImplementedError.new("[]() must be implemented by subclasses of AbstractLocalRepository.") end |
#commit(opts = {}) ⇒ String
Commits a changeset or set of files to the repository. You will quite often use this method since it’s basically the basis of version control systems.
94 95 96 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 94 def commit(opts={}) raise NotImplementedError.new("commit() must be implemented by subclasses of AbstractLocalRepository.") end |
#default_branch_name ⇒ String
Regarding branch support.
For each repository format, you begin in a default branch. Each repo format, of course, starts with a different default branch. Mercurial’s is “default”, Git’s is “master”.
202 203 204 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 202 def default_branch_name raise NotImplementedError.new("default_branch_name() must be implemented by subclasses of AbstractLocalRepository.") end |
#file_modified?(file, opts = {}) ⇒ Boolean
Has the file been modified from node1 to node2?
49 50 51 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 49 def file_modified?(file, opts={}) raise NotImplementedError.new("file_modified?() must be implemented by subclasses of AbstractLocalRepository.") end |
#get_file(file, revision) ⇒ AbstractVersionedFile
Gets a given file at the given revision, in the form of an AbstractVersionedFile object.
147 148 149 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 147 def get_file(file, revision) raise NotImplementedError.new("get_file() must be implemented by subclasses of AbstractLocalRepository.") end |
#mark_conflicted(*filenames) ⇒ Boolean
In whatever conflict-resolution system your repository format defines, mark a given file as in conflict. If your format does not manage conflict resolution, re-define this method as a no-op.
157 158 159 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 157 def mark_conflicted(*filenames) raise NotImplementedError.new("mark_conflicted() must be implemented by subclasses of AbstractLocalRepository.") end |
#mark_resolved(*filenames) ⇒ Boolean
In whatever conflict-resolution system your repository format defines, mark a given file as no longer in conflict (resolved). If your format does not manage conflict resolution, re-define this method as a no-op.
167 168 169 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 167 def mark_resolved(*filenames) raise NotImplementedError.new("mark_resolved() must be implemented by subclasses of AbstractLocalRepository.") end |
#pull(remote_repo, options = {}) ⇒ Boolean
Pulls changesets from a remote repository Does not apply them to the working directory.
121 122 123 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 121 def pull(remote_repo, = {}) raise NotImplementedError.new("pull() must be implemented by subclasses of AbstractLocalRepository.") end |
#push(remote_repo, options = {}) ⇒ Boolean
Pushes changesets to a remote repository.
107 108 109 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 107 def push(remote_repo, = {}) raise NotImplementedError.new("push() must be implemented by subclasses of AbstractLocalRepository.") end |
#root ⇒ String
Returns the root of the repository (not the .hg/.git root)
30 31 32 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 30 def root raise NotImplementedError.new("root() must be implemented by subclasses of AbstractLocalRepository.") end |
#size ⇒ Fixnum
Returns the number of changesets in the repository.
139 140 141 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 139 def size raise NotImplementedError.new("size() must be implemented by subclasses of AbstractLocalRepository.") end |
#staging_area ⇒ AbstractStagingArea
Returns the staging area for the repository, which provides the ability to add/remove files in the next commit.
39 40 41 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 39 def staging_area raise NotImplementedError.new("staging_area() must be implemented by subclasses of AbstractLocalRepository.") end |
#try_resolve_conflict(filename) ⇒ Object
Attempts to resolve the given file, according to how mercurial manages merges. Needed for api compliance.
177 178 179 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 177 def try_resolve_conflict(filename) raise NotImplementedError.new("try_resolve_conflict() must be implemented by subclasses of AbstractLocalRepository.") end |
#uncommitted_merge_files ⇒ Array<Array<String, Symbol>>
think up a better name
Returns all files that have not been merged. In other words, if we’re waiting for the user to fix up their merge, then return the list of files we need to be correct before merging.
190 191 192 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 190 def uncommitted_merge_files raise NotImplementedError.new("uncommitted_merge_files() must be implemented by subclasses of AbstractLocalRepository.") end |
#working_write(filename, text) ⇒ Object
Write text
to filename
, where filename
is local to the root.
59 60 61 |
# File 'lib/amp-core/repository/abstract/abstract_local_repo.rb', line 59 def working_write(filename, text) raise NotImplementedError.new("working_write() must be implemented by subclasses of AbstractLocalRepository.") end |