Rewrite hg+ script
This commit is contained in:
parent
ce5b9c0d82
commit
6feacfe8ee
2 changed files with 10 additions and 37 deletions
5
bin/git+
5
bin/git+
|
|
@ -1,8 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
if [ $# -eq 0 ]; then
|
||||||
then
|
echo 'Where is my commit message, bro?'
|
||||||
echo where is my commit message, bro?
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
42
bin/hg+
42
bin/hg+
|
|
@ -1,36 +1,10 @@
|
||||||
#!/usr/bin/env perl
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
use strict;
|
if [ $# -eq 0 ]; then
|
||||||
use warnings;
|
echo 'Where is my commit message, huh?'
|
||||||
use Cwd;
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
die 'please enter commit message' unless @ARGV;
|
hg addremove
|
||||||
|
hg commit -m ''"$*"''
|
||||||
my $msg = join ' ', @ARGV;
|
hg push
|
||||||
|
|
||||||
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";
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue