Class: Hglib::Repo::Bookmark
- Inherits:
-
Object
- Object
- Hglib::Repo::Bookmark
- Extended by:
- MethodUtilities, Loggability
- Defined in:
- lib/hglib/repo/bookmark.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
The name of the bookmark.
-
#node ⇒ Object
readonly
The SHA of the commit the bookmark is currently on.
-
#repo ⇒ Object
readonly
The Hglib::Repo the bookmark lives in.
-
#rev ⇒ Object
readonly
The revision number of the commit the bookmark is currently on.
Instance Method Summary collapse
-
#active ⇒ Object
Whether or not the bookmark is currently active.
-
#delete ⇒ Object
Delete the bookmark from its repository.
-
#initialize(repo, bookmark:, node:, rev:, active: false) ⇒ Bookmark
constructor
Create a new Bookmark with the given values.
-
#move_to(revision) ⇒ Object
Move the bookmark to the specified
revision
.
Methods included from MethodUtilities
attr_predicate, attr_predicate_accessor, singleton_attr_accessor, singleton_attr_reader, singleton_attr_writer, singleton_method_alias
Constructor Details
#initialize(repo, bookmark:, node:, rev:, active: false) ⇒ Bookmark
Create a new Bookmark with the given values.
26 27 28 29 30 31 32 |
# File 'lib/hglib/repo/bookmark.rb', line 26 def initialize( repo, bookmark:, node:, rev:, active: false ) @repo = repo @name = bookmark @node = node @rev = rev @active = active end |
Instance Attribute Details
#name ⇒ Object (readonly)
The name of the bookmark
45 46 47 |
# File 'lib/hglib/repo/bookmark.rb', line 45 def name @name end |
#node ⇒ Object (readonly)
The SHA of the commit the bookmark is currently on
49 50 51 |
# File 'lib/hglib/repo/bookmark.rb', line 49 def node @node end |
#repo ⇒ Object (readonly)
The Hglib::Repo the bookmark lives in
41 42 43 |
# File 'lib/hglib/repo/bookmark.rb', line 41 def repo @repo end |
#rev ⇒ Object (readonly)
The revision number of the commit the bookmark is currently on
53 54 55 |
# File 'lib/hglib/repo/bookmark.rb', line 53 def rev @rev end |
Instance Method Details
#active ⇒ Object
Whether or not the bookmark is currently active
57 |
# File 'lib/hglib/repo/bookmark.rb', line 57 attr_predicate :active |
#delete ⇒ Object
Delete the bookmark from its repository.
61 62 63 |
# File 'lib/hglib/repo/bookmark.rb', line 61 def delete return self.repo.bookmark( self.name, delete: true ) end |
#move_to(revision) ⇒ Object
Move the bookmark to the specified revision
.
67 68 69 |
# File 'lib/hglib/repo/bookmark.rb', line 67 def move_to( revision ) return self.repo.bookmark( self.name, rev: revision, force: true ) end |