mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[git] better javadoc formatting
This commit is contained in:
@@ -34,23 +34,19 @@ import java.util.regex.Pattern;
|
||||
/**
|
||||
* <p>Parses the 'git log' output basing on the given number of options.
|
||||
* Doesn't execute of prepare the command itself, performs only parsing.</p>
|
||||
*
|
||||
* <p>
|
||||
* Usage:
|
||||
* 1. Pass options you want to have in the output to the constructor using the {@link GitLogOption} enum constants.
|
||||
* 2. Get the custom format pattern for 'git log' by calling {@link #getPretty()}
|
||||
* 3. Call the command and retrieve the output.
|
||||
* 4. Parse the output via {@link #parse(CharSequence)} or {@link #parseOneRecord(CharSequence)} (if you want the output to be parsed line by line).</p>
|
||||
*
|
||||
* <p>The class is package visible, since it's used only in GitHistoryUtils - the class which retrieve various pieced of history information
|
||||
* in different formats from 'git log'</p>
|
||||
*
|
||||
* <p>Note that you may pass one set of options to the GitLogParser constructor and then execute git log with other set of options.
|
||||
* In that case {@link #parse(CharSequence)} will parse only those options which you've specified in the constructor.
|
||||
* Others will be ignored since the parser knows nothing about them: it just gets the 'git log' output to parse.
|
||||
* Moreover you really <b>must</b> use {@link #getPretty()} to pass "--pretty=format" pattern to 'git log' - otherwise the parser won't be able
|
||||
* to parse output of 'git log' (because special separator characters are used for that).</p>
|
||||
*
|
||||
* <p>If you use '--name-status' or '--name-only' flags in 'git log' you also <b>must</b> call {@link #parseStatusBeforeName(boolean)} with
|
||||
* true or false respectively, because it also affects the output.</p>
|
||||
*
|
||||
@@ -75,16 +71,15 @@ public class GitLogParser {
|
||||
|
||||
/**
|
||||
* Record format:
|
||||
*
|
||||
* One git log record.
|
||||
* <p>One git log record.
|
||||
* RECORD_START - optional: it is split out when calling parse() but it is not when calling parseOneRecord() directly.
|
||||
* commit information separated by ITEMS_SEPARATOR.
|
||||
* RECORD_END
|
||||
* Optionally: changed paths or paths with statuses (if --name-only or --name-status options are given).
|
||||
*
|
||||
* Example:
|
||||
* 2c815939f45fbcfda9583f84b14fe9d393ada790<ITEM_SEPARATOR>sample commit<RECORD_END>
|
||||
* D a.txt
|
||||
* Optionally: changed paths or paths with statuses (if --name-only or --name-status options are given).</p>
|
||||
* <p>Example:
|
||||
* <pre>
|
||||
* 2c815939f45fbcfda9583f84b14fe9d393ada790<ITEM_SEPARATOR>sample commit<RECORD_END>
|
||||
* D a.txt</pre></p>
|
||||
*/
|
||||
private static final Pattern ONE_RECORD = Pattern.compile("(?:" + RECORD_START + ")?(.*)" + RECORD_END + "\n*(.*)", Pattern.DOTALL);
|
||||
private static final String SINGLE_PATH = "([^\t\r\n]+)"; // something not empty, not a tab or newline.
|
||||
|
||||
Reference in New Issue
Block a user