rem =========================================================================== rem Tutoriel SubVersion rem Ce fichier de commande Windows illustre l'usage des principales commandes de rem SubVersion pour la gestion de révisions. rem (c) Didier Donsez, 2007 rem =========================================================================== rem Telecharger SubVersion pour Windows depuis http://subversion.tigris.org rem Installer (Unzip %SVN_HOME% rem set SVN_HOME=c:\devtools\svn-win32-1.4.4 rem puis set PATH=%PATH%;%SVN_HOME%\bin rem Démarrer -> Exécuter -> Taper "cmd" rem en parallele des commandes en ligne, vous pouvez utiliser le client Windows TortoiseSVN disponible gratuitement sur http://www.tortoisesvn.org/ rem Aide des principales commandes svn help svnadmin help svnlook help svndumpfilter help svnserve help svn --version cd c:\ rem Creation du dépôt mkdir repository svnadmin create repository rem svnadmin create repository --fs-type fsfs dir repository rem Creation d'un projet hello a partir d'un archetype Maven (@see http://www.sonatype.com/book/archetypes.html#using) mvn archetype:create -DgroupId=demo.svn -DartifactId=hello rem Importation des fichier du projet hello dans le dépôt svn import hello file:///c:/repository/hello --message "initial import" svnlook youngest repository svnlook tree repository rem Création d'une copie de travail (checkout) mkdir workingcopy1 svn checkout file:///c:/repository/hello workingcopy1 rem Ajout et Suppression de fichiers echo This is a readme file > workingcopy1\LISEZMOI.txt svn status workingcopy1\LISEZMOI.txt svn add workingcopy1\LISEZMOI.txt svn status workingcopy1\LISEZMOI.txt svn commit workingcopy1\LISEZMOI.txt --message "add a readme file" svn delete workingcopy1\LISEZMOI.txt svn status workingcopy1\LISEZMOI.txt svn commit workingcopy1\LISEZMOI.txt --message "delete a readme file" rem Renommer un fichier dans la copie de travail echo This is a readme file > workingcopy1\LISEZMOI.txt svn commit workingcopy1 --message "add a readme file" svn rename workingcopy1\LISEZMOI.txt workingcopy1\README.txt svn status workingcopy1 svn commit workingcopy1 --message "add the readme file" rem Modification d'un fichier dans la copie de travail echo Contributors: >> workingcopy1\README.txt type workingcopy1\README.txt rem par exemple, ajoutez votre nom des contributeurs dans le commentaire de la classe svn status workingcopy1\README.txt --verbose Partager les modifications (commit) svn commit workingcopy1 --message "first modification" rem Inspection des logs svn log workingcopy1 svn update workingcopy1 svn log workingcopy1 rem Editions concurrences svn update workingcopy1\README.txt rem modifiez le nom de l'auteur echo didier >> workingcopy1\README.txt type workingcopy1\README.txt svn update workingcopy1\README.txt rem modifiez le nom de l'auteur echo donsez >> workingcopy2\README.txt svn status workingcopy1 svn status workingcopy2 svn commit workingcopy1 --message "second modification" svn commit workingcopy2 --message "second modification" rem Traitement du conflit entre plusieurs rédacteurs par un "merge" manuellement svn update workingcopy2 dir workingcopy2 svn status workingcopy2\README.txt --verbose type workingcopy2\README.txt rem edit workingcopy2\README.txt echo This is a readme file > workingcopy2\README.txt echo Contributor: didier donsez > workingcopy2\README.txt del workingcopy2\README.txt.mine del workingcopy2\README.txt.r* svn resolved workingcopy2\README.txt svn commit workingcopy2 --message "third modification" rem Revenir en arrière svn update workingcopy1 edit workingcopy1\src\test\java\demo\svn\AppTest.java svn status workingcopy1\src\test\java\demo\svn\AppTest.java svn diff workingcopy1\src\test\java\demo\svn\AppTest.java svn revert workingcopy1\src\test\java\demo\svn\AppTest.java rem Récupérer une ancienne révision svn checkout workingcopy1 file:///c:/repository/hello@1 rem Création d'une autre copie de travail à partir de la révision 1 mkdir workingcopy3 svn checkout file:///c:/repository/hello workingcopy3 --revision 1 rem Checkout de l'autre copie de travail à partir de la dernière révision (HEAD) svn checkout file:///c:/repository/hello workingcopy2 --revision HEAD svn status workingcopy1 rem Ajout de propriétés svn propset foo "bar" workingcopy1 svn propset tic "tac toe" workingcopy1 svn propedit foo workingcopy1 svn propedit svn:ignore workingcopy1 svn propdel tic workingcopy1 rem Edition d'un log svn log workingcopy1 -r 1 svn propset svn:log 'initial import by Didier' -r1 --revprop file:///c:/repository/hello echo initial import by Didier > log.r1.txt svnadmin setlog c:\repository -r1 log.r1.txt --bypass-hooks svn log workingcopy1 -r 1 del log.r1.txt rem Ajout de svn:ignore svn propedit svn:ignore workingcopy1 rem ajoutez target .project .classpath svn propget svn:ignore workingcopy1 svn commit workingcopy1 cd workingcopy1 mvn clean install rem Pose de verrou svn lock workingcopy1\pom.xml -m "Editing file for tomorrow's release." svn status workingcopy1 svn info workingcopy1\pom.xml svn info file:///c:/repository/hello/pom.xml rem Recherche et forcer les verrous svnadmin lslocks c:\repository svnadmin rmlocks c:\repository /hello/pom.xml svn info file:///c:/repository/hello/pom.xml rem Lock/Modify/Unlock (à la RCS) svn lock workingcopy1\pom.xml -m "Editing file for tomorrow's release." edit workingcopy1\pom.xml svn unlock workingcopy1\pom.xml svn commit workingcopy1 svn info file:///c:/repository/hello/pom.xml rem Ajout de mots clé substituables (Keyword substitution) echo $Id$ $HeadURL$ $Rev$ $Author$ $Date$ >> workingcopy1\README.txt type workingcopy1\README.txt rem Ajouter les appels aux mots clé $Id$ $HeadURL$ $Rev$ $Author$ $Date$ dans les commentaires svn propset svn:keywords "Id Rev HeadURL Date Author" workingcopy1\README.txt svn commit workingcopy1 svn update workingcopy1 type workingcopy1\README.txt rem Création du layout trunk/tags/branches svn mkdir workingcopy1\trunk svn mkdir workingcopy1\branches svn mkdir workingcopy1\tags svn move workingcopy1\src workingcopy1\trunk svn move workingcopy1\target workingcopy1\trunk svn move workingcopy1\pom.xml workingcopy1\trunk svn commit workingcopy1 rem Création d'un tag 1.0 à partir de la revision HEAD svn copy file:///c:/repository/hello/trunk file:///c:/repository/hello/tags/release-1.0 -m "Tagging the 1.0 release of the 'hello' project." svn update workingcopy1 rem Création d'une branche java5 à partir de la revision HEAD svn copy file:///c:/repository/hello/trunk file:///c:/repository/hello/branches/java5 -m "Branching the java5 implementation of the 'hello' project." svn update workingcopy1 rem Modifiez le pom.xml selon http://java.developpez.com/faq/maven/?page=utilisation#compilation1 svn commit workingcopy1 rem switch rem Inspection d'ancienne revision svn cat workingcopy1\pom.xml -r 1 svn blame workingcopy1\pom.xml -r 1 rem Création de patch svn diff workingcopy1 -r 1:2 > hello.r1-2.patch rem Application d'un path TODO sous Unix ou sous CygWin, la commande patch TODO sous Windows, les commandes ExamDiff, KDiff3, WinMerge, Araxis compare svn diff --diff-cmd /usr/bin/diff --extensions '-i' README.txt rem Création d'un dump svnadmin dump repository > repository.svndump rem Création d'un nouveau dépot partiel (utilisant FSFS) à partir du dump svndumpfilter include hello/trunk --drop-empty-revs --renumber-revs < repository.svndump > hello-trunk.svndump svnadmin create hellorepo --fs-type fsfs svnadmin load hellorepo < hello-trunk.svndump rem Operations de maintenance svnadmin crashtest repository svnadmin recover repository rem ======== rem svnserve rem lire http://tortoisesvn.net/docs/release/TortoiseSVN_fr/tsvn-serversetup-svnserve.html rem ======== rem Lancement svnserve comme un deamon edit repository\conf\svnserve.conf edit repository\conf\passwd edit repository\conf\authz svnserve --deamon --root repository ^C rem Lancement de svnserve comme un service NT (http://tortoisesvn.net/docs/nightly/TortoiseSVN_fr/tsvn-serversetup-svnserve.html) sc create svn binpath= "E:\devtools\svn-win32-1.4.4\bin\svnserve.exe --service --root G:\repository" displayname= "Subversion Server" depend= Tcpip start= auto sc query svn rem Création d'une autre copie de travail mkdir workingcopy3 svn checkout svn://localhost/hello workingcopy3 rem Arrêt et Suppression du service NT svn sc stop svn sc delete svn rem ======== rem svn via un tunnel SSH (svn+ssh) rem ======== rem Download and install Putty.zip set PATH=%PATH%;c:\putty set PLINK_PROTOCOL=ssh set SVN_SSH=plink.exe svn checkout svn+ssh://username@svn.forge.objectweb.org/svnroot/ecom rem ======================= rem Apache v2 + mod_dav-svn rem ======================= TODO rem Exporter un depot svn copy file:///c:/repository/hello/trunk trunk.export rem ======================= rem Statistiques rem ======================= rem Telechargez et installez StatSVN http://wiki.statsvn.org/ rem Générez le rapport d'activité du projet svn co svn://server/repo/trunk/modulename svn log -v --xml > logfile.log java -jar /path/to/statsvn.jar /path/to/module/logfile.log /path/to/module