diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2010-11-11 15:23:54 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2010-11-11 15:23:54 -0800 |
commit | ec9a597a4e7b98ab54a7d5f049b2f4d1d09d947c (patch) | |
tree | 1687d53af3f9c121a038c0d1becb5b8641b9c3db | |
parent | da5f3fef00f713e8ebbf0f62630eb8a2dbb0977a (diff) | |
download | vyatta-config-mgmt-ec9a597a4e7b98ab54a7d5f049b2f4d1d09d947c.tar.gz vyatta-config-mgmt-ec9a597a4e7b98ab54a7d5f049b2f4d1d09d947c.zip |
Add "show-commit-log-brief" for tab completion.
-rw-r--r-- | lib/Vyatta/ConfigMgmt.pm | 20 | ||||
-rwxr-xr-x | scripts/vyatta-config-mgmt.pl | 11 |
2 files changed, 25 insertions, 6 deletions
diff --git a/lib/Vyatta/ConfigMgmt.pm b/lib/Vyatta/ConfigMgmt.pm index 9a0776b..90d2289 100644 --- a/lib/Vyatta/ConfigMgmt.pm +++ b/lib/Vyatta/ConfigMgmt.pm @@ -146,6 +146,7 @@ sub cm_commit_add_log { } sub cm_commit_get_log { + my ($brief) = @_; my @lines = cm_read_file($commit_log_file); @@ -158,13 +159,20 @@ sub cm_commit_get_log { } $line = $1; my ($time, $user, $via, $comment) = split(/\|/, $line); - my $time_str = strftime("%Y-%m-%d %H:%M:%S", localtime($time)); $comment =~ s/\%\%/\|/g; - my $new_line = sprintf("%-2s %s by %s via %s\n", - $count, $time_str, $user, $via); - push @commit_log, $new_line; - if (defined $comment and $comment ne '' and $comment ne 'commit') { - push @commit_log, " $comment\n" + if (defined $brief) { + my $time_str = strftime("%Y-%m-%d_%H:%M:%S", localtime($time)); + $comment = '' if ! defined $comment; + my $new_line = sprintf("%s %s by %s", $time_str, $user, $via); + push @commit_log, $new_line; + } else { + my $time_str = strftime("%Y-%m-%d %H:%M:%S", localtime($time)); + my $new_line = sprintf("%-2s %s by %s via %s\n", + $count, $time_str, $user, $via); + push @commit_log, $new_line; + if (defined $comment and $comment ne '' and $comment ne 'commit') { + push @commit_log, " $comment\n" + } } $count++; } diff --git a/scripts/vyatta-config-mgmt.pl b/scripts/vyatta-config-mgmt.pl index 31ccca9..95abdb1 100755 --- a/scripts/vyatta-config-mgmt.pl +++ b/scripts/vyatta-config-mgmt.pl @@ -211,6 +211,17 @@ if ($action eq 'show-commit-log') { exit 0; } +if ($action eq 'show-commit-log-brief') { + print "show-commit-log-brief\n" if $debug; + my $max_revs = cm_get_max_revs(); + my @log = cm_commit_get_log(1); + foreach my $line (@log) { + $line =~ s/\s/_/g; + print $line, ' '; + } + exit 0; +} + if ($action eq 'show-commit-file') { die "Error: no revnum" if ! defined $revnum; print "show-commit-file [$revnum]\n" if $debug; |