Class: HGTK::Hg

Inherits:
Object
  • Object
show all
Defined in:
lib/hgtk/hg.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Hg) initialize(**kwargs)

Returns a new instance of Hg

Parameters:

  • kwargs (Hash)

Options Hash (**kwargs):

  • :dir (String?)

    Path to the hgtk command. Current working directory by default.



14
15
16
# File 'lib/hgtk/hg.rb', line 14

def initialize **kwargs
  @dir = kwargs.fetch :dir, Dir.pwd
end

Instance Attribute Details

- (Object) dir (readonly)

Returns the value of attribute dir



9
10
11
# File 'lib/hgtk/hg.rb', line 9

def dir
  @dir
end

Instance Method Details

- (Object) incoming

Check for incoming changesets.



28
29
# File 'lib/hgtk/hg.rb', line 28

def incoming
end

- (Object) outgoing

Check for outgoing changesets.



32
33
# File 'lib/hgtk/hg.rb', line 32

def outgoing
end

- (Object) status

Check repo status (uncommitted changes).



19
20
21
22
23
24
25
# File 'lib/hgtk/hg.rb', line 19

def status
  Dir["#{@dir}/*/.hg"]
    .map { |path| File.absolute_path File.dirname path }
    .each do |path|
      repo = HGTK::Repo.new path
    end
end

- (Object) sync

Synchronize repository by pulling, then pushing.



36
37
# File 'lib/hgtk/hg.rb', line 36

def sync
end