示例#1
0
 $committeremail = $commitinfo[1];
 $realmodified = $commitinfo[2];
 // the real timestamp of the commit - should be the same as $committime
 $commitmsg = iconv('UTF-8', 'UTF-8//IGNORE', $commitinfo[3]);
 $commitmsg .= "\n\nCommitted into Git: " . local_amos_renderer::commit_datetime($realmodified);
 $fullcommitmsg = implode("\n", array_slice($commitinfo, 3));
 // AMOS script is looked up here later
 if ($changetype == 'D') {
     // whole file removal - do not do anything, fix-drift job will clear the repository
     continue;
 }
 // get the list of strings affected by the commit
 $gitcmd = AMOS_PATH_GIT . " log -1 -p --format=format: " . $commithash . ' -- ' . $file;
 $diff = array();
 exec($gitcmd, $diff);
 foreach (mlang_tools::get_affected_strings($diff) as $stringid) {
     $affected[$componentname][$stringid] = true;
 }
 // dump the given revision of the file to a temporary area
 $checkout = $commithash . '_' . str_replace('/', '_', $file);
 if (in_array($checkout, $MLANG_BROKEN_CHECKOUTS)) {
     fputs(STDOUT, "BROKEN {$checkout}\n");
     continue;
 }
 $checkout = $tmp . '/' . $checkout;
 exec(AMOS_PATH_GIT . " show {$commithash}:{$file} > {$checkout}");
 // convert the php file into strings in the staging area
 if ($version->code >= mlang_version::MOODLE_20) {
     if ($committime >= 1270908105) {
         // since David's commit 30c8dd34f70437b15bd7960eb056d8de0c5e0375
         // on 10th April 2010, strings are in the new format
示例#2
0
 public function test_get_affected_strings()
 {
     $diff = file(dirname(__FILE__) . '/parserdata002.txt');
     $affected = mlang_tools::get_affected_strings($diff);
     $this->assertEqual(count($affected), 5);
     $this->assertTrue(in_array('configdefaultuserroleid', $affected));
     $this->assertTrue(in_array('confignodefaultuserrolelists', $affected));
     $this->assertTrue(in_array('nodefaultuserrolelists', $affected));
     $this->assertTrue(in_array('nolangupdateneeded', $affected));
     $this->assertTrue(in_array('mod/something:really_nasty-like0098187.this', $affected));
 }