Ejemplo n.º 1
0
def setup_environment():
    # Spoof an X11 display for SSH
    os.environ.setdefault('DISPLAY', ':0')

    # Setup the path so that git finds us when we run 'git cola'
    path_entries = os.environ.get('PATH').split(os.pathsep)
    bindir = os.path.dirname(os.path.abspath(__file__))
    path_entries.insert(0, bindir)
    path = os.pathsep.join(path_entries)
    compat.putenv('PATH', path)

    # We don't ever want a pager
    compat.putenv('GIT_PAGER', '')

    # Setup *SSH_ASKPASS
    git_askpass = os.getenv('GIT_ASKPASS')
    ssh_askpass = os.getenv('SSH_ASKPASS')
    if git_askpass:
        askpass = git_askpass
    elif ssh_askpass:
        askpass = ssh_askpass
    elif sys.platform == 'darwin':
        askpass = resources.share('bin', 'ssh-askpass-darwin')
    else:
        askpass = resources.share('bin', 'ssh-askpass')

    compat.putenv('GIT_ASKPASS', askpass)
    compat.putenv('SSH_ASKPASS', askpass)

    # --- >8 --- >8 ---
    # Git v1.7.10 Release Notes
    # =========================
    #
    # Compatibility Notes
    # -------------------
    #
    #  * From this release on, the "git merge" command in an interactive
    #   session will start an editor when it automatically resolves the
    #   merge for the user to explain the resulting commit, just like the
    #   "git commit" command does when it wasn't given a commit message.
    #
    #   If you have a script that runs "git merge" and keeps its standard
    #   input and output attached to the user's terminal, and if you do not
    #   want the user to explain the resulting merge commits, you can
    #   export GIT_MERGE_AUTOEDIT environment variable set to "no", like
    #   this:
    #
    #        #!/bin/sh
    #        GIT_MERGE_AUTOEDIT=no
    #        export GIT_MERGE_AUTOEDIT
    #
    #   to disable this behavior (if you want your users to explain their
    #   merge commits, you do not have to do anything).  Alternatively, you
    #   can give the "--no-edit" option to individual invocations of the
    #   "git merge" command if you know everybody who uses your script has
    #   Git v1.7.8 or newer.
    # --- >8 --- >8 ---
    # Longer-term: Use `git merge --no-commit` so that we always
    # have a chance to explain our merges.
    compat.putenv('GIT_MERGE_AUTOEDIT', 'no')
Ejemplo n.º 2
0
def setup_environment():
    # Spoof an X11 display for SSH
    os.environ.setdefault("DISPLAY", ":0")

    # Setup the path so that git finds us when we run 'git cola'
    path_entries = os.environ.get("PATH").split(os.pathsep)
    bindir = os.path.dirname(os.path.abspath(__file__))
    path_entries.insert(0, bindir)
    path = os.pathsep.join(path_entries)
    compat.putenv("PATH", path)

    # We don't ever want a pager
    compat.putenv("GIT_PAGER", "")

    # Setup *SSH_ASKPASS
    git_askpass = os.getenv("GIT_ASKPASS")
    ssh_askpass = os.getenv("SSH_ASKPASS")
    if git_askpass:
        askpass = git_askpass
    elif ssh_askpass:
        askpass = ssh_askpass
    elif sys.platform == "darwin":
        askpass = resources.share("bin", "ssh-askpass-darwin")
    else:
        askpass = resources.share("bin", "ssh-askpass")

    compat.putenv("GIT_ASKPASS", askpass)
    compat.putenv("SSH_ASKPASS", askpass)

    # --- >8 --- >8 ---
    # Git v1.7.10 Release Notes
    # =========================
    #
    # Compatibility Notes
    # -------------------
    #
    #  * From this release on, the "git merge" command in an interactive
    #   session will start an editor when it automatically resolves the
    #   merge for the user to explain the resulting commit, just like the
    #   "git commit" command does when it wasn't given a commit message.
    #
    #   If you have a script that runs "git merge" and keeps its standard
    #   input and output attached to the user's terminal, and if you do not
    #   want the user to explain the resulting merge commits, you can
    #   export GIT_MERGE_AUTOEDIT environment variable set to "no", like
    #   this:
    #
    #        #!/bin/sh
    #        GIT_MERGE_AUTOEDIT=no
    #        export GIT_MERGE_AUTOEDIT
    #
    #   to disable this behavior (if you want your users to explain their
    #   merge commits, you do not have to do anything).  Alternatively, you
    #   can give the "--no-edit" option to individual invocations of the
    #   "git merge" command if you know everybody who uses your script has
    #   Git v1.7.8 or newer.
    # --- >8 --- >8 ---
    # Longer-term: Use `git merge --no-commit` so that we always
    # have a chance to explain our merges.
    compat.putenv("GIT_MERGE_AUTOEDIT", "no")
Ejemplo n.º 3
0
def _build_translations():
    print 'running build_translations'
    sources = glob(resources.share('po', '*.po'))
    sources = glob('share/git-cola/po/*.po')
    for src in sources:
        dst = resources.qm(os.path.basename(src)[:-3])
        if _dirty(src, dst):
            print '\tmsgfmt --qt %s -o %s' % (src, dst)
            utils.run_cmd(['msgfmt', '--qt', src, '-o', dst])
