-
-s <string>
: specify a specific substring to search on- string : entire line without leading or trailing whitespace by default
-
-r <start-commit> <end-commit>
: search in reverse- start-commit : HEAD by default
- end-commit : HEAD by default
-
-ic
: ignore case when searching- False by default
-
-q
: only print the result- False by default
-
-gitk
: open gitk on result hash- False by default
-
--help
: show usage details
-
Install Python 3
-
Download
true-blame.py
- After downloading
true-blame.py
, in IntelliJ, navigate toFile
->Settings
. - Add a new external tool under
Tools
->External Tools
.
- Add a name (i.e., "true blame") and ensure "Open console" is checked under
Options
- Under
Show in
, uncheck all options exceptEditor menu
. - Set the following under
Tool settings
:- Program: py
- Parameters: /path/to/true-blame.py $FileRelativePath$ $LineNumber$ -s "$SelectedText$"
- Working directory: $ProjectFileDir$
- Optionally, add a shortcut by going to Keymap -> External Tools and right-clicking True Blame.
Now you can run True Blame from IntelliJ by using the right-click context menu for selected text!
Select the desired text and right-click, then under External Tools click True Blame.
Warning: IntelliJ $SelectedText$
removes quotation marks.
To allow text with quotes as well as utilize additional parameters, create another External Tool with the following Parameters:
- /path/to/true-blame.py $FileRelativePath$ $LineNumber$ $Prompt$
The following example uses prompt to pass in a substring of text (with escaped quotes) and True Blame reverse starting hash : -s "SCOPE_ID_GROUP_PREFIX = \"Group_\"" -r 23b974b
.
-
Download
tb
to the same directory astrue-blame.py
. -
Add this section to .bash_aliases (or the equivalent on any shell) which calls the script.
-
Modify
/path/to/clone/location
to the path where these files are saved.
TB_PATH=/path/to/clone/location
tb() {
${TB_PATH}/tb $@
}
To run the basic program enter tb
and input the file name, line number, and optional string when prompted.
Filename: modules/apps/web-experience/asset/asset-publisher-web/src/main/java/com/liferay/asset/publisher/web/util/AssetPublisherUtil.java
Line Number: 157
String: rootPortletId
To run with additional arguments, pass in parameters when running the alias.
tb modules/apps/web-experience/asset/asset-publisher-web/src/main/java/com/liferay/asset/publisher/web/util/AssetPublisherUtil.java 157 -s "rootPortletId" -q -gitk