def Main():
    """ The main point of entry for the checker service.

    This will set up the DBUS and glib extensions, the gobject/glib main loop,
    and start the service.
    """
    global log
    log = Log("rabbitvcs.services.checkerservice:main")
    log.debug("Checker: starting service: %s (%s)" % (OBJECT_PATH, os.getpid()))

    # We need this to for the client to be able to do asynchronous calls
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

    # The following calls are required to make DBus thread-aware and therefore
    # support the ability run threads.
    gobject.threads_init()
    dbus.glib.threads_init()

    # This registers our service name with the bus
    session_bus = dbus.SessionBus()
    service_name = dbus.service.BusName(SERVICE, session_bus)

    mainloop = gobject.MainLoop()

    checker_service = StatusCheckerService(session_bus, mainloop)

    gobject.idle_add(sys.stdout.write, "Started status checker service\n")
    gobject.idle_add(sys.stdout.flush)

    mainloop.run()

    log.debug("Checker: ended service: %s (%s)" % (OBJECT_PATH, os.getpid()))
Example #2
0
def Main():
    """ The main point of entry for the checker service.

    This will set up the DBUS and glib extensions, the gobject/glib main loop,
    and start the service.
    """
    global log
    log = Log("rabbitvcs.services.checkerservice:main")
    log.debug("Checker: starting service: %s (%s)" %
              (OBJECT_PATH, os.getpid()))

    # We need this to for the client to be able to do asynchronous calls
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

    # The following calls are required to make DBus thread-aware and therefore
    # support the ability run threads.
    gobject.threads_init()
    dbus.glib.threads_init()

    # This registers our service name with the bus
    session_bus = dbus.SessionBus()
    service_name = dbus.service.BusName(SERVICE, session_bus)

    mainloop = gobject.MainLoop()

    checker_service = StatusCheckerService(session_bus, mainloop)

    gobject.idle_add(sys.stdout.write, "Started status checker service\n")
    gobject.idle_add(sys.stdout.flush)

    mainloop.run()

    log.debug("Checker: ended service: %s (%s)" % (OBJECT_PATH, os.getpid()))
Example #3
0
def log_all_exceptions(type, value, tb):
    import sys, traceback
    from rabbitvcs.util.log import Log
    log = Log("rabbitvcs.util.extensions.Nemo.RabbitVCS")
    log.exception_info("Error caught by master exception hook!",
                       (type, value, tb))

    text = ''.join(traceback.format_exception(type, value, tb, limit=None))

    try:
        import rabbitvcs.ui.dialog
        rabbitvcs.ui.dialog.ErrorNotification(text)
    except Exception, ex:
        log.exception("Additional exception when attempting"
                      " to display error dialog.")
        log.exception(ex)
        raise
Example #4
0
def log_all_exceptions(type, value, tb):
    import sys, traceback
    from rabbitvcs.util.log import Log

    log = Log("rabbitvcs.util.extensions.Nemo.RabbitVCS")
    log.exception_info("Error caught by master exception hook!", (type, value, tb))

    text = "".join(traceback.format_exception(type, value, tb, limit=None))

    try:
        import rabbitvcs.ui.dialog

        rabbitvcs.ui.dialog.ErrorNotification(text)
    except Exception, ex:
        log.exception("Additional exception when attempting" " to display error dialog.")
        log.exception(ex)
        raise
Example #5
0
sa = helper.SanitizeArgv()
from gi.repository import Gtk, GObject, Gdk
sa.restore()

from rabbitvcs.ui import InterfaceView
from rabbitvcs.util.contextmenu import GtkFilesContextMenu, \
    GtkContextMenuCaller, GtkFilesContextMenuConditions, GtkContextMenu
from rabbitvcs.util.contextmenuitems import MenuItem, MenuUpdate, \
    MenuSeparator
import rabbitvcs.ui.widget
import rabbitvcs.ui.dialog
import rabbitvcs.ui.action
from rabbitvcs.util.log import Log
from rabbitvcs.util.decorators import gtk_unsafe

log = Log("rabbitvcs.ui.checkmods")

from rabbitvcs import gettext
_ = gettext.gettext

helper.gobject_threads_init()


class SVNCheckForModifications(InterfaceView):
    """
    Provides a way for the user to see what files have been changed on the
    repository.

    """
    def __init__(self, paths, base_dir=None):
        InterfaceView.__init__(self, "checkmods", "CheckMods")
