From ef3472eafddc2344ea6f05b3871b9ff2d9094b87 Mon Sep 17 00:00:00 2001 From: farhad Date: Wed, 25 Feb 2015 14:18:24 +0100 Subject: [PATCH 1/2] hg option added, it is the functionality enhancement for a Mercurial repo --- git-cal | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/git-cal b/git-cal index dd8289d..4427dcf 100755 --- a/git-cal +++ b/git-cal @@ -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, @@ -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; @@ -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 ($?) { @@ -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; From d0b86cb8acc66810955ddccee8088dc3cee936d1 Mon Sep 17 00:00:00 2001 From: farhad Date: Wed, 25 Feb 2015 14:22:12 +0100 Subject: [PATCH 2/2] perldoc for hg option added --- git-cal | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/git-cal b/git-cal index 4427dcf..a23a8b5 100755 --- a/git-cal +++ b/git-cal @@ -447,6 +447,8 @@ Activity can be displayed using ascii, ansi or unicode characters, default is ch git-cal --unicode + git-cal --hg + git-cal =head2 OPTIONS @@ -489,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.