3add
authorIvan Kohler <ivan@freeside.biz>
Fri, 10 May 2013 07:46:53 +0000 (00:46 -0700)
committerIvan Kohler <ivan@freeside.biz>
Fri, 10 May 2013 07:46:53 +0000 (00:46 -0700)
bin/3commit [new file with mode: 0755]
bin/3diff [new file with mode: 0755]

diff --git a/bin/3commit b/bin/3commit
new file mode 100755 (executable)
index 0000000..cd1db21
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+# usage: 23commit '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 ) && ",
+  "git diff -u @ARGV | ( cd /home/$USER/freeside3/$prefix; patch -p1 ) ",
+  " && ( ( git pull && git commit  -m $desc @ARGV && git push ); ",
+  "( cd /home/$USER/freeside3/$prefix; git commit -m $desc @ARGV && git push ) )"
+);
+
diff --git a/bin/3diff b/bin/3diff
new file mode 100755 (executable)
index 0000000..badafd5
--- /dev/null
+++ b/bin/3diff
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+my $file = shift;
+
+chomp(my $dir = `pwd`);
+$dir =~ s/freeside(\/?)/freeside3$1/;
+warn $dir;
+
+#$cmd = "diff -u $file $dir/$file";
+$cmd = "diff -ubBw $dir/$file $file";
+print "$cmd\n";
+system($cmd);
+