Skip to content

Commit 751a063

Browse files
authored
Enhance 'p4udiff' to better support shelved changelists. (#454)
Improved documentation for p4udiff and gitdiff. Signed-off-by: Henry Cox <henry.cox@mediatek.com>
1 parent b559492 commit 751a063

File tree

2 files changed

+284
-190
lines changed

2 files changed

+284
-190
lines changed

scripts/gitdiff

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/usr/bin/env perl
22

3+
# gitudiff
4+
#
5+
# This script extracts a unified-diff between two git SHAs
6+
# See
7+
# $ gitdiff --help
8+
#
9+
310
use Getopt::Long;
411
use strict;
512
use Cwd /realpath/;
@@ -41,19 +48,48 @@ my $suppress_unchanged;
4148
my $prefix = '';
4249
my $ignore_whitespace;
4350
my $repo = '.'; # cwd
51+
my $help;
4452

4553
if (!GetOptions("exclude=s" => \@exclude_patterns,
4654
"include=s" => \@include_patterns,
4755
'no-unchanged' => \$suppress_unchanged,
4856
'prefix=s' => \$prefix,
4957
'b|blank' => \$ignore_whitespace,
5058
'repo=s' => \$repo,
51-
'verbose+' => \$verbose) ||
59+
'verbose+' => \$verbose,
60+
'help' => \$help) ||
61+
$help ||
5262
(2 != scalar(@ARGV) &&
5363
3 != scalar(@ARGV))
5464
) {
55-
print(STDERR
56-
"usage: [(--exclude|include) regexp[,regexp]] [--repo repo] [-b] [dir] base_changelist current_changelist\n'exclude' wins if both exclude and include would match.\n"
65+
print(STDERR<<EOF
66+
Usage:
67+
$0 \\
68+
[(--exclude|include) regexp[,regexp]] [--repo repo_directory] \\
69+
[-b] [dir] base_SHA current_SHA
70+
71+
--repo repo_directory:
72+
your git repo directory. Default is '.'.
73+
--prefix:
74+
leading path to strip from file pathnames in the diff report
75+
--no-unchanged:
76+
In order to eliminate potential ambiguities caused by multiple
77+
source files with the same basename, by default, we include
78+
unchanged file references in the diff report.
79+
This option removes those entries.
80+
-b|--blank:
81+
ignore whitespace changes.
82+
--include regexp:
83+
regexp compared to the Perforce path (i.e., starting in
84+
//p4_repo/...). If 'include' regexps are specified, then only
85+
Matching references are included in the report; if no
86+
'include' regexps are specified, then entries are included unless
87+
they have been excluded.
88+
--exclude regexp:
89+
regexp compared to the Perforce path (i.e., starting in
90+
//p4_repo/...). Matching entries are removed from the report.
91+
'exclude' wins if both exclude and include would match.
92+
EOF
5793
);
5894
exit(1);
5995
}

0 commit comments

Comments
 (0)