Class: Amp::Git::Changeset
- Inherits:
-
Core::Repositories::AbstractChangeset
- Object
- Core::Repositories::AbstractChangeset
- Amp::Git::Changeset
- Defined in:
- lib/amp-git/repo_format/changeset.rb
Overview
A Changeset is a simple way of accessing the repository within a certain revision. For example, if the user specifies revision # 36, or revision 3adf21, then we can look those up, and work within the repository at the moment of that revision.
Instance Attribute Summary collapse
-
#repo ⇒ Object
(also: #repository)
Returns the value of attribute repo.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Compares 2 changesets so we can sort them and whatnot.
-
#all_files ⇒ Array<String>
Returns a list of all files that are tracked at this current revision.
-
#altered_files ⇒ Array<String>
What files have been altered in this changeset?.
-
#branch ⇒ String
Which branch this changeset belongs to.
-
#date ⇒ Time
When was the changeset made?.
- #description ⇒ String
-
#each(&b) ⇒ Changeset
Iterates over every tracked file at this point in time.
-
#get_file(filename) ⇒ AbstractVersionedFile
(also: #[])
Retrieve
filename
. -
#initialize(repo, short_name) ⇒ Changeset
constructor
A new instance of Changeset.
- #node ⇒ Object
-
#parents ⇒ Array<Abstract Changeset>
the nodes that this node inherits from.
-
#user ⇒ String
The user who made the changeset.
-
#working? ⇒ Boolean
Is this changeset a working changeset?.
Constructor Details
#initialize(repo, short_name) ⇒ Changeset
Returns a new instance of Changeset.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/amp-git/repo_format/changeset.rb', line 31 def initialize(repo, short_name) @repo = repo if short_name.kind_of?(Integer) @revision = short_name @node_id = convert_rev_to_node(short_name) else @revision = convert_node_to_rev(short_name) @node_id = short_name end end |
Instance Attribute Details
#repo ⇒ Object Also known as: repository
Returns the value of attribute repo.
27 28 29 |
# File 'lib/amp-git/repo_format/changeset.rb', line 27 def repo @repo end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
28 29 30 |
# File 'lib/amp-git/repo_format/changeset.rb', line 28 def revision @revision end |
Instance Method Details
#<=>(other) ⇒ Integer
Compares 2 changesets so we can sort them and whatnot
50 51 52 |
# File 'lib/amp-git/repo_format/changeset.rb', line 50 def <=>(other) date <=> other.date end |
#all_files ⇒ Array<String>
Returns a list of all files that are tracked at this current revision.
128 129 130 131 |
# File 'lib/amp-git/repo_format/changeset.rb', line 128 def all_files parse! @all_files end |
#altered_files ⇒ Array<String>
What files have been altered in this changeset?
119 120 121 122 |
# File 'lib/amp-git/repo_format/changeset.rb', line 119 def altered_files parse! @altered_files end |
#branch ⇒ String
Which branch this changeset belongs to
103 104 105 106 |
# File 'lib/amp-git/repo_format/changeset.rb', line 103 def branch parse! raise NotImplementedError.new("branch() must be implemented by subclasses of AbstractChangeset.") end |
#date ⇒ Time
When was the changeset made?
85 86 87 88 |
# File 'lib/amp-git/repo_format/changeset.rb', line 85 def date parse! @date end |
#description ⇒ String
110 111 112 113 |
# File 'lib/amp-git/repo_format/changeset.rb', line 110 def description parse! @description end |
#each(&b) ⇒ Changeset
Iterates over every tracked file at this point in time.
58 59 60 61 |
# File 'lib/amp-git/repo_format/changeset.rb', line 58 def each(&b) all_files.each( &b) self end |
#get_file(filename) ⇒ AbstractVersionedFile Also known as: []
Retrieve filename
76 77 78 |
# File 'lib/amp-git/repo_format/changeset.rb', line 76 def get_file(filename) VersionedFile.new @repo, file, :revision => node end |
#node ⇒ Object
42 |
# File 'lib/amp-git/repo_format/changeset.rb', line 42 def node; @node_id; end |
#parents ⇒ Array<Abstract Changeset>
the nodes that this node inherits from
67 68 69 70 |
# File 'lib/amp-git/repo_format/changeset.rb', line 67 def parents parse! @parents end |
#user ⇒ String
The user who made the changeset
94 95 96 97 |
# File 'lib/amp-git/repo_format/changeset.rb', line 94 def user parse! @user end |
#working? ⇒ Boolean
Is this changeset a working changeset?
136 137 138 |
# File 'lib/amp-git/repo_format/changeset.rb', line 136 def working? false end |