Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions git-cal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use Data::Dumper;

binmode(STDOUT, ":utf8");
#command line options
my ( $help, $period, $use_ascii, $use_ansi, $use_unicode, $format, $author, $filepath, $all_branches );
my ( $help, $period, $use_ascii, $use_ansi, $use_unicode, $format, $author, $filepath, $all_branches, $hg );

GetOptions(
'help|?' => \$help,
Expand All @@ -20,7 +20,8 @@ GetOptions(
'ansi' => \$use_ansi,
'unicode' => \$use_unicode,
'author=s' => \$author,
'all' => \$all_branches
'all' => \$all_branches,
'hg' => \$hg
) or pod2usage(2);

pod2usage(1) if $help;
Expand Down Expand Up @@ -67,7 +68,7 @@ sub process {
}

sub process_current_repo {
my $git_command = git_command();
my $git_command = $hg ? hg_command() : git_command();
my @epochs = qx/$git_command/;

if ($?) {
Expand All @@ -86,6 +87,11 @@ sub process_current_repo {
}
}

sub hg_command {
my $command = qq/hg log --template "{date(date, '%s')}\n"/;
return $command;
}

sub git_command {
my $command = qq{git log --no-merges --pretty=format:"%at" --since="13 months"};
$command .= qq{ --author="$author"} if $author;
Expand Down Expand Up @@ -441,6 +447,8 @@ Activity can be displayed using ascii, ansi or unicode characters, default is ch

git-cal --unicode

git-cal --hg

git-cal <options> <filepath>

=head2 OPTIONS
Expand Down Expand Up @@ -483,6 +491,10 @@ Display activity using ANSI colors

Display activity using unicode characters

=item --hg

Display activity for a Mercurial repository

=item --help|-?

Print this message.
Expand Down