svnpush.pl
author Ryan C. Gordon <icculus@icculus.org>
Sat, 19 Apr 2008 02:29:41 -0400
branchtrunk
changeset 147 98043daf5027
parent 125 9d7952ff149d
child 166 b34c2c71aeb6
permissions -rwxr-xr-x
Removed explicit numbers on enums in mojoshader.h. Why was I doing that, again?
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
123
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
#!/usr/bin/perl -w
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
use strict;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
use warnings;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
print("Making sure svn working copy is up to date...\n");
125
9d7952ff149d Fixed paths in svnpush.pl ...
Ryan C. Gordon <icculus@icculus.org>
parents: 123
diff changeset
     7
system("cd ../svn-mojoshader ; svn update");
9d7952ff149d Fixed paths in svnpush.pl ...
Ryan C. Gordon <icculus@icculus.org>
parents: 123
diff changeset
     8
my $svnver = `cd ../svn-mojoshader ; svnversion`;
123
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
chomp($svnver);
125
9d7952ff149d Fixed paths in svnpush.pl ...
Ryan C. Gordon <icculus@icculus.org>
parents: 123
diff changeset
    10
my $hgver = `cd ../svn-mojoshader ; svn log -r${svnver} |grep 'changeset:'`;
123
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
chomp($hgver);
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
$hgver =~ s/^changeset:\s+(\d+):.*\Z/$1/;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
my $min = $hgver;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
$hgver = `hg tip |grep 'changeset:'`;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
chomp($hgver);
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
$hgver =~ s/^changeset:\s+(\d+):.*\Z/$1/;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
my $max = $hgver;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
if ($min == $max) {
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
    print("We're already up to date. Exiting.\n");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
    exit 0;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
}
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
$min++;  # $min was the last committed revision, so we need to start one later.
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
print("first hg revision to commit to svn == '$min'\n");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
print("last hg revision to commit to svn == '$max'\n");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
my $i;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
for ($i = $min; $i <= $max; $i++) {
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
    my $p = $i - 1;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
    print("Revision #$i ...\n");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
    print("Getting log from Mercurial...\n");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
    system("hg log -v -r$i |grep -v '^tag: ' |tail -n +7 > commit.txt");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
    system("echo >> commit.txt");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
    system("echo 'This commit is from my temporary Mercurial repository...' >> commit.txt");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
    system("hg log -v -r$i |grep -v '^tag: ' |head -n 4 >> commit.txt");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
    print("Getting diff...\n");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
    system("hg diff -r${p}:${i} > patch.diff");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
    print("Patching svn working copy...\n");
125
9d7952ff149d Fixed paths in svnpush.pl ...
Ryan C. Gordon <icculus@icculus.org>
parents: 123
diff changeset
    42
    system("cd ../svn-mojoshader ; patch -p1 < ../mojoshader/patch.diff");
123
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
    print("Committing svn working copy...\n");
125
9d7952ff149d Fixed paths in svnpush.pl ...
Ryan C. Gordon <icculus@icculus.org>
parents: 123
diff changeset
    44
    system("cd ../svn-mojoshader ; svn commit -F ../mojoshader/commit.txt");
123
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
    print("Cleaning up...\n");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
    system("rm -rf commit.txt patch.diff");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
    print("...revision committed!\n");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
}
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
print("svn push complete!\n\n");
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
exit 0;
45c694d8d318 Added svnpush.pl for now.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52