Class: Amp::Repositories::AbstractLocalRepository
- Includes:
- CommonLocalRepoMethods
- Defined in:
- lib/amp/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.
Direct Known Subclasses
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.
-
#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 ⇒ 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
texttofilename, wherefilenameis 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.
116 117 118 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 116 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.
79 80 81 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 79 def commit(opts={}) raise NotImplementedError.new("commit() must be implemented by subclasses of AbstractLocalRepository.") end |
#file_modified?(file, opts = {}) ⇒ Boolean
Has the file been modified from node1 to node2?
34 35 36 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 34 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.
132 133 134 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 132 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.
142 143 144 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 142 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.
152 153 154 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 152 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.
106 107 108 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 106 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.
92 93 94 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 92 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)
15 16 17 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 15 def root raise NotImplementedError.new("root() must be implemented by subclasses of AbstractLocalRepository.") end |
#size ⇒ Fixnum
Returns the number of changesets in the repository.
124 125 126 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 124 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.
24 25 26 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 24 def staging_area raise NotImplementedError.new("staging_area() must be implemented by subclasses of AbstractLocalRepository.") end |
#try_resolve_conflict ⇒ Object
Attempts to resolve the given file, according to how mercurial manages merges. Needed for api compliance.
162 163 164 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 162 def try_resolve_conflict 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.
175 176 177 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 175 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.
44 45 46 |
# File 'lib/amp/repository/abstract/abstract_local_repo.rb', line 44 def working_write(filename, text) raise NotImplementedError.new("working_write() must be implemented by subclasses of AbstractLocalRepository.") end |