The identification of a particular revision of a repository.
The default branch name to use
The SHA of the zeroth node
The SHA of the node when the repo is at tip
The bookmarks set on the revision of the repo.
The name of the current branch
The long-form revision ID
The long-form revision ID
The ID of the current changeset node
The current IDs of the current revision's parent(s).
The tags belonging to the revision of the repo.
Create a new repository ID with the given global
revision identifier, one or more tags
, and other options.
# File lib/hglib/repo/id.rb, line 24
def initialize( id:, branch: DEFAULT_BRANCH, node: DEFAULT_NODE, dirty: false,
parents: [], tags: [], bookmarks: [] )
@id = id[ /\p{XDigit}{40}/ ]
@branch = branch
@node = node
@dirty = dirty == '+'
@tags = Array( tags )
@parents = Array( parents )
@bookmarks = Array( bookmarks )
end
Comparison operator – returns true
if the other
object is another Hglib::Repo::Id
with the same values, or a String containing the global
revision identifier.
# File lib/hglib/repo/id.rb, line 94
def ==( other )
return (other.is_a?( self.class ) && self.to_s == other.to_s) ||
self.global == other
end
Returns true
if the Id's revision ID is the DEFAULT_ID
# File lib/hglib/repo/id.rb, line 101
def default?
return self.id == DEFAULT_ID
end
Does the repo have uncommitted changes?
# File lib/hglib/repo/id.rb, line 60
attr_predicate :dirty
Return the short form of the global ID.
# File lib/hglib/repo/id.rb, line 74
def short_id
return self.id[ 0, 12 ]
end
Return the ID as a String in the form used by the command line.
# File lib/hglib/repo/id.rb, line 80
def to_s
str = self.global.dup
str << '+' if self.uncommitted_changes?
str << ' ' << self.tags.join( '/' ) unless self.tags.empty?
str << ' ' << self.bookmarks.join( '/' ) unless self.bookmarks.empty?
return str
end