Extension
module for the Mercurial `topic` extension
Return an Array of all changesets in a topic as Hglib::Extension::Topic::StackEntry
objects.
# File lib/hglib/extension/topic.rb, line 203
def stack( topic=nil, **options )
response = self.server.run_with_json_template( :stack, topic, **options )
return response.map do |entryhash|
Hglib::Extension::Topic::StackEntry.new( self, entryhash )
end
end
Operate on a topic, either the one with the given name
or the current one if name
is not given.
# File lib/hglib/extension/topic.rb, line 189
def topic( name=nil, **options )
options[:current] = true unless name || options[:clear]
result = self.server.run( :topics, name, **options )
return result.chomp
rescue Hglib::CommandError => err
# Running `topic --current` with no active topic is an error apparently, so
# if that's the reason for it being raised just return nil instead.
raise( err ) unless err.message.match?( /no active topic/i )
return nil
end
Return an Hglib::Extension::Topic::Entry
object for each topic in the repo.
# File lib/hglib/extension/topic.rb, line 173
def topics( **options )
raise ArgumentError, ":list option is implemented with the #stack method" if
options[:list]
options[:age] = true
options[:verbose] = true
response = self.server.run_with_json_template( :topics, nil, **options )
return response.map do |entryhash|
Hglib::Extension::Topic::Entry.new( self, entryhash )
end
end