acme/bin/hg+
Ev Bogdanov c2271ba672 acme
2017-01-26 19:29:57 +03:00

36 lines
572 B
Perl
Executable file

#!/usr/bin/env perl
use strict;
use warnings;
use Cwd;
die 'please enter commit message' unless @ARGV;
my $msg = join ' ', @ARGV;
my $dir = getcwd();
system "hg --cwd $dir addremove";
system "hg --cwd $dir commit -m '$msg'";
system "hg --cwd $dir push";
my $hgrc = "$dir/.hg/hgrc";
open my $fh, '<', $hgrc
or die "cannot open $hgrc: $!\n";
my $repository;
while (my $line = readline($fh)) {
if ($line =~ m/^bb\.prefix = (.+)$/) {
$repository = $1;
last;
}
}
close $fh;
if ($repository) {
print "\nview commits:\n";
print "$repository/commits/all\n";
}