Updated versionchanger.pl for Mercurial, FINALLY fixed its whitespace.
5 'config' => 'modules.versions',
18 @arg = split(/=/, $arg);
19 $arguments{$arg[0]} = $arg[1];
23 if ($arguments{'path'} ne "")
25 if (!(-d $arguments{'path'}))
27 die "Unable to find path: " . $arguments{'path'} ."\n";
29 chdir($arguments{'path'});
32 if (!open(CONFIG, $arguments{'config'}))
34 die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
38 my $cur_module = undef;
44 if ($line =~ /^\[([^\]]+)\]$/)
53 if ($line =~ /^([^=]+) = (.+)$/)
55 $modules{$cur_module}{$1} = $2;
61 #Copy global configuration options...
62 if (exists($modules{'PRODUCT'}))
64 if (exists($modules{'PRODUCT'}{'major'}))
66 $arguments{'major'} = $modules{'PRODUCT'}{'major'};
68 if (exists($modules{'PRODUCT'}{'minor'}))
70 $arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
72 if (exists($modules{'PRODUCT'}{'revision'}))
74 $arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
78 #Get the global SVN revision if we have none
80 if ($arguments{'build'} == undef)
83 $text = `hg identif -n -i`;
86 my ($id,$num) = split(/ /, $text);
91 $rev = int($arguments{'build'});
94 my $major = $arguments{'major'};
95 my $minor = $arguments{'minor'};
96 my $revision = $arguments{'revision'};
97 my $buildstr = $arguments{'buildstring'};
99 #Go through everything now
101 while ( ($cur_module, $mod_i) = each(%modules) )
104 if ($cur_module eq "PRODUCT")
110 my $infile = $mod{'in'};
111 my $outfile = $mod{'out'};
114 if (!(-d $mod{'folder'}))
116 die "Folder " . $mod{'folder'} . " not found.\n";
118 $infile = $mod{'folder'} . '/' . $infile;
119 $outfile = $mod{'folder'} . '/' . $outfile;
123 die "File $infile is not a file.\n";
126 open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
127 open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
130 s/\$PMAJOR\$/$major/g;
131 s/\$PMINOR\$/$minor/g;
132 s/\$PREVISION\$/$revision/g;
133 s/\$BUILD_ID\$/$rev/g;
134 s/\$BUILD_STRING\$/$buildstr/g;