Archive for the ‘Subversion’ Category

Continuous Integration: some posts

Martin Fowler: Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily – leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.

Some posts about Continuous Integration for further reading:

Continuous Integration
How and why do I set up a C# build machine?
Best Continuous Integration Setup for a solo developer (.NET) [closed]
Continuous Integration for Everybody

Anuncios

Subversion: Edit log message

@ECHO OFF
:: Set up the list of possible parameters.
set repository=%1
set revision=%2
set userName=%3
set propertyName=%4
set action=%5

:: Allow the log message itself to be changed.
if /I not "%propertyName%" == "svn:log" goto ERROR_PROPNAME

:: Allow modification of a log message, not addition or deletion.
if /I not "%action%" == "M" goto ERROR_ACTION

:: Make sure that the changed svn:log message is not null.
set bIsEmpty=true
for /f "tokens=*" %%g in ('find /V ""') do (
set bIsEmpty=false
)
if "%bIsEmpty%" == "true" goto ERROR_EMPTY

goto :eof

:ERROR_EMPTY
echo Empty svn:log messages are not allowed. >&2
goto ERROR_EXIT

:ERROR_PROPNAME
echo Only changes to svn:log messages are allowed. >&2
goto ERROR_EXIT

:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT

:ERROR_EXIT
exit /b 1

References:

Windows and SVN hooks
SVN pre-revprop-change hook scripts for Linux and Windows
pre-revprop-change hook using batch files on Windows
How do I change the log message for a revision after it’s been committed?
what is a pre-revprop-change hook in SVN and how do I create it?
Edit a subversion log message
How do I edit a log message that I already committed in Subversion?

NAnt: .Net automated builds

Official site

Fundamentals

Build files

Example build file for HelloWorld project:

    <?xml version="1.0"?>
    <project name="Hello World" default="build" basedir=".">
        <description>The Hello World of build files.</description>
        <property name="debug" value="true" overwrite="false" />
        <target name="clean" description="remove all generated files">
            <delete file="HelloWorld.exe" failonerror="false" />
            <delete file="HelloWorld.pdb" failonerror="false" />
        </target>
        <target name="build" description="compiles the source code">
            <csc target="exe" output="HelloWorld.exe" debug="${debug}">
                <sources>
                    <includes name="HelloWorld.cs" />
                </sources>
            </csc>
        </target>
    </project>

 

More references:

Installing NAnt to drive database continuous integration by David Atkinson

How to build a database from source control by David Atkinson

The DCI Architecture: A New Vision of Object-Oriented Programming

Post here by Trygve Reenskaug and James O. Coplien
March 20, 2009

Object-oriented programming was supposed to unify the perspectives of the programmer and the end user in computer code: a boon both to usability and program comprehension. While objects capture structure well, they fail to capture system action. DCI is a vision to capture the end user cognitive model of roles and interactions between them.

Subversion: poner un proyecto bajo control de código fuente

Tengo un proyecto de una aplicación web ASP.Net en una carpeta (E:\MyWebApp) en mi PC.
Quiero ponerlo bajo control de código fuente usando Subversion.

Alternativa 1 (larga, carpeta vacía):

  1. Crear una carpeta vacía (E:\MyEmptyWebApp) en mi PC.
  2. Importar la carpeta vacía  (E:\MyEmptyWebApp) al repositorio: click derecho, TortoiseSVN->Import.
  3. En URL of Repository, escribir: svn://192.168.10.20/MyWebApp. Presionar OK.
  4. Ir a la carpeta que contiene la aplicación (E:\MyWebApp)  y los archivos de código fuente.
  5. Click derecho, SVN Checkout.
  6. En URL of Repository, escribir: svn://192.168.10.20/MyWebApp.
  7. En checkout directory, escribir: E:\MyWebApp. Presionar OK.
  8. Esto solo copiará la carpeta oculta “.svn” a la carpeta E:\MyWebApp.
  9. De esta forma, el proyecto estará bajo control de código fuente. Sin embargo, el repositorio está vacío aún.
  10. Ahora, agregar los archivos de la carpeta E:\MyWebApp al repositorio.
  11. Dentro de la carpeta E:\MyWebApp, seleccionar todas las carpetas y archivos, hacer click derecho y elegir la opción TortoiseSVN->Add.
  12. Click derecho en la carpeta E:\MyWebApp, SVN Commit.
  13. Listo.

Como se puede apreciar, la clave está en crear una carpeta vacía e importarla (Tortoise->Import) al repositorio. Esto genera la carpeta “.svn” con las configuraciones de control de versiones de Subversion.

Luego, hacemos un “Checkout” (SVN Checkout) del repositorio (vacío) a la carpeta (working copy)  que contiene realmente el proyecto. Esto simplemente agrega la carpeta “.svn” a la copia local.

Finalmente, se deben agregar (TortoiseSVN->Add) los archivos locales al repositorio y hacer un SVN Commit.

 

Alternativa 2 (corta, recomendable):

  1. Click derecho en E:\MyWebApp, TortoiseSVN->Repo-browser.
  2. Crear una carpeta llamada “MyWebApp” en la ruta deseada en el repositorio: click derecho, “Create folder“. Esto crea una carpeta vacía en el repositorio.
  3. Click derecho en E:\MyWebApp, SVN Checkout. Esto descarga el contenido del repositorio (vacío aún) y coloca la carpeta bajo control de versiones de Subversion.
  4. Dentro de la carpeta E:\MyWebApp, seleccionar los archivos y carpetas deseados.
  5. Click derecho, TortoiseSVN->Add. Esto indica que los archivos y carpetas seleccionados serán puestos bajo control de versiones de Subversion.
  6. Click derecho en E:\MyWebApp, SVN Commit. Esto coloca el proyecto completo bajo control de versiones de Subversion.

 

Referencias:

SVN in-place import and checkout

Importing Data Into A Repository

Adding Projects and Files to Source Control

Subversion and Mercurial

Having  used both Subversion and Mercurial, I think the best starting points so you can get your own conclusions about them are these posts:

Subversion: [Setting up and running Subversion and Tortoise SVN with Visual Studio and .NET][1]

Mercurial: [Hg Init: a Mercurial tutorial][2]

In short, Mercurial is a distributed version control system, while Subversion is a centralized one.

On Subversion, you “commit” and “update” directly to/from the central and unique repository.

On Mercurial, you “commit” and “update” to your local personal repository. Once you’re sure your code is ready, you can “push” your changes to the central repository. To get other people changes, you have to “pull” from the central repository.

[1]: http://www.west-wind.com/presentations/subversion/
[2]: http://hginit.com/index.html

The Joel Test: 12 Steps to Better Code

A list of yes/no questions to measure how good your software team is working

The Joel Test: 12 Steps to Better Code

  1. Do you use source control?
  2. Can you make a build in one step?
  3. Do you make daily builds?
  4. Do you have a bug database?
  5. Do you fix bugs before writing new code?
  6. Do you have an up-to-date schedule?
  7. Do you have a spec?
  8. Do programmers have quiet working conditions?
  9. Do you use the best tools money can buy?
  10. Do you have testers?
  11. Do new candidates write code during their interview?
  12. Do you do hallway usability testing?