Exemple #1
0
 public static function run($repository)
 {
     $unmerged_paths = Filter_Conflict::getUnmergedPaths($repository);
     foreach ($unmerged_paths as $path) {
         Filter_Conflict::mergeUnmergedPath($repository, $path);
     }
     if (count($unmerged_paths)) {
         Filter_Conflict::commitMergedData($repository);
     }
 }
Exemple #2
0
    $conflict = false;
    $command = "cd {$shelldirectory}; git pull 2>&1";
    $logs[] = "{$send_receive} {$command}";
    unset($result);
    exec($command, $result, $exit_code);
    foreach ($result as $line) {
        $logs[] = "{$send_receive} {$line}";
        if (strstr($line, "CONFLICT") !== false) {
            $conflict = true;
        }
        $pull_messages[] = $line;
    }
    if ($conflict) {
        $message = "Bibledit-Web will merge the conflicts.";
        $logs[] = "{$send_receive} {$message}";
        Filter_Conflict::run($directory);
    }
    if (!$success || $conflict || count($result) > 1) {
        foreach ($logs as $log) {
            $database_logs->log($log, Filter_Roles::TRANSLATOR_LEVEL);
        }
    }
}
// Push our changes into the remote repository.
if ($success) {
    $logs = array();
    $command = "cd {$shelldirectory}; git push 2>&1";
    $logs[] = "{$send_receive} {$command}";
    unset($result);
    exec($command, $result, $exit_code);
    if ($exit_code != 0) {
Exemple #3
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
  
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
Note: This object should not call other objects within the Bibledit-Web source,
because this object is also called from Bibledit-Gtk, and does not have access
to those other objects.
Calling other objects would result in faral errors that break Bibledit-Gtk.
*/
// This calls Bibledit-Web's conflict resolution filter from the command line.
// Security: The script runs from the cli SAPI only.
if (php_sapi_name() != "cli") {
    echo "Fatal: This only runs through the cli Server API\n";
    die;
}
if ($argc != 2) {
    echo "Conflict resolver with grapheme granularity.\n";
    echo "It needs the following argument:\n";
    echo "- Path to the git repository with conflicts\n";
    die;
}
include "conflict.php";
include "merge.php";
include "rmdir.php";
$repository = $argv[1];
Filter_Conflict::run($repository);
Exemple #4
0
 public function testResolveConflictsStandard()
 {
     Filter_Conflict::run($this->userclone);
     $data = file_get_contents($this->userclone . "/Genesis/3/data");
     $this->assertEquals(trim($this->mergeddata1), $data);
     $data = file_get_contents($this->userclone . "/Exodus/2/data");
     $this->assertEquals(trim($this->mergeddata1), $data);
     $data = file_get_contents($this->userclone . "/path/to/data/file1");
     $this->assertEquals(trim($this->mergeddata2), $data);
     $data = file_get_contents($this->userclone . "/file2");
     $this->assertEquals(trim($this->mergeddata2), $data);
 }