37 lines
572 B
Text
37 lines
572 B
Text
|
|
#!/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";
|
||
|
|
}
|