Class: Hglib::Repo::Bookmark

Inherits:
Object
  • Object
show all
Extended by:
MethodUtilities, Loggability
Defined in:
lib/hglib/repo/bookmark.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

The name of the bookmark



45
46
47
# File 'lib/hglib/repo/bookmark.rb', line 45

def name
  @name
end

#nodeObject (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

#repoObject (readonly)

The Hglib::Repo the bookmark lives in



41
42
43
# File 'lib/hglib/repo/bookmark.rb', line 41

def repo
  @repo
end

#revObject (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

#activeObject

Whether or not the bookmark is currently active



57
# File 'lib/hglib/repo/bookmark.rb', line 57

attr_predicate :active

#deleteObject

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