Merge branch 'github/pr/55_reprise'
[freeside.git] / bin / 3commit
1 #!/usr/bin/perl
2
3 # usage: 3commit 'log message' filename filename ...
4
5 use Cwd;
6 use String::ShellQuote;
7
8 my $USER = $ENV{USER};
9
10 my $dir = getcwd;
11 ( my $prefix = $dir ) =~ s(^/home/$USER/freeside/?)() or die $dir; #eventually from anywhere
12
13 my $desc = shell_quote(shift @ARGV); # -m
14
15 die "no files!" unless @ARGV;
16
17 #warn "$prefix";
18
19 #print <<END;
20 system join('',
21   "( cd /home/$USER/freeside3/$prefix; git pull ) && ",
22   "git diff -u @ARGV | ( cd /home/$USER/freeside3/$prefix; patch -p1 ) ",
23   " && ( ( git pull && git commit  -m $desc @ARGV && git push ); ",
24   "( cd /home/$USER/freeside3/$prefix; git commit -m $desc @ARGV && git push ) )"
25 );
26