summaryrefslogtreecommitdiff
path: root/bin/231commit
blob: 6d09863ca9f591403aaf33b3e2bea28a7acb1104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl

# usage: 231commit 'log message' filename filename ...

use Cwd;
use String::ShellQuote;

my $USER = $ENV{USER};

my $dir = getcwd;
( my $prefix = $dir ) =~ s(^/home/$USER/freeside/?)() or die $dir; #eventually from anywhere

my $desc = shell_quote(shift @ARGV); # -m

die "no files!" unless @ARGV;

#warn "$prefix";

#print <<END;
system join('',
  "( cd /home/$USER/freeside2.3/$prefix; git pull ) && ",
  "( cd /home/$USER/freeside2.1/$prefix; git pull ) && ",
  "git diff -u @ARGV | ( cd /home/$USER/freeside2.3/$prefix; patch -p1 ) ",
  " && git diff -u @ARGV | ( cd /home/$USER/freeside2.1/$prefix; patch -p1 ) ",
  " && ( ( git commit  -m $desc @ARGV && git push); ",
  "( cd /home/$USER/freeside2.3/$prefix; git commit -m $desc @ARGV && git push); ",
  "( cd /home/$USER/freeside2.1/$prefix; git commit -m $desc @ARGV && git push) )"
);