Class: BetweenMeals::Repo::Hg::Cmd

Inherits:
Cmd
  • Object
show all
Defined in:
lib/between_meals/repo/hg/cmd.rb

Instance Attribute Summary

Attributes inherited from Cmd

#bin

Instance Method Summary collapse

Methods inherited from Cmd

#cmd, #initialize

Constructor Details

This class inherits a constructor from BetweenMeals::Cmd

Instance Method Details

#amend(msg) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/between_meals/repo/hg/cmd.rb', line 48

def amend(msg)
  f = Tempfile.new('between_meals.hg.amend')
  begin
    f.write(msg)
    f.flush
    cmd("commit --amend --exclude '**' -l #{f.path}")
  ensure
    f.close
    f.unlink
  end
end

#clone(url, repo_path) ⇒ Object



32
33
34
# File 'lib/between_meals/repo/hg/cmd.rb', line 32

def clone(url, repo_path)
  cmd("clone #{url} #{repo_path}")
end

#log(template, rev = '.') ⇒ Object



28
29
30
# File 'lib/between_meals/repo/hg/cmd.rb', line 28

def log(template, rev = '.')
  cmd("log -r #{rev} -l 1 -T '{#{template}}'")
end

#manifestObject



40
41
42
# File 'lib/between_meals/repo/hg/cmd.rb', line 40

def manifest
  cmd('manifest')
end

#pullObject



36
37
38
# File 'lib/between_meals/repo/hg/cmd.rb', line 36

def pull
  cmd('pull --rebase')
end

#rev(rev) ⇒ Object



24
25
26
# File 'lib/between_meals/repo/hg/cmd.rb', line 24

def rev(rev)
  cmd("log -r #{rev}")
end

#status(start_ref = nil, end_ref = nil) ⇒ Object



60
61
62
63
64
65
66
67
68
# File 'lib/between_meals/repo/hg/cmd.rb', line 60

def status(start_ref = nil, end_ref = nil)
  if start_ref && end_ref
    cmd("status --rev #{start_ref} --rev #{end_ref}")
  elsif start_ref
    cmd("status --rev #{start_ref}")
  else
    cmd('status')
  end
end

#usernameObject



44
45
46
# File 'lib/between_meals/repo/hg/cmd.rb', line 44

def username
  cmd('config ui.username')
end