ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.85 by root, Sun Oct 8 21:22:30 2006 UTC vs.
Revision 1.87 by root, Sun Oct 8 21:57:54 2006 UTC

80 80
81sub editor_invoke { 81sub editor_invoke {
82 my $editsup = $::CONN && $::CONN->{editor_support} 82 my $editsup = $::CONN && $::CONN->{editor_support}
83 or return; 83 or return;
84 84
85 # putting the password into the env is somewhat tasteless
86# local $ENV{CFPLUS_LOGIN} = $::PROFILE->{user};
87# local $ENV{CFPLUS_PASSWORD} = $::PROFILE->{password};
88# local $ENV{CFPLUS_UPLOAD} = $::CONN->{upload};
89
90 my ($pid, $fh); 85 my ($pid, $fh);
91 unless ($pid = open $fh, "-|:utf8", "-") { 86 unless ($pid = open $fh, "-|:utf8", "-") {
92 $SIG{__DIE__} = sub { 87 $SIG{__DIE__} = sub {
93 warn "@_\n"; 88 my $msg = $_[0];
89 $msg =~ s/\n+/\n/;
90 warn "FATAL: $msg";
94 CFPlus::_exit 99; 91 CFPlus::_exit 99;
95 }; 92 };
96 93
97 open STDERR, ">&STDOUT"; 94 open STDERR, ">&STDOUT";
98 binmode STDOUT, ":utf8"; 95 binmode STDOUT, ":utf8";
129 } 126 }
130 127
131 if (1) { # upload a map 128 if (1) { # upload a map
132 my $mapname = $::CONN->{map_info}[0]; 129 my $mapname = $::CONN->{map_info}[0];
133 130
131 my $mappath = "$mapdir/$mapname";
132
133 -e $mappath and die "$mappath already exists\n";
134
134 print "getting map revision for $mapname...\n"; 135 print "getting map revision for $mapname...\n";
135 136
136 # try to get the most recent head revision, what a hack, 137 # try to get the most recent head revision, what a hack,
137 # this should have been returned while downloading *sigh* 138 # this should have been returned while downloading *sigh*
138 my $log = (check_lwp $ua->get ("$editsup->{cvs_root}/$mapname?view=log&logsort=rev"))->decoded_content; 139 my $log = (check_lwp $ua->get ("$editsup->{cvs_root}/$mapname?view=log&logsort=rev"))->decoded_content;
141 my $rev = $1; 142 my $rev = $1;
142 143
143 print "downloading revision $rev...\n"; 144 print "downloading revision $rev...\n";
144 145
145 my $map = (check_lwp $ua->get ("$editsup->{cvs_root}/$mapname?rev=$rev"))->decoded_content; 146 my $map = (check_lwp $ua->get ("$editsup->{cvs_root}/$mapname?rev=$rev"))->decoded_content;
147
148 my $meta = {
149 %$editsup,
150 path => $mapname,
151 revision => $rev,
152 cf_login => $::PROFILE->{user},
153 };
154
155 require File::Basename;
156 require File::Path;
157
158 File::Path::mkpath (File::Basename::dirname ($mappath));
159 open my $fh, ">:raw:perlio", "$mappath.meta"
160 or die "$mappath.meta: $!\n";
161 print $fh CFPlus::to_json $meta;
162 close $fh;
163 open my $fh, ">:raw:perlio:utf8", $mappath
164 or die "$mappath: $!\n";
165 print $fh $map;
166 close $fh;
167
168 print "saved as $mappath\n";
169
170 print "invoking editor...\n";
171 exec "/root/s2/gce $mappath";#d#
146 172
147 # now upload it 173 # now upload it
148# require HTTP::Request::Common; 174# require HTTP::Request::Common;
149# 175#
150# my $res = $ua->post ( 176# my $res = $ua->post (
171# } 197# }
172 } else { 198 } else {
173 die "viewvc parse error, unable to detect revision\n"; 199 die "viewvc parse error, unable to detect revision\n";
174 } 200 }
175 } 201 }
176
177 print "invoking editor...\n";
178 exec "/root/s2/gce";#d#
179 202
180 CFPlus::_exit; 203 CFPlus::_exit;
181 } 204 }
182 205
183 my $buffer; 206 my $buffer;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines