小编jas*_*ark的帖子

Mercurial .hgrc文件中的存储库相对路径

我正在尝试为Mercurial创建一个具有通用扩展的共享hgrc文件,因此我的同事可以获得一致的体验并找到有用的工具.但是,启用Mercurial未附带的扩展程序会导致问题.

我的主要repo的hgrc指向源控制的共享.hgrc文件:

\ Repo.hg\hgrc

%include ..\tools\hg\dev.hgrc
Run Code Online (Sandbox Code Playgroud)

共享dev.hgrc然后启用我们保持源代码控制的扩展:

\回购\工具\汞柱\ dev.hgrc

[extensions]
hgshelve=tools\hg\hgshelve\hgshelve.py
fold=tools\hg\hgfold\fold.py
Run Code Online (Sandbox Code Playgroud)

问题是只有在从根Repo目录运行hg时才会找到这些扩展.从子目录运行它会产生错误:

E:\Repo\src>hg
*** failed to import extension hgshelve from tools\hg\hgshelve\hgshelve.py: [Errno 2] No such file or directory
*** failed to import extension fold from tools\hg\hgfold\fold.py: [Errno 2] No such file or directory
Run Code Online (Sandbox Code Playgroud)

我想引用存储库的根,而不依赖于相对路径结构之外的任何东西.

我查看了手册,但没有看到任何存储库相对路径选项.

mercurial hgrc

10
推荐指数
1
解决办法
1715
查看次数

在Powershell Invoke-Expression中转义splatted变量

我正在尝试从Powershell调用另一个应用程序(Beyond Compare),它在典型的命令行中需要@:

C:\deploy>bcompare @static.diff
Run Code Online (Sandbox Code Playgroud)

我找到了Powershell的Invoke-Expression,但是当我尝试以下操作时它给了我一个错误:

PS C:\deploy>Invoke-Expression "bcompare @static.diff"
Invoke-Expression : Cannot expand the splatted variable '@static'. Splatted variables
cannot be used as part of a property or array expression. Assign the result of the 
expression to a temporary variable then splat the temporary variable instead.
At line:1 char:18
    + Invoke-Expression <<<<  "bcompare @static.diff"
    + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
    + FullyQualifiedErrorId : NoPropertiesInSplatting,Microsoft.PowerShell.Comands.InvokeExpressionCommand
Run Code Online (Sandbox Code Playgroud)

我不能让@在这里正确逃脱.我已经尝试了`,@ @,将部分命令放在一个临时变量中,但是没有一个能够完成这个操作.

powershell escaping

8
推荐指数
2
解决办法
9956
查看次数

标签 统计

escaping ×1

hgrc ×1

mercurial ×1

powershell ×1