Ejemplo n.º 4
0
def setup_environment():
    # Spoof an X11 display for SSH
    os.environ.setdefault('DISPLAY', ':0')

    # Provide an SSH_ASKPASS fallback
    if sys.platform == 'darwin':
        os.environ.setdefault('SSH_ASKPASS',
                              resources.share('bin', 'ssh-askpass-darwin'))
    else:
        os.environ.setdefault('SSH_ASKPASS',
                              resources.share('bin', 'ssh-askpass'))

    # Setup the path so that git finds us when we run 'git cola'
    path_entries = os.environ.get('PATH').split(os.pathsep)
    bindir = os.path.dirname(os.path.abspath(__file__))
    path_entries.insert(0, bindir)
    path = os.pathsep.join(path_entries)
    os.environ['PATH'] = path
    os.putenv('PATH', path)
Ejemplo n.º 5
0
def setup_environment():
    # Allow Ctrl-C to exit
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    # Session management wants an absolute path when restarting
    sys.argv[0] = sys_argv0 = core.abspath(sys.argv[0])

    # Spoof an X11 display for SSH
    os.environ.setdefault('DISPLAY', ':0')

    if not core.getenv('SHELL', ''):
        for shell in ('/bin/zsh', '/bin/bash', '/bin/sh'):
            if os.path.exists(shell):
                compat.setenv('SHELL', shell)
                break

    # Setup the path so that git finds us when we run 'git cola'
    path_entries = core.getenv('PATH', '').split(os.pathsep)
    bindir = os.path.dirname(sys_argv0)
    path_entries.append(bindir)
    path = os.pathsep.join(path_entries)
    compat.setenv('PATH', path)

    # We don't ever want a pager
    compat.setenv('GIT_PAGER', '')

    # Setup *SSH_ASKPASS
    git_askpass = core.getenv('GIT_ASKPASS')
    ssh_askpass = core.getenv('SSH_ASKPASS')
    if git_askpass:
        askpass = git_askpass
    elif ssh_askpass:
        askpass = ssh_askpass
    elif sys.platform == 'darwin':
        askpass = resources.share('bin', 'ssh-askpass-darwin')
    else:
        askpass = resources.share('bin', 'ssh-askpass')

    compat.setenv('GIT_ASKPASS', askpass)
    compat.setenv('SSH_ASKPASS', askpass)

    # --- >8 --- >8 ---
    # Git v1.7.10 Release Notes
    # =========================
    #
    # Compatibility Notes
    # -------------------
    #
    #  * From this release on, the "git merge" command in an interactive
    #   session will start an editor when it automatically resolves the
    #   merge for the user to explain the resulting commit, just like the
    #   "git commit" command does when it wasn't given a commit message.
    #
    #   If you have a script that runs "git merge" and keeps its standard
    #   input and output attached to the user's terminal, and if you do not
    #   want the user to explain the resulting merge commits, you can
    #   export GIT_MERGE_AUTOEDIT environment variable set to "no", like
    #   this:
    #
    #        #!/bin/sh
    #        GIT_MERGE_AUTOEDIT=no
    #        export GIT_MERGE_AUTOEDIT
    #
    #   to disable this behavior (if you want your users to explain their
    #   merge commits, you do not have to do anything).  Alternatively, you
    #   can give the "--no-edit" option to individual invocations of the
    #   "git merge" command if you know everybody who uses your script has
    #   Git v1.7.8 or newer.
    # --- >8 --- >8 ---
    # Longer-term: Use `git merge --no-commit` so that we always
    # have a chance to explain our merges.
    compat.setenv('GIT_MERGE_AUTOEDIT', 'no')
Ejemplo n.º 6
0
 def __enter__(self):
     compat.setenv('GIT_SEQUENCE_EDITOR',
                   resources.share('bin', 'git-xbase'))
     for var, value in self.extras.items():
         compat.setenv(var, value)
     return self
Ejemplo n.º 7
0
 def __enter__(self):
     compat.setenv('GIT_SEQUENCE_EDITOR',
                   resources.share('bin', 'git-xbase'))
     for var, value in self.extras.items():
         compat.setenv(var, value)
     return self
Ejemplo n.º 8
0
import os

from cola import resources
from cola import core
from cola import git
from cola import inotify
from cola import version
from cola import signals

# Spoof an X11 display for SSH
os.environ.setdefault('DISPLAY', ':0')

# Provide an SSH_ASKPASS fallback
if sys.platform == 'darwin':
    os.environ.setdefault('SSH_ASKPASS',
                          resources.share('bin', 'ssh-askpass-darwin'))
else:
    os.environ.setdefault('SSH_ASKPASS',
                          resources.share('bin', 'ssh-askpass'))


def main():
    """Parses the command-line arguments and starts git-cola
    """
    parser = optparse.OptionParser(usage='%prog [options]')

    # We also accept 'git cola version'
    parser.add_option('-v', '--version',
                      help='Show cola version',
                      dest='version',
                      default=False,
Ejemplo n.º 9
0
 def __enter__(self):
     compat.setenv("GIT_SEQUENCE_EDITOR", unix_path(resources.share("bin", "git-xbase")))
     for var, value in self.env.items():
         compat.setenv(var, value)
     return self