Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hg option for a Mercurial repo #52

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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