src/eric7/Plugins/VcsPlugins/vcsGit/GitUtilities.py

Wed, 19 Oct 2022 13:39:16 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 19 Oct 2022 13:39:16 +0200
branch
eric7
changeset 9421
989ee2535d59
parent 9413
80c06d472826
child 9624
b47dfa7a137d
permissions
-rw-r--r--

Git Interface and Mercurial Interface
- added support for `git blame --ignore-revs-file` including an action to create such a skip list file
- added support for `hg annotate --skip` including an action to create a file for the commit IDs to be skipped (one per line)

# -*- coding: utf-8 -*-

# Copyright (c) 2014 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing some common utility functions for the Git package.
"""

import os

from PyQt6.QtCore import QProcessEnvironment

from eric7 import Utilities


def getConfigPath():
    """
    Public function to get the filename of the config file.

    @return filename of the config file (string)
    """
    if Utilities.isWindowsPlatform():
        userprofile = os.environ["USERPROFILE"]
        return os.path.join(userprofile, ".gitconfig")
    else:
        homedir = Utilities.getHomeDir()
        return os.path.join(homedir, ".gitconfig")


def prepareProcess(proc, language=""):
    """
    Public function to prepare the given process.

    @param proc reference to the process to be prepared (QProcess)
    @param language language to be set (string)
    """
    env = QProcessEnvironment.systemEnvironment()

    # set the language for the process
    if language:
        env.insert("LANGUAGE", language)

    proc.setProcessEnvironment(env)

eric ide

mercurial