• Ye使用HG相关笔记


    Ye使用HG相关笔记

    TortoiseHg

    扩展相关

    碰到的错误列表

    AttributeError: 'NoneType' object has no attribute 'configbool'

    错误详情

    Traceback (most recent call last):
      File "thg", line 99, in <module>
      File "tortoisehghgqt
    un.pyo", line 88, in run
      File "tortoisehghgqt
    un.pyo", line 146, in dispatch
    AttributeError: 'NoneType' object has no attribute 'configbool'	
    

    解决方案

    1. 使用命令执行hg debuginstall -T'{pythonexe}'

      config error at C:UsersAsionTangmercurial.ini:7: mercurial_keyring

    2. 原来是mercurial_keyring 少了一个=

      修改前

      [extensions]
      mercurial_keyring
      

      修复后

      [extensions]
      mercurial_keyring = 
      
    3. 再执行命令hg debuginstall -T'{pythonexe}' 就一切正常了.

    mercurial_keyring

    缘由

    最新版本tortoisehg-5.8.1-x64集成打包的对应版本太老了.可能不兼容HG-GIT

    主页

    mercurial / mercurial_keyring · GitLab

    使用源码最新版本配置步骤

    1. 从主页下载最新源码包

    2. 解压到以下目录D:Program FilesTortoiseHg.Extmercurial_keyring

    3. 然后打开TortoiseHg的全局设置增加以下配置

      [extensions]
      mercurial_keyring = D:Program FilesTortoiseHg.Extmercurial_keyringmercurial_keyring.py
      
    4. 直接运行会提示报错:

      *** 加载扩展 'mercurial_keyring',自 'D:Program FilesTortoiseHg.Extmercurial_keyringmercurial_keyring.py': Can not import mercurial_extension_utils.
      
    5. 再去 mercurial / mercurial-extension_utils · GitLab 下载Zip包

    6. 将包里的2个文件解压到``

      • "D:Program FilesTortoiseHg.Extmercurial_keyringmercurial_extension_utils_loader.py"
      • "D:Program FilesTortoiseHg.Extmercurial_keyringmercurial_extension_utils.py"
    7. 理论上有以下2个文件就OK了

      "D:Program FilesTortoiseHg.Extmercurial_keyringmercurial_keyring.py"
      "D:Program FilesTortoiseHg.Extmercurial_keyringmercurial_extension_utils.py"

    hg-git

    缘由

    主页

    • mercurial / hg-git · GitLab

      Further reading
      See hg help -e hggit.

    • README.rst · branch/0.10.x · mercurial / hg-git · GitLab

      最后支持2.7的Python的版本

    • 版本合并时,删除了大量的说明, 并从原本支持2.7的修改为最低支持3.6了.

      • merge with branch 0.10.x (5fe8f4d01d36) · Commits · mercurial / hg-git · GitLab

        hg-git 0.10.2 (2021-07-31) 还支持2.7版本

        hg-git 0.11.0 (unreleased) 则不支持2.7了.

        hg debuginstall -T'{pythonexe}'
        
           This is the reason for setting ``PYTHON`` above.  
           This will work, for example, if you are using a version of mercurial installed by the system, which might depends on   Python 2.7.  
           Keep in mind that python 2 reached its end of life in April 2020
           and will not be supported with versions of ``hg-git`` 0.11 and higher 
           (see `issue #349 <https://foss.heptapod.net/mercurial/hg-git/-/issues/349>`_.
        
      • 放弃 Python 2 支持 (#349) · 问题 · mercurial / hg-git · GitLab

        Python 2.7 已经过时一年多了。

        引用 hg-git 0.10.0 的公告:

        0.10.x 系列将是最后一个支持 Python 2.7 和 Python 3.5 的系列。

        未来的功能版本将仅支持 Python 3.6 及更高版本和 Mercurial 5.2 或更高版本。

        我们现在有一个单独的 0.10.x 系列分支,所以我们可以继续。

    使用源码最新版本配置步骤

    1. 从主页下载0.10.x源码包 Files · branch/0.10.x · mercurial / hg-git · GitLab

    2. 解压到以下目录[D:Program FilesTortoiseHg.Exthg-git](D:Program FilesTortoiseHg.Exthg-git)

    3. 然后打开TortoiseHg的全局设置增加以下配置

      [extensions]
      hggit = D:Program FilesTortoiseHg.Exthg-githggit
      
    4. 在绑定有Git远程仓库地址的仓库执行下拉报错

      *** 加载扩展 'hggit' 失败: No module named hggit

      经过多次设置后总结的经验就是保存后, hggit后面的自定义路径就消失了. 可能是新版本的BUG导致的.

    5. 然后修改TortoiseHg的全局设置以下配置

      [extensions]
      hggit2 = D:Program FilesTortoiseHg.Exthg-githggit
      
    6. 然后执行后又报错:当** Unknown exception encountered with possibly-broken third-party extension "mercurial_keyring" (version N/A)

      需要将设置里的配置注释掉后, 再运行

      [extensions]

      mercurial_keyring = ...

    7. 设置里的配置注释掉后,然后执行后又报错:

      *** 加载扩展 'hggit2',自 'D:Program FilesTortoiseHg.Exthg-githggit': future feature generator_stop is not defined (init.py, line 140)

    8. 返回第1步下载0.10.x低版本即可

    9. 重新运行后报错

      *** 加载扩展 'hggit2',自 'D:Program FilesTortoiseHg.Exthg-githggit': No module named dulwich

    10. 查找对应的依赖版本: setup.py · branch/0.10.x · mercurial / hg-git · GitLab

          install_requires=[
              'dulwich>=0.19.0;python_version>="3.0"',
              'dulwich>=0.19.0,<0.20.0;python_version<"3.0"',
          ],
      
    11. 下载对应版本的 Dulwich

    > Versions of Dulwich prior to 0.20 also supported Python 2.7. Supported platforms include Linux, Mac OS X and Windows.
    >
    > - Git repository: https://www.dulwich.io/code/dulwich ([github](https://github.com/dulwich/dulwich))
    >
    > - [Release 0.19.7 · dulwich/dulwich](https://github.com/dulwich/dulwich/releases/tag/dulwich-0.19.7) 
    >
    >   > 发布了这个 2018 年 11 月 6 日 · 自本次发布以来,[ 591 次提交](https://github.com/dulwich/dulwich/compare/dulwich-0.19.7...master)给 master
    
    1. 将压缩包里的文件夹dulwich-dulwich-0.19.7.zipdulwich-dulwich-0.19.7dulwich解压后

    2. 放入 D:Program FilesTortoiseHgliblibrary.zipdulwich压缩包里

      放在根目录或子目录都无法识别.

      只有放这个压缩包里才算正常.

    3. 在绑定有Git远程仓库地址的仓库执行下拉 一切正常 除了闪退

      让查看日志:"D:Program FilesTortoiseHg hgw.exe.log"然后直接这个程序闪退了

      zipimport.ZipImportError: bad local file header: D:Program FilesTortoiseHgliblibrary.zip

    4. 通过thg.exe启动程序居然闪退! 一切正常且没有命令行窗口!

      thgw.exe程序启动就会闪退!这个是Windows GUI版本

      而且后续启动都不再输出错误信息到thgw.exe.log了, 并且闪退后 其进程居然没有退出还有残留thgw.exe

      thg.exe 这个是Windows console版本

      • thg.exe 修改为thgw.exe 后居然也无法正常运行! 奇怪啊!
      • library.zip包还原为原来的包,再运行thgw.exe居然还是闪退! 奇怪啊!
      • 将全局配置里的hggit2注释掉,再运行thgw.exe居然还是闪退! 奇怪啊!

    将"扩展"最新代码统一集成到library.zip的方案

    优点:

    • 就跟正常官方曾经集成打包在一起的情况,只管开启"扩展"开关即可.

    • 只管正常升级到5.X版本最新的程序即可,然后替换liblibrary.zip即可

    • 不需要额外配置外部源码路径, 方便分发给别的人使用,减少配置代价,能重用原来的配置。
      只有需要在5.x版本正常使用hggit扩展的情况下!!!!

    效果

    1. 修改前: 是通过外部文件夹直接指定目录的方式来配置扩展

      [extensions]
      mercurial_keyring = D:Program FilesTortoiseHg.Extmercurial_keyringmercurial_keyring.py
      hggit2 = D:Program FilesTortoiseHg.Exthg-githggit
      
    2. 修改为: 统一集成后的配置效果

      [extensions]
      mercurial_keyring = 
      hggit = 
      

    集成步骤

    1. 在通过指定外部文件夹路径能正常生效的基础上

    2. 将"HG-Git最新扩展源码包里的所有*.pyo文件"放入指定路径即可library.ziphgexthggit

    3. 覆盖同名文件 library.ziphgextmercurial_keyring.pyolibrary.ziphgextmercurial_extension_utils.pyo即可

    4. 如何得到*.pyo文件?

      • 正常 通过指定外部文件夹路径 运行过1次, 就会在 .py 源码 同级目录生成同名的 .pyo 文件.
      • 或者直接使用python -o命令来手动生成应该也是可以的.
    作者:Asion Tang
    凡是没有注明[转载]的文章,本Blog发表的文章版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    DevExpress GridControl使用方法
    DevExpress中,添加Winform窗体到DockPanel z
    取消默认 $ 定义
    五角星效果实现
    jquery的each函数的用法
    Object类型转换为long或者Long
    easyui datagrid 列排序
    redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value
    DIV元素不换行
    JS 中div内容的显示和隐藏
  • 原文地址:https://www.cnblogs.com/AsionTang/p/15095420.html
Copyright © 2020-2023  润新知