【问题标题】:creating mercurial repo in directory whose name has dollar signs在名称带有美元符号的目录中创建 mercurial repo
【发布时间】:2018-04-24 08:40:31
【问题描述】:

我正在尝试在名称中包含美元符号的目录中创建一个 mercurial 存储库。这是我在带有 mercurial 4.1.3 的 Windows 10 cmd.exe 上获得的等效且简化的示例:

C:\test\dir1>hg init

C:\test\dir1>hg status

C:\test\dir1>cd ../dir$$1

C:\test\dir$$1>hg init

C:\test\dir$$1>hg status 
abort: repository C:\test\dir$$1 not found!

所以我希望这很清楚,唯一的区别似乎是第二个目录名称中的美元符号。提前致谢!

【问题讨论】:

  • 好像不行。你有什么问题?
  • 这是解决各种问题的良方,如果你能找到让它发挥作用的方法的话。你为什么要这样做?
  • 约翰,感谢您的回复,抱歉我的问题没有说清楚。有没有办法可以在名称带有美元符号的目录中在 Windows 10 上使用 Mercurial?谢谢
  • Ed,我在我的东西上添加了特殊字符,$ 或 @,这样它就可以排在喜欢创建的垃圾窗口的顶部。虽然上面的示例没有将美元作为第一个字符,但它旨在尽可能简单,同时显示意外的 Mercurial 行为。感谢您的回复

标签: windows mercurial non-alphanumeric


【解决方案1】:

这已作为 Mercurial 错误输入:https://bz.mercurial-scm.org/show_bug.cgi?id=5739

【讨论】:

    【解决方案2】:

    Mercurial 似乎将美元符号视为环境变量转义:

    C:\test>set X=abc
    
    C:\test>echo $X          # Not the shell expanding it, that would be %X%.
    $X
    
    C:\test>hg init $X
    
    C:\test>dir
     Volume in drive C has no label.
     Volume Serial Number is CE8B-D448
    
     Directory of C:\test
    
    11/10/2017  09:27 PM    <DIR>          .
    11/10/2017  09:27 PM    <DIR>          ..
    11/10/2017  09:27 PM    <DIR>          abc
                   0 File(s)              0 bytes
                   3 Dir(s)  53,899,231,232 bytes free
    

    Mercurial 已将 $X 扩展为环境变量。另外:

    C:\test>hg init dir$$x
    
    C:\test>dir
     Volume in drive C has no label.
     Volume Serial Number is CE8B-D448
    
     Directory of C:\test
    
    11/10/2017  09:30 PM    <DIR>          .
    11/10/2017  09:30 PM    <DIR>          ..
    11/10/2017  09:30 PM    <DIR>          dir$x
                   0 File(s)              0 bytes
                   3 Dir(s)  53,899,091,968 bytes free
    

    两个美元符号插入一个美元符号。当您位于名为 dir$$x 的目录中时,Mercurial 使用 dir$x 作为名称。我找到了hg -R. status 的解决方法,但最好避免使用美元符号。

    【讨论】:

    • 感谢 Mark Tolonen 非常清楚地演示了 hg 在这种情况下的工作原理。在问之前我应该​​看看these docs from selenic。会听取您的建议并避免使用美元符号。谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多