def get_changed_files(include_staged=False):
  """
  Returns a list of the files that changed in the Git repository. This is
  used to check if the files that are supposed to be upgraded have changed.
  If so, the upgrade will be prevented.
  """

  process = subprocess.Popen(['git', 'status', '--porcelain'],
    stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  stdout, __ = process.communicate()
  if process.returncode != 0:
    raise ValueError(stdout)
  files = []
  for line in stdout.decode().split('\n'):
    if not line or line.startswith('#'): continue
    assert line[2] == ' '
    if not include_staged and line[1] == ' ': continue
    files.append(line[3:])
  return files
Returns a list of the files that changed in the Git repository. This is
  used to check if the files that are supposed to be upgraded have changed.
  If so, the upgrade will be prevented.