Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
651 views
in Technique[技术] by (71.8m points)

mercurial - What parameters can be used in TortoiseHG custom tools?

TortoiseHG let's you add custom toolbar tools that can run mercurial (or any other) commands.

These tools would be many times more useful if it is possible to integrate them better into THG by passing them arguments from THG itself. For instance, pass a command the list of files you have selected in the working directory view.

I have seen a small handful of examples of doing this but I can't find any comprehensive documentation on what params are available, etc.

Checking the TortoiseHG documentation, it actually doesn't even list the custom tools topic at all (seems to be quite out of date).

Pressing F1 in THG doesn't do anything either... and web searches have not turned up anything.

question from:https://stackoverflow.com/questions/66068386/what-parameters-can-be-used-in-tortoisehg-custom-tools

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Eventually I just looked at the THG source code and I've listed below the variables which you can pass from THG to your custom commands. In doing that I also realized that the custom tool window tooltips show the same information! So its been there all along, just not noticed (by me).

Here's what the source code has to say:

You can use several {VARIABLES} to compose your command.

Common variables:

  • {ROOT}: The path to the current repository root.

  • {REV} / {REVID}: Selected revisions numbers / hexadecimal' revision id hashes respectively formatted as a revset' expression.

  • {SELECTEDFILES}: The list of files selected by the user on the ' revision details file list.

  • {FILES}: The list of files touched by the selected revisions.

  • {ALLFILES}: All the files tracked by Mercurial on the selected' revisions.

Pair selection variables:

  • {REV_A} / {REVID_A}: the first selected revision number / ' hexadecimal revision id hash respectively.

  • {REV_B} / {REVID_B}: the second selected revision number / ' hexadecimal revision id hash respectively.

And here's where the tooltip makes itself known:

enter image description here

Note that aside from the Command input, it also seems that you can use the same variables in the Working Directory input.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...