Example #6
0
import os.path

import os
if "REQUIRE_GTK3" in os.environ and os.environ["REQUIRE_GTK3"]:
    from gi.repository import Gtk as gtk
else:
    import gtk

import rabbitvcs.util.helper

from rabbitvcs import gettext
_ = gettext.gettext

from rabbitvcs.util.log import Log
log = Log("rabbitvcs.ui.contextmenuitems")
_ = gettext.gettext

SEPARATOR = u'\u2015' * 10


class MenuItem(object):
    """
    This is the base class for a definition of a menu item. Consider this
    "abstract" (in the language of Java) - it makes no sense to instantiate it
    directly. If you want to define a new kind of menu item, you need to
    subclass it like so:
    
    class MenuPerformMagic:
        identifier = "RabbitVCS::Perform_Magic"
        label = _("Perform Magic")
Example #7
0
import pygtk
import gobject
import gtk

from rabbitvcs.ui import InterfaceView
from rabbitvcs.ui.add import Add
from rabbitvcs.ui.action import SVNAction
import rabbitvcs.ui.widget
import rabbitvcs.ui.dialog
import rabbitvcs.ui.action
import rabbitvcs.util.helper
from rabbitvcs.util.log import Log

import rabbitvcs.vcs

log = Log("rabbitvcs.ui.stage")

from rabbitvcs import gettext
_ = gettext.gettext

class GitStage(Add):
    def __init__(self, paths, base_dir=None):
        InterfaceView.__init__(self, "add", "Add")

        self.window = self.get_widget("Add")
        self.window.set_title(_("Stage"))

        self.paths = paths
        self.base_dir = base_dir
        self.last_row_clicked = None
        self.vcs = rabbitvcs.vcs.VCS()
Example #8
0
import six.moves._thread

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GObject, Gdk
from rabbitvcs.ui import InterfaceView
from rabbitvcs.ui.add import Add
from rabbitvcs.ui.action import SVNAction
import rabbitvcs.ui.widget
import rabbitvcs.ui.dialog
import rabbitvcs.ui.action
import rabbitvcs.util.helper
from rabbitvcs.util.log import Log

log = Log("rabbitvcs.ui.markresolved")

from rabbitvcs import gettext
_ = gettext.gettext


class SVNMarkResolved(Add):
    def setup(self, window, columns):
        window.set_title(_("Mark as Resolved"))
        self.svn = self.vcs.svn()
        self.statuses = self.svn.STATUSES_FOR_RESOLVE
        columns[0] = [
            GObject.TYPE_BOOLEAN, rabbitvcs.ui.widget.TYPE_PATH,
            GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING
        ],
        columns[1] = [
Example #9
0
sa = helper.SanitizeArgv()
from gi.repository import Gtk, GObject, Gdk
sa.restore()

from rabbitvcs.ui import InterfaceView
from rabbitvcs.util.contextmenu import GtkFilesContextMenu, GtkContextMenuCaller
import rabbitvcs.ui.widget
import rabbitvcs.ui.dialog
import rabbitvcs.ui.action
from rabbitvcs.util import helper
from rabbitvcs.util.strings import S
import rabbitvcs.vcs
from rabbitvcs.util.log import Log
from rabbitvcs.vcs.status import Status

log = Log("rabbitvcs.ui.noskiptree")

from rabbitvcs import gettext
_ = gettext.gettext

helper.gobject_threads_init()

class Noskiptree(InterfaceView, GtkContextMenuCaller):
    """
    Provides an interface for the user to add unversioned files to a
    repository.  Also, provides a context menu with some extra functionality.

    Send a list of paths to be added

    """
Example #10
0
HAS_GTKSOURCEVIEW = False
if not GTK3:
    try:
        import gtksourceview
        HAS_GTKSOURCEVIEW = True
    except ImportError:
        pass

import rabbitvcs.util.helper

from rabbitvcs import gettext
_ = gettext.gettext

from rabbitvcs.util.log import Log
log = Log("rabbitvcs.ui.widget")

from rabbitvcs.ui import STATUS_EMBLEMS

TOGGLE_BUTTON = 'TOGGLE_BUTTON'
TYPE_PATH = 'TYPE_PATH'
TYPE_STATUS = 'TYPE_STATUS'
TYPE_ELLIPSIZED = 'TYPE_ELLIPSIZED'
TYPE_GRAPH = 'TYPE_GRAPH'
TYPE_MARKUP = 'TYPE_MARKUP'
TYPE_HIDDEN = 'TYPE_HIDDEN'

ELLIPSIZE_COLUMN_CHARS = 20

PATH_ENTRY = 'PATH_ENTRY'
SEPARATOR = u'\u2015' * 10
Example #11
0
# along with RabbitVCS;  If not, see <http://www.gnu.org/licenses/>.
#
"""
Very simple status checking class. Useful when you can't get any of the others
to work, or you need to prototype things.
"""
from __future__ import absolute_import

import rabbitvcs.vcs
import rabbitvcs.vcs.status

from rabbitvcs import gettext
_ = gettext.gettext

from rabbitvcs.util.log import Log
log = Log("rabbitvcs.services.statuschecker")


class StatusChecker(object):
    """ A class for performing status checks. """

    # All subclasses should override this! This is to be displayed in the
    # settings dialog
    CHECKER_NAME = _("Simple status checker")

    def __init__(self):
        """ Initialises status checker. Obviously. """
        self.vcs_client = rabbitvcs.vcs.create_vcs_instance()
        self.conditions_dict_cache = {}

    def check_status(self, path, recurse, summary, invalidate):
Example #12
0
import dbus
import dbus.glib  # FIXME: this might actually already set the default loop
import dbus.mainloop.glib
import dbus.service

import rabbitvcs.util.decorators
import rabbitvcs.util._locale
import rabbitvcs.util.helper
import rabbitvcs.services.service
from rabbitvcs.services.statuschecker import StatusChecker

import rabbitvcs.vcs.status

from rabbitvcs.util.log import Log

log = Log("rabbitvcs.services.checkerservice")

from rabbitvcs import version as SERVICE_VERSION

INTERFACE = "org.google.code.rabbitvcs.StatusChecker"
OBJECT_PATH = "/org/google/code/rabbitvcs/StatusChecker"
SERVICE = "org.google.code.rabbitvcs.RabbitVCS.Checker"
TIMEOUT = 60 * 15 * 100  # seconds


def find_class(module, name):
    """ Given a module name and a class name, return the actual type object.
    """
    # From Python stdlib pickle module source
    __import__(module)
    mod = sys.modules[module]
from rabbitvcs.ui.action import SVNAction, GitAction
from rabbitvcs.ui.widget import Clickable, Table, TYPE_MARKUP, TYPE_HIDDEN
from rabbitvcs.ui.dialog import MessageBox, Loading
from rabbitvcs.util.contextmenu import GtkContextMenu
from rabbitvcs.util.contextmenuitems import *
from rabbitvcs.util.strings import S
from rabbitvcs.util.decorators import gtk_unsafe
from rabbitvcs.util.highlighter import highlight
from rabbitvcs.util.settings import SettingsManager
import rabbitvcs.vcs

from rabbitvcs import gettext
_ = gettext.gettext

from rabbitvcs.util.log import Log
logger = Log("rabbitvcs.ui.annotate")

LUMINANCE = 0.90


class Annotate(InterfaceView):
    """
    Provides a UI interface to annotate items in the repository or
    working copy.

    Pass a single path to the class when initializing

    """
    def __init__(self, path, revision=None):
        if os.path.isdir(path):
            MessageBox(_("Cannot annotate a directory"))
Example #14
0
import os.path
from datetime import datetime

from mercurial import commands, ui, hg

import rabbitvcs.util.helper

import rabbitvcs.vcs
import rabbitvcs.vcs.status
import rabbitvcs.vcs.log
import rabbitvcs.vcs.mercurial.util
from rabbitvcs.vcs.branch import BranchEntry
from rabbitvcs.util.log import Log
import six

log = Log("rabbitvcs.vcs.mercurial")

from rabbitvcs import gettext
_ = gettext.gettext


class Revision:
    """
    Implements a simple revision object as a wrapper around the gittyup revision
    object.  This allows us to provide a standard interface to the object data.
    """
    def __init__(self, kind, value=None):
        self.kind = kind.upper()
        self.value = value

        if self.kind == "HEAD":
Example #15
0
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GObject, Gdk

from rabbitvcs.ui import InterfaceView
from rabbitvcs.util.contextmenu import GtkContextMenu, GtkContextMenuCaller
import rabbitvcs.ui.wraplabel
import rabbitvcs.util.contextmenuitems
import rabbitvcs.ui.widget
import rabbitvcs.ui.dialog
import rabbitvcs.vcs
from rabbitvcs.util.helper import format_long_text
from rabbitvcs.vcs.svn import Revision
from rabbitvcs.util.log import Log

log = Log("rabbitvcs.ui.property_editor")

from rabbitvcs import gettext
_ = gettext.gettext

PROP_EDITOR_NOTE = _("""\
<b>Note:</b> changes to properties are applied instantly. You may review and \
undo changes using the context menu for each item.
""")

RECURSIVE_DELETE_MSG = _("""\
Do you want to delete the selected properties from all files and subdirectories
beneath this directory?""")

PROP_MENU_STRUCTURE = [
    (rabbitvcs.util.contextmenuitems.PropMenuEdit, None),
Example #16
0
import os.path
from datetime import datetime

from .gittyup.client import GittyupClient
from .gittyup import objects

from rabbitvcs.util import helper
from rabbitvcs.util.strings import S

import rabbitvcs.vcs
import rabbitvcs.vcs.status
import rabbitvcs.vcs.log
from rabbitvcs.vcs.branch import BranchEntry
from rabbitvcs.util.log import Log

log = Log("rabbitvcs.vcs.git")

from rabbitvcs import gettext
_ = gettext.gettext


class Revision(object):
    """
    Implements a simple revision object as a wrapper around the gittyup revision
    object.  This allows us to provide a standard interface to the object data.
    """
    def __init__(self, kind, value=None):
        self.kind = kind.upper()
        self.value = value

        if self.kind == "HEAD":
import dbus
import dbus.glib # FIXME: this might actually already set the default loop
import dbus.mainloop.glib
import dbus.service

import rabbitvcs.util.decorators
import rabbitvcs.util._locale
import rabbitvcs.util.helper
import rabbitvcs.services.service
from rabbitvcs.services.statuschecker import StatusChecker

import rabbitvcs.vcs.status

from rabbitvcs.util.log import Log
log = Log("rabbitvcs.services.checkerservice")

from rabbitvcs import version as SERVICE_VERSION

INTERFACE = "org.google.code.rabbitvcs.StatusChecker"
OBJECT_PATH = "/org/google/code/rabbitvcs/StatusChecker"
SERVICE = "org.google.code.rabbitvcs.RabbitVCS.Checker"
TIMEOUT = 60*15*100 # seconds

def find_class(module, name):
    """ Given a module name and a class name, return the actual type object.
    """
    # From Python stdlib pickle module source
    __import__(module)
    mod = sys.modules[module]
    klass = getattr(mod, name)
Example #18
0
Decorators should be named as verbs (present or paste tense).

See: 

  - https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker/linkcheck/decorators.py
  - http://wiki.python.org/moin/PythonDecoratorLibrary
  
"""
from __future__ import absolute_import

