tFF.msk.ru :: Sharing tFFed mind

Технологично => Девелопмент => Тема начата: tFF от Сентябрь 24, 2009, 23:31:12



Название: Version Control System
Отправлено: tFF от Сентябрь 24, 2009, 23:31:12
Subversion

Цитировать
Иногда возникает необходимость получить измененные файлы между двумя ревизиями. Не многие svn gui клиенты способны на это (а под linux таких вообще не встречал).
Зачем это нужно? Ну скажем для загрузки изменений произошедших в проекте. При этом не нужно будет перезаливать весь проект, что безусловно экономит время и трафик! :-)
Для упрощения этой процедуры был написан небольшой консольный скрипт на php.

Код:
#! /usr/bin/php
    < ?php
        /**
         * usage: svn://server repository start_revision end_revision /export/path/
         */
        // Ловим параметры
        if(isset($argv[1], $argv[2], $argv[3], $argv[4], $argv[5]) && ereg('^[0-9]+$', $argv[3]) && ereg('^[0-9]+$', $argv[4]))
        {
            $server     = $argv[1];
            $repository    = $argv[2];
            $revStart     = $argv[3];
            $revEnd     = $argv[4];
            $saveDir     = $argv[5];
        }
        else
        {
            die("usage: svn://server repository start_revision end_revision /export/path/\n");
        }
 
        // Функция создания папок по пути
        function mkdirs($path)
        {
            if(is_dir($path))
            {
                return true;
            }
            $exp = explode("/", $path);
            $way = '';
            foreach($exp as $n)
            {
                $way .= $n . '/';
                if(!file_exists($way))
                {
                    if(!mkdir($way, 0777))
                    {
                        return false;
                    }
                }
            }
            return true;
        }
 
        // Получаем список измененных файлов
        $svnList = explode("\n", `svn diff --summarize -r {$revStart}:{$revEnd} {$server}/{$repository}/`);
 
        if(sizeof($svnList))
        {
            // Запишем ревизию в файл
            file_put_contents($saveDir . '.revision', $revEnd);
            foreach($svnList as $item)
            {
                if(strlen($item))
                {
                    // Получаем путь до файла в хранилище
                    $sfile = trim(substr($item, 5, strlen($item)));
                    if(parse_url($sfile, PHP_URL_SCHEME) != '')
                    {
                        $sdir = dirname($sfile);
                        // Получаем путь папки для сохранения
                        $dir = $saveDir . substr($sdir, strlen($server . '/' . $repository . '/'), strlen($sdir));
                        // Получаем путь файла для сохранения
                        $file = $saveDir . substr($sfile, strlen($server . '/' . $repository . '/'), strlen($sfile));
                        // Создаем папку
                        if(mkdirs($dir))
                        {
                            // Забираем файл из хранилища
                            print `svn export --force -r {$revEnd} {$sfile} {$file}`;
                        }
                    }
                }
            }
        }
 
    ?>

Использовать его очень просто:
Код:
~$ export.php svn://server path/to/repository start_revision end_revision /export/path/

Источник: http://webiteam.ru/2009/03/eksport-iz-svn/


Название: SVN vs GIT vs Mercurial
Отправлено: tFF от Декабрь 31, 2010, 09:11:23
http://www.youtube.com/watch?v=4XpnKHJAok8
https://git.wiki.kernel.org/index.php/LinusTalk200705Transcript

http://blog.red-bean.com/sussman/?p=96
http://blog.red-bean.com/sussman/?p=20
http://blog.red-bean.com/sussman/?p=90

http://whygitisbetterthanx.com/


Название: Subversion Version Control Bug: attempt to write a readonly database
Отправлено: tFF от Июль 01, 2011, 21:41:03
http://geckoblue.livejournal.com/248161.html
Цитировать
I found zero help on Google when I was trying to diagnose this bug. I set up a new copy of subversion 1.6.2 and did a dump/merge of a subversion 1.4.6 database into the new system. I made a change to a file and was all set to commit the change, but when I ran a commit I got the following messages:

    [error] Could not MERGE resource "/svn/repo/!svn/act/[UUID]" into "/svn/repo/some/path". [409, #0]
    [error] An error occurred while committing the transaction. [409, #200031]
    [error] attempt to write a readonly database [409, #200031]
    [error] attempt to write a readonly database [409, #200031]


After hunting Google to no avail, I decided to examine the permissions on the repository on the subversion server. I found a .db file that did not have group write permissions (because the repository is not owned by apache). After adding group-write permission to the file "/svn/repopath/db/rep-cache.db", the error went away and normal commit behavior resumed as I originally expected. I will have to blame this on a bug in the svnadmin program which appears to not properly create the permissions on this db file.

I hope this helps the many folks out there that run linux/apache/subversion.

Subversion bug-tracker
http://subversion.tigris.org/issues/show_bug.cgi?id=3437