Skip to content

Alec-Shay/true-blame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contents

Parameters

  • -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

Installation

  1. Install Python 3

  2. Download true-blame.py

Setup

  1. After downloading true-blame.py, in IntelliJ, navigate to File -> Settings.
  2. Add a new external tool under Tools -> External Tools.

External Tools screenshot

  1. Add a name (i.e., "true blame") and ensure "Open console" is checked under Options
  2. Under Show in, uncheck all options except Editor menu.
  3. Set the following under Tool settings:
    • Program: py
    • Parameters: /path/to/true-blame.py $FileRelativePath$ $LineNumber$ -s "$SelectedText$"
    • Working directory: $ProjectFileDir$
  4. 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.

Right-click context screenshot

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$

Right-click prompt screenshot

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.

Right-click prompt screenshot

Setup

  1. Download tb to the same directory as true-blame.py.

  2. Add this section to .bash_aliases (or the equivalent on any shell) which calls the script.

  3. 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published