import time
import warnings
import threading

from rabbitvcs.util.log import Log
log = Log("rabbitvcs.util.decorators")

def update_func_meta(fake_func, real_func):
    """
    Set meta information (eg. __doc__) of fake function to that of the real 
    function.
    
    @rtype: function
    @return Fake function with metadata of the real function.
    """
    
    fake_func.__module__ = real_func.__module__
    fake_func.__name__ = real_func.__name__
    fake_func.__doc__ = real_func.__doc__
    fake_func.__dict__.update(real_func.__dict__)
    
Example #19
0
import rabbitvcs.vcs.status

from rabbitvcs.util.helper import launch_ui_window, launch_diff_tool
from rabbitvcs.util.helper import get_file_extension, get_common_directory
from rabbitvcs.util.helper import pretty_timedelta

from rabbitvcs.util.decorators import timeit, disable

from rabbitvcs.util.contextmenu import MenuBuilder, MainContextMenu, SEPARATOR, ContextMenuConditions

import rabbitvcs.ui
import rabbitvcs.ui.property_page

from rabbitvcs.util.log import Log, reload_log_settings

log = Log("rabbitvcs.util.extensions.Caja.RabbitVCS")

from rabbitvcs import gettext, get_icon_path

_ = gettext.gettext

from rabbitvcs import version as EXT_VERSION

