class Fastlane::Actions::HgEnsureCleanStatusAction

Raises an exception and stop the lane execution if the repo is not in a clean state

Public Class Methods

author() click to toggle source
# File fastlane/lib/fastlane/actions/hg_ensure_clean_status.rb, line 33
def self.author
  # credits to lmirosevic for original git version
  "sjrmanning"
end
category() click to toggle source
# File fastlane/lib/fastlane/actions/hg_ensure_clean_status.rb, line 48
def self.category
  :source_control
end
description() click to toggle source
# File fastlane/lib/fastlane/actions/hg_ensure_clean_status.rb, line 19
def self.description
  "Raises an exception if there are uncommitted hg changes"
end
details() click to toggle source
# File fastlane/lib/fastlane/actions/hg_ensure_clean_status.rb, line 23
def self.details
  "Along the same lines as the [ensure_git_status_clean](https://docs.fastlane.tools/actions/ensure_git_status_clean/) action, this is a sanity check to ensure the working mercurial repo is clean. Especially useful to put at the beginning of your Fastfile in the `before_all` block."
end
example_code() click to toggle source
# File fastlane/lib/fastlane/actions/hg_ensure_clean_status.rb, line 42
def self.example_code
  [
    'hg_ensure_clean_status'
  ]
end
is_supported?(platform) click to toggle source
# File fastlane/lib/fastlane/actions/hg_ensure_clean_status.rb, line 38
def self.is_supported?(platform)
  true
end
output() click to toggle source
# File fastlane/lib/fastlane/actions/hg_ensure_clean_status.rb, line 27
def self.output
  [
    ['HG_REPO_WAS_CLEAN_ON_START', 'Stores the fact that the hg repo was clean at some point']
  ]
end
run(params) click to toggle source
# File fastlane/lib/fastlane/actions/hg_ensure_clean_status.rb, line 8
def self.run(params)
  repo_clean = `hg status`.empty?

  if repo_clean
    UI.success('Mercurial status is clean, all good! 😎')
    Actions.lane_context[SharedValues::HG_REPO_WAS_CLEAN_ON_START] = true
  else
    UI.user_error!('Mercurial repository is dirty! Please ensure the repo is in a clean state by committing/stashing/discarding all changes first.')
  end
end