summaryrefslogtreecommitdiff
path: root/bin/32commit
blob: 903722e4e8ae0a68bcbd383904d8256b5dcd0002 (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: 32commit '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/freeside3/$prefix; git pull ) && ",
  "( cd /home/$USER/freeside2.3/$prefix; git pull ) && ",
  "git diff -u @ARGV | ( cd /home/$USER/freeside3/$prefix; patch -p1 ) ",
  " && git diff -u @ARGV | ( cd /home/$USER/freeside2.3/$prefix; patch -p1 ) ",
  " && ( ( git pull && git commit  -m $desc @ARGV && git push); ",
  "( cd /home/$USER/freeside3/$prefix; git commit -m $desc @ARGV && git push); ",
  "( cd /home/$USER/freeside2.3/$prefix; git commit -m $desc @ARGV && git push) )"
);