from rabbitvcs.util.settings import SettingsManager

settings = SettingsManager()

import rabbitvcs.services.service
from rabbitvcs.services.checkerservice import StatusCheckerStub as StatusChecker

Example #20
0
# You should have received a copy of the GNU General Public License
# along with RabbitVCS;  If not, see <http://www.gnu.org/licenses/>.
#

import os.path

import pygtk
from gi.repository import GObject as gobject
import gtk

from rabbitvcs.ui import InterfaceNonView
from rabbitvcs.ui.action import SVNAction
import rabbitvcs.vcs
from rabbitvcs.util.log import Log

log = Log("rabbitvcs.ui.delete")

from rabbitvcs import gettext
_ = gettext.gettext

class Delete(InterfaceNonView):
    """
    This class provides a handler to Delete functionality.
    
    """

    def __init__(self, paths):
        InterfaceNonView.__init__(self)
        self.paths = paths
        self.vcs = rabbitvcs.vcs.VCS()
Example #21
0
from rabbitvcs.vcs import VCS
import rabbitvcs.vcs.status

from rabbitvcs.util.helper import launch_ui_window, launch_diff_tool
from rabbitvcs.util.helper import get_file_extension, get_common_directory
from rabbitvcs.util.helper import pretty_timedelta

from rabbitvcs.util.decorators import timeit, disable

