Is it possible to simultaneously use TortoiseHG (for Mercurial) and RabbitVCS (for Git) in Caja with Cyrillic file-names?

by N0rbert   Last Updated August 13, 2019 21:02 PM

I run Ubuntu MATE 16.04.6 LTS with Caja file-manager.

I have added TortoiseHG python extension for Caja file-manager by following my method. It works great with Mercurial repositories.

Currently I need to have similar file and directory emblems for Git repositories. I installed RabbitVCS for this purpose by following my method.

But I see that there is a problem with RabbitVCS on displaying emblems for Cyrillic objects inside Mercurial repositories. For such objects RabbitVCS shows extra error emblem

/usr/share/icons/hicolor/scalable/emblems/emblem-rabbitvcs-error.svg

on all Mercurial items as follows:

Caja with Git and Mercurial repositories - errors on Cyrillic names

I do not want to rename all 25 Mercurial repositories to ascii latin names. So I need to disable Mercurial in RabbitVCS and use TortoiseHG for such .hg repositories. As I know that TortoiseHG allows cyrillic file-names.

How can do this?



Answers 1


We need to apply patch for two RabbitVCS files:

  • /usr/lib/python2.7/dist-packages/rabbitvcs/util/contextmenu.py
  • /usr/lib/python2.7/dist-packages/rabbitvcs/vcs/__init__.py

To do this programmatically we need to write patch files and apply them:

sudo rm /usr/lib/python2.7/dist-packages/rabbitvcs/util/contextmenu.pyc
sudo rm /usr/lib/python2.7/dist-packages/rabbitvcs/vcs/__init__.pyc

cd ~/Downloads

cat > __init___py.patch << \EOF
--- /usr/lib/python2.7/dist-packages/rabbitvcs/vcs/__init__.py
+++ /tmp/__init__.py
@@ -43,7 +43,6 @@
         folders = {
             ".svn": VCS_SVN,
             ".git": VCS_GIT,
-            ".hg": VCS_MERCURIAL,
             ".bzr": VCS_DUMMY,
             ".CVS": VCS_DUMMY
         }
EOF

cat > contextmenu_py.patch << \EOF
--- /usr/lib/python2.7/dist-packages/rabbitvcs/util/contextmenu.py
+++ /tmp/contextmenu.py
@@ -35,7 +35,7 @@
 else:
     import gtk

-from rabbitvcs.vcs import create_vcs_instance, VCS_SVN, VCS_GIT, VCS_DUMMY, VCS_MERCURIAL
+from rabbitvcs.vcs import create_vcs_instance, VCS_SVN, VCS_GIT, VCS_DUMMY
 from rabbitvcs.util.log import Log
 from rabbitvcs import gettext
 from rabbitvcs.util.settings import SettingsManager
@@ -614,7 +614,6 @@
         checks = {
             "is_svn"                        : lambda path: (self.vcs_client.guess(path)["vcs"] == VCS_SVN),
             "is_git"                        : lambda path: (self.vcs_client.guess(path)["vcs"] == VCS_GIT),
-            "is_mercurial"                  : lambda path: (self.vcs_client.guess(path)["vcs"] == VCS_MERCURIAL),
             "is_dir"                        : os.path.isdir,
             "is_file"                       : os.path.isfile,
             "exists"                        : os.path.exists,
@@ -1365,10 +1364,6 @@
                 (MenuSeparator, None),
                 (MenuSettings, None),
                 (MenuAbout, None)
-            ]),
-            (MenuRabbitVCSMercurial, [
-                (MenuSettings, None),
-                (MenuAbout, None)
             ])
         ]

EOF

sudo patch /usr/lib/python2.7/dist-packages/rabbitvcs/vcs/__init__.py < __init___py.patch
sudo patch /usr/lib/python2.7/dist-packages/rabbitvcs/util/contextmenu.py < contextmenu_py.patch

To prevent package upgrading we need to pin its version:

cat <<EOF | sudo tee /etc/apt/preferences.d/pin-rcs
Package: rabbitvcs-core
Pin: version 0.16-1
Pin-Priority: 1337
EOF

After applying the patch the error emblems will be removed:

Caja after patch

and we can use both tools for repositories -

  • RabbitVCS menus for Git (and really for SVN with Bazaar);
  • TortoiseHG for Mercurial (even with Cyrillic names).

To revert the patch we need to reinstall the package and remove pin-file with:

sudo apt-get install --reinstall rabbitvcs-core
sudo rm /etc/apt/preferences.d/pin-rcs

Note: this method was also tested on Ubuntu MATE 18.04 LTS - it works here too.

N0rbert
N0rbert
August 13, 2019 20:36 PM

Related Questions





Caja only shows images and icons preview when root

Updated October 12, 2015 07:01 AM

Save folder configurations for each folder?

Updated October 20, 2015 11:01 AM