acme/bin/hg+

37 lines
572 B
Text
Raw Normal View History

2017-01-26 19:29:57 +03:00
#!/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";
}