from rabbitvcs.util.contextmenu import MenuBuilder, MainContextMenu, SEPARATOR, ContextMenuConditions

import rabbitvcs.ui
import rabbitvcs.ui.property_page

from rabbitvcs.util.log import Log, reload_log_settings
log = Log("rabbitvcs.util.extensions.Nemo.RabbitVCS")

from rabbitvcs import gettext, get_icon_path
_ = gettext.gettext

from rabbitvcs import version as EXT_VERSION

from rabbitvcs.util.settings import SettingsManager
settings = SettingsManager()

import rabbitvcs.services.service
from rabbitvcs.services.checkerservice import StatusCheckerStub as StatusChecker


class RabbitVCS(Nemo.InfoProvider, Nemo.MenuProvider, Nemo.ColumnProvider,
                Nemo.PropertyPageProvider, Nemo.NameAndDescProvider,
Example #22
0
from rabbitvcs.vcs import VCS
import rabbitvcs.vcs.status

from rabbitvcs.util.helper import launch_ui_window, launch_diff_tool
from rabbitvcs.util.helper import get_file_extension, get_common_directory
from rabbitvcs.util.helper import pretty_timedelta

from rabbitvcs.util.decorators import timeit, disable

from rabbitvcs.util.contextmenu import MenuBuilder, MainContextMenu, SEPARATOR, ContextMenuConditions

import rabbitvcs.ui
import rabbitvcs.ui.property_page

from rabbitvcs.util.log import Log, reload_log_settings
log = Log("rabbitvcs.util.extensions.Nautilus.RabbitVCS")

from rabbitvcs import gettext, get_icon_path
_ = gettext.gettext

from rabbitvcs import version as EXT_VERSION

from rabbitvcs.util.settings import SettingsManager
settings = SettingsManager()

import rabbitvcs.services.service
from rabbitvcs.services.checkerservice import StatusCheckerStub as StatusChecker


class RabbitVCS(Nautilus.InfoProvider, Nautilus.MenuProvider,
                Nautilus.ColumnProvider, Nautilus.PropertyPageProvider,
Example #23
0
sa = helper.SanitizeArgv()
from gi.repository import Gtk, GObject, Gdk
sa.restore()

from rabbitvcs.ui import InterfaceView
from rabbitvcs.util.contextmenu import GtkFilesContextMenu, GtkContextMenuCaller
import rabbitvcs.ui.widget
import rabbitvcs.ui.dialog
import rabbitvcs.ui.action
from rabbitvcs.util import helper
from rabbitvcs.util.strings import S
import rabbitvcs.vcs
from rabbitvcs.util.log import Log
from rabbitvcs.vcs.status import Status

log = Log("rabbitvcs.ui.add")

from rabbitvcs import gettext
_ = gettext.gettext

helper.gobject_threads_init()


class Add(InterfaceView, GtkContextMenuCaller):
    """
    Provides an interface for the user to add unversioned files to a
    repository.  Also, provides a context menu with some extra functionality.

    Send a list of paths to be added

    """
Example #24
0
# You should have received a copy of the GNU General Public License
# along with RabbitVCS;  If not, see <http://www.gnu.org/licenses/>.
#

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GObject, Gdk

from rabbitvcs.ui.properties import PropertiesBase
import rabbitvcs.ui.widget
import rabbitvcs.ui.dialog
import rabbitvcs.vcs
from rabbitvcs.util.log import Log
from rabbitvcs.ui.action import SVNAction

log = Log("rabbitvcs.ui.revprops")

from rabbitvcs import gettext
_ = gettext.gettext

class SVNRevisionProperties(PropertiesBase):
    def __init__(self, path, revision=None):
        PropertiesBase.__init__(self, path)

        self.svn = self.vcs.svn()

        if not self.svn.is_path_repository_url(path):
            self.path = self.svn.get_repo_url(path)
            self.get_widget("path").set_text(self.path)

        self.revision = revision
Example #25
0
import gobject
import gtk
from time import sleep

from rabbitvcs.ui import InterfaceView
from rabbitvcs.util.contextmenu import GtkFilesContextMenu, GtkContextMenuCaller
import rabbitvcs.ui.action
import rabbitvcs.ui.widget
import rabbitvcs.ui.dialog
import rabbitvcs.util
import rabbitvcs.util.helper
from rabbitvcs.util.log import Log
from rabbitvcs.util.decorators import gtk_unsafe
import rabbitvcs.vcs.status

log = Log("rabbitvcs.ui.commit")

from rabbitvcs import gettext
_ = gettext.gettext

gobject.threads_init()


class Commit(InterfaceView, GtkContextMenuCaller):
    """
    Provides a user interface for the user to commit working copy
    changes to a repository.  Pass it a list of local paths to commit.
    
    """
    SETTINGS = rabbitvcs.util.settings.SettingsManager()
Example #26
0
import time
import pygtk
from gi.repository import GObject as gobject
import gtk
import os
from shutil import rmtree
import tempfile

from rabbitvcs import TEMP_DIR_PREFIX
from rabbitvcs.ui import InterfaceNonView
import rabbitvcs.vcs
from rabbitvcs.ui.action import SVNAction, GitAction
import rabbitvcs.util.helper
from rabbitvcs.util.log import Log

log = Log("rabbitvcs.ui.diff")

from rabbitvcs import gettext
_ = gettext.gettext

gobject.threads_init()

class Diff(InterfaceNonView):
    def __init__(self, path1, revision1=None, path2=None, revision2=None, 
            sidebyside=False):
        InterfaceNonView.__init__(self)
        
        self.vcs = rabbitvcs.vcs.VCS()

        self.path1 = path1
        self.path2 = path2
Example #27
0
import os

os.environ["REQUIRE_GTK3"] = "1"

import rabbitvcs.ui
import rabbitvcs.ui.property_page
from rabbitvcs.util.helper import launch_ui_window, launch_diff_tool
from rabbitvcs.util.helper import get_file_extension, get_common_directory
from rabbitvcs.util.helper import pretty_timedelta
from rabbitvcs.util.helper import to_text, unquote
from rabbitvcs.util.decorators import timeit, disable
from rabbitvcs.util.contextmenu import MenuBuilder, MainContextMenu, SEPARATOR

from rabbitvcs.util.log import Log, reload_log_settings

log = Log("rabbitvcs.util.extensions.thunarx.RabbitVCS")

from rabbitvcs import gettext

_ = gettext.gettext

from rabbitvcs.util.settings import SettingsManager

settings = SettingsManager()

import rabbitvcs.services.service
from rabbitvcs.services.checkerservice import StatusCheckerStub as StatusChecker


class RabbitVCS(GObject.GObject, Thunarx.MenuProvider,
                Thunarx.PropertyPageProvider):
Example #28
0
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with RabbitVCS;  If not, see <http://www.gnu.org/licenses/>.
#

import os.path
import unittest

from datetime import datetime

import rabbitvcs.vcs

from rabbitvcs.util.log import Log

log = Log("rabbitvcs.vcs.status")

from rabbitvcs import gettext
_ = gettext.gettext

# These are the statuses that we might represent with icons
status_normal = 'normal'
status_modified = 'modified'
status_added = 'added'
status_deleted = 'deleted'
status_ignored = 'ignored'
status_read_only = 'read-only'
status_locked = 'locked'
status_unknown = 'unknown'
# Specifically: this means something IN A WORKING COPY but not added
status_unversioned = 'unversioned'
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# RabbitVCS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with RabbitVCS;  If not, see <http://www.gnu.org/licenses/>.
#

from rabbitvcs.util.log import Log

logger = Log("rabbitvcs.util.__init__")


class Function(object):
    """
    Provides an interface to define and call a function.

    Usage:
        f = Function(self.do_this, path)
        f.run()

    """
    def __init__(self, func, *args, **kwargs):
        self.func = func
        self.args = args
        self.kwargs = kwargs
Example #30
0
import six.moves._thread
import shutil

import pygtk
from gi.repository import GObject as gobject
import gtk

from rabbitvcs.ui import InterfaceNonView
from rabbitvcs.ui.action import SVNAction, GitAction
import rabbitvcs.ui.widget
import rabbitvcs.ui.dialog
import rabbitvcs.ui.action
import rabbitvcs.util.helper
from rabbitvcs.util.log import Log

log = Log("rabbitvcs.ui.editconflicts")

from rabbitvcs import gettext
_ = gettext.gettext

class SVNEditConflicts(InterfaceNonView):
    def __init__(self, path):
        InterfaceNonView.__init__(self)

        log.debug("incoming path: %s"%path)
        self.path = path
        self.vcs = rabbitvcs.vcs.VCS()
        self.svn = self.vcs.svn()
        
        status = self.svn.status(self.path)
        if status.simple_content_status() != rabbitvcs.vcs.status.status_complicated:
Example #31
0
# You should have received a copy of the GNU General Public License
# along with RabbitVCS;  If not, see <http://www.gnu.org/licenses/>.
#

import os.path

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GObject, Gdk

from rabbitvcs.ui import InterfaceNonView
from rabbitvcs.ui.action import SVNAction
import rabbitvcs.vcs
from rabbitvcs.util.log import Log

log = Log("rabbitvcs.ui.applypatch")

from rabbitvcs import gettext
_ = gettext.gettext


class ApplyPatch(InterfaceNonView):
    """
    This class provides a handler to the apply patch functionality.

    """
    def __init__(self, paths):
        InterfaceNonView.__init__(self)
        self.paths = paths
        self.vcs = rabbitvcs.vcs.VCS()
        self.common = rabbitvcs.util.helper.get_common_directory(paths)
Example #32
0
# 
# RabbitVCS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with RabbitVCS;  If not, see <http://www.gnu.org/licenses/>.
#

import os.path
from rabbitvcs import gettext
_ = gettext.gettext

from rabbitvcs.util.log import Log
logger = Log("rabbitvcs.vcs")

from rabbitvcs.util.helper import get_exclude_paths

EXT_UTIL_ERROR = _("The output from '%s' was not able to be processed.\n%s")

VCS_SVN = 'svn'
VCS_GIT = 'git'
VCS_MERCURIAL = 'mercurial'
VCS_DUMMY = 'unknown'

def guess(path):
    # Determine the VCS instance based on the path
    if path:
        path_to_check = path
        folders = {
Example #33
0
import urllib
from urlparse import urlparse
from urlparse import urlunparse
from six.moves import filter
from six.moves import range

try:
    from gi.repository import GObject as gobject
except ImportError:
    import gobject

import rabbitvcs.util.settings

from rabbitvcs.util.log import Log
log = Log("rabbitvcs.util.helper")

from rabbitvcs import gettext
ngettext = gettext.ngettext

DATETIME_FORMAT = "%Y-%m-%d %H:%M"  # for log files
LOCAL_DATETIME_FORMAT = locale.nl_langinfo(locale.D_T_FMT)  # for UIs

DT_FORMAT_THISWEEK = "%a %I:%M%p"
DT_FORMAT_THISYEAR = "%b %d %Y"
DT_FORMAT_ALL = "%b %d %Y"

LINE_BREAK_CHAR = u'\u23CE'

from rabbitvcs import gettext
_ = gettext.gettext
Example #34
0
#
# RabbitVCS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with RabbitVCS;  If not, see <http://www.gnu.org/licenses/>.
#

import rabbitvcs.ui.action
from rabbitvcs.util.log import Log

import rabbitvcs.vcs

log = Log("rabbitvcs.ui.blame")

from rabbitvcs import gettext
_ = gettext.gettext

class GitBlame(object):
    def __init__(self, path, line):
        self.vcs = rabbitvcs.vcs.VCS()
        self.git = self.vcs.git(path)
        self.action = rabbitvcs.ui.action.GitAction(
            self.git,
            run_in_thread=False
        )
        self.action.append(self.git.blame, [path], line)
        self.action.schedule()