Manuals

Annexe D. Automatiser TortoiseSVN

Table des matières

Commandes de TortoiseSVN
Tsvncmd URL handler
Commandes de TortoiseIDiff
Commandes TortoiseUDiff

Puisque toutes les commandes pour TortoiseSVN sont contrôlées par des paramètres de ligne de commande, vous pouvez l'automatiser avec des scripts batch ou démarrer des commandes spécifiques et des boîtes de dialogues depuis d'autres programmes (par exemple votre éditeur de texte favori).

Important

Souvenez-vous que TortoiseSVN est un client GUI et ce guide d'automatisation vous montre comment faire les boîtes de dialogues de TortoiseSVN apparaissent pour collecter les entrées utilisateur. Si vous voulez écrire un script qui n'exige aucune entrée, vous devriez utiliser le client en ligne de commande Subversion officiel à la place.

Commandes de TortoiseSVN

Le programme GUI de TortoiseSVN s'appelle TortoiseProc.exe. Toutes les commandes sont spécifiées avec le paramètre /command:abcdabcd est le nom de la commande requise. La plupart de ces commandes ont besoin d'au moins un argument de chemin, que l'on donne avec /path:"un\chemin". Dans la table suivante, la commande fait référence au paramètre /command:abcd et le chemin se réfère au paramètre /path:"un\chemin".

There's a special command that does not require the parameter /command:abcd but, if nothing is specified on the command line, starts the project monitor instead. If /tray is specified, the project monitor starts hidden and only adds its icon to the system tray.

Puisque certaines des commandes peuvent prendre une liste de chemins cibles (par exemple livrer plusieurs fichiers spécifiques) le paramètre /path peut prendre plusieurs chemins, séparés par un caractère *.

You can also specify a file which contains a list of paths, separated by newlines. The file must be in UTF-16 format, without a BOM. If you pass such a file, use /pathfile instead of /path. To have TortoiseProc delete that file after the command is finished, you can pass the parameter /deletepathfile. If you don't pass /deletepathfile, you have to delete the file yourself or the file gets left behind.

D'habitude, la barre de progression utilisée pour les livraisons, les mises à jour et beaucoup d'autres commandes reste ouverte après que la commande ait fini et jusqu'à ce que l'utilisateur appuie sur le bouton OK. Ce comportement peut être modifié en cochant l'option correspondante dans la boîte de dialogue de configuration. Mais ainsi la barre de progression se fermera à la fin de l'opération, que vous ayez lancé la commande depuis un fichier batch ou depuis le menu contextuel TortoiseSVN.

Pour spécifier un emplacement différent du fichier de configuration, utilisez le paramètre /configdir:"chemin\vers\répertoire\de\conf". Cela remplacera le chemin par défaut, y compris tous les paramètres de la base de registre.

Pour fermer la boîte de dialogue de progression automatiquement à la fin d'une commande sans utiliser le réglage permanent, vous pouvez lui passer le paramètre /closeonend.

  • /closeonend:0 ne ferme pas la boîte de dialogue automatiquement

  • /closeonend:1 ferme automatiquement s'il n'y a pas d'erreurs

  • /closeonend:2 ferme automatiquement s'il n'y a pas d'erreurs ni de conflits

  • /closeonend:2 ferme automatiquement s'il n'y a pas d'erreurs, de conflits ni de fusions

Pour fermer la boîte de dialogue de progression pour des opérations locales, s'il n'ya eu aucune erreur ni conflit, passez le paramètre /closeforlocal.

Le tableau ci-dessous liste toutes les commandes qui peuvent être accessibles en utilisant la ligne de commande TortoiseProc.exe. Comme décrit ci-dessus, celles-ci devraient être de la forme /command:abcd. Dans le tableau, le préfixe /command est omis pour économiser de la place.

Tableau D.1. Liste des commandes et des options disponibles

CommandeDescription
:aboutAffiche la boîte de dialogue d'À propos. Elle s'affiche aussi si aucune commande n'est fournie.
:log

Opens the log dialog. The /path specifies the file or folder for which the log should be shown. Additional options can be set:

  • /startrev:xxx,

  • /endrev:xxx,

  • /limit:xxx limits the amount of fetched messages

  • /strict enables the 'stop-on-copy' checkbox,

  • /merge enables the 'include merged revisions' checkbox,

  • /datemin:"{datestring}" sets the start date of the filter, and

  • /datemax:"{datestring}" sets the end date of the filter. The date format is the same as used for svn date revisions.

  • /findstring:"filterstring" fills in the filter text,

  • /findtext forces the filter to use text, not regex, or

  • /findregex forces the filter to use regex, not simple text search, and

  • /findtype:X with X being a number between 0 and 511. The numbers are the sum of the following options:

    • /findtype:0 tout filtrer

    • /findtype:1 filtrer par messages

    • /findtype:2 filtrer par chemin

    • /findtype:4 filtrer par auteurs

    • /findtype:8 filtrer par révision

    • /findtype:16 non utilisé

    • /findtype:32 filtre par ID de bug

    • /findtype:64 non utilisé

    • /findtype:128 filtre par date

    • /findtype:256 filtre par intervalle de date

  • If /outfile:path\to\file is specified, the selected revisions are written to that file when the log dialog is closed. The revisions are written in the same format as is used to specify revisions in the merge dialog.

An svn date revision can be in one of the following formats:

  • {2006-02-17}

  • {15:30}

  • {15:30:00.200000}

  • {"2006-02-17 15:30"}

  • {"2006-02-17 15:30 +0230"}

  • {2006-02-17T15:30}

  • {2006-02-17T15:30Z}

  • {2006-02-17T15:30-04:00}

  • {20060217T1530}

  • {20060217T1530Z}

  • {20060217T1530-0500}

:checkout

Opens the checkout dialog. The /path specifies the target directory and the /url specifies the URL to checkout from. If you specify the key /blockpathadjustments, the automatic checkout path adjustments are blocked. The /revision:XXX specifies the revision to check out.

If you specify /outfile:"path/to/file" the specified file will contain three lines after a checkout. The first line is the checkout path, the second line the url and the third the revision.

:importOpens the import dialog. The /path specifies the directory with the data to import. You can also specify the /logmsg switch to pass a predefined log message to the import dialog. Or, if you don't want to pass the log message on the command line, use /logmsgfile:chemin, where chemin points to a file containing the log message.
:updateUpdates the working copy in /path to HEAD. If the option /rev is given then a dialog is shown to ask the user to which revision the update should go. To avoid the dialog specify a revision number /rev:1234. Other options are /nonrecursive, /ignoreexternals and /includeexternals. The /stickydepth indicates that the specified depth should be sticky, creating a sparse checkout. The /skipprechecks can be set to skip all checks that are done before an update. If this is specified, then the Voir le journal button is disabled, and the context menu to show diffs is also disabled after the update.
:commitOuvre la boîte de dialogue de livraison. Le /path spécifie le répertoire cible ou la liste des fichiers à livrer. Vous pouvez aussi spécifier le commutateur /logmsg pour passer un commentaire prédéterminé à la boîte de dialogue de livraision. Ou, si vous ne voulez pas passer le commentaire via la ligne de commande, utilisez /logmsgfile:chemin, où chemin pointe sur un fichier contenant le commentaire. Pour préremplir le champ d'ID de bug (dans le cas où vous avez défini correctement la propriété d'intégration aux traqueurs de bug), vous pouvez utiliser le /bugid: "l'id du bug ici".
:addAjoute les fichiers de /path au contrôle de version.
:revertAnnule les modifications locales d'une copie de travail. Le /path indique quels éléments annuler.
:cleanupCleans up interrupted or aborted operations and unlocks the working copy in /path. You also have to pass the /cleanup to actually do the cleanup. Use /noui to prevent the result dialog from popping up (either telling about the cleanup being finished or showing an error message). /noprogressui also disables the progress dialog. /nodlg disables showing the cleanup dialog where the user can choose what exactly should be done in the cleanup. The available actions can be specified with the options /cleanup for status cleanup, /breaklocks to break all locks, /revert to revert uncommitted changes, /delunversioned, /delignored, /refreshshell, /externals, /fixtimestamps and /vacuum.
:resolveMarque un fichier en conflit indiqué dans /path comme résolu. Si /noquestion est donné, alors la résolution est faite sans demander d'abord à l'utilisateur si cela doit être vraiment fait.
:repocreateCrée un dépôt dans /path
:switchOuvre la fenêtre de dialogue . Le /path spécifie le répertoire cible et /urll'URL vers lequel se fera le changement.
:exportExporter la copie de travail dans /path dans un autre répertoire. Si le /path pointe vers un répertoire non versionné, une boîte de dialogue vous demandera une URL à l'exportation vers le répertoire dans /path . Si vous spécifiez la clé /blockpathadjustments , Les ajustements automatiques du chemin d'exportation sont bloquées.
:dropexportExports the working copy in /path to the directory specified in /droptarget. This exporting does not use the export dialog but executes directly. The option /overwrite specifies that existing files are overwritten without user confirmation, and the option /autorename specifies that if files already exist, the exported files get automatically renamed to avoid overwriting them. The option /extended can specify either modifications locales to only export files that got changed locally, or non versionnés to also export all unversioned items as well.
:dropvendorCopies the folder in /path recursively to the directory specified in /droptarget. New files are added automatically, and missing files get removed in the target working copy, basically ensuring that source and destination are exactly the same. Specify /noui to skip the confirmation dialog, and /noprogressui to also disable showing the progress dialog.
:mergeOpens the merge dialog. The /path specifies the target directory. For merging a revision range, the following options are available: /fromurl:URL, /revrange:string. For merging two repository trees, the following options are available: /fromurl:URL, /tourl:URL, /fromrev:xxx and /torev:xxx.
:mergeallOuvre la fenêtre fusionner tout. Le /path spécifie le répertoire cible.
:copyBrings up the branch/tag dialog. The /path is the working copy to branch/tag from. And the /url is the target URL. If the urls starts with a ^ it is assumed to be relative to the repository root. To already check the option Basculer la copie de travail vers une nouvelle branche/un nouveau marqueur you can pass the /switchaftercopy switch. To check the option Créer des dossiers intermédiaires pass the /makeparents switch. You can also specify the /logmsg switch to pass a predefined log message to the branch/tag dialog. Or, if you don't want to pass the log message on the command line, use /logmsgfile:chemin, where chemin points to a file containing the log message.
:settingsOuvre la boîte de dialogue de configuration.
:removeSupprime les fichiers dans /path du contrôle de version.
:renameRenomme le fichier dans /path. Le nouveau nom pour le fichier est demandé par une boîte de dialogue. Pour éviter la question concernant le renommage de fichiers similaires en une étape, passez /noquestion.
:diffStarts the external diff program specified in the TortoiseSVN settings. The /path specifies the first file. If the option /path2 is set, then the diff program is started with those two files. If /path2 is omitted, then the diff is done between the file in /path and its BASE. If the specified file also has property modifications, the external diff tool is also started for each modified property. To prevent that, pass the option /ignoreprops. To explicitly set the revision numbers use /startrev:xxx and /endrev:xxx, and for the optional peg revision use /pegrevision:xxx. If /blame is set and /path2 is not set, then the diff is done by first blaming the files with the given revisions. The parameter /line:xxx specifies the line to jump to when the diff is shown.
:shelveShelves the specified paths in a new shelf. The option /shelfname:name specifies the name of the shelf. An optional log message can be specified with /logmsg:message. If option /checkpoint is passed, the modifications of the files are kept.
:unshelveApplies the shelf with the name /shelfname:name to the working copy path. By default the last version of the shelf is applied, but you can specify a version with /version:X.
:showcompare

Selon les URL et les versions à comparer, ceci affiche soit un contenu unifié des différences (si l'option unifié est utilisée), soit une boîte de dialogue avec une liste de fichiers qui ont changé, soit, si les URL pointent vers les fichiers de démarrage, lance le visualisateur de différence pour ces deux fichiers.

Les options url1, url2, revision1 et revision2 doivent être précisées. Les options pegrevision, ignoreancestry, blame et unified sont facultatives.

If the specified url also has property modifications, the external diff tool is also started for each modified property. To prevent that, pass the option /ignoreprops.

If a unified diff is requested, an optional prettyprint option can be specified which will show the merge-info properties in a more user readable format.

:conflicteditorDémarre l'éditeur de conflit indiqué dans la configuration de TortoiseSVN avec les fichiers corrects pour le fichier en conflit dans /path.
:relocateOuvre la boîte de dialogue Relocaliser. Le /path spécifie le chemin de la copie de travail à relocaliser.
:helpOuvre le fichier d'aide.
:repostatusOuvre la boîte de dialogue de vérification des modifications. Le /path indique le répertoire de la copie de travail. Si /remote est spécifié, la boite de dialogue contacte le dépôt directement au démarrage, au moment où l'utilisateur clique sur le bouton Vérifier le dépôt.
:repobrowser

Starts the repository browser dialog, pointing to the URL of the working copy given in /path or /path points directly to an URL.

Une option additionnelle /rev:xxx peut être utilisée pour spécifier la révision que l'explorateur de dépôt doit afficher. Si l'option /rev:xxx est omise, elle prend la valeur HEAD par défaut.

Si /path pointe vers une URL, /projectpropertiespath:chemin/vers/copie/de/travail spécifie le chemin à partir duquel lire et utiliser les propriétés de projet.

If /outfile:path\to\file is specified, the selected URL and revision are written to that file when the repository browser is closed. The first line in that text file contains the URL, the second line the revision in text format.

:ignoreAjoute toutes les cibles dans /path à la liste des éléments ignorés, c'est-à-dire ajoute le svn:ignore à ces fichiers.
:blame

Ouvre la fenêtre de bannissement pour le fichier spécifier dans /path.

Si les options /startrev et /endrev sont précisées, la fenêtre permettant de spécifier la plage de révisions à bannir n'est pas affichée, ces valeurs des révisions sont utilisées à la place.

Si cette option est renseignée /line:nnn, TortoiseBlame ouvrira en affichant la nième ligne.

Les options /ignoreeol, /ignorespaces et /ignoreallspaces sont également supportées.

:catEnregistre un fichier depuis une URL ou depuis un chemin de la copie de travail donné dans /path à l'emplacement donné dans /savepath:chemin. La révision est donnée dans /revision:xxx. Cela peut être utilisé pour obtenir un fichier avec une révision spécifique.
:createpatchCreates a patch file for the path given in /path. To skip the file Save-As dialog you can pass /savepath:chemin to specify the path where to save the patch file to directly. To prevent the unified diff viewer from being started showing the patch file, pass /noview. If a unified diff is requested, an optional prettyprint option can be specified which will show the merge-info properties in a more user readable format.
:revisiongraph

Montre le graphe de révision pour le chemin donné dans /path.

To create an image file of the revision graph for a specific path, but without showing the graph window, pass /output:path with the path to the output file. The output file must have an extension that the revision graph can actually export to. These are: .svg, .wmf, .png, .jpg, .bmp and .gif.

Since the revision graph has many options that affect how it is shown, you can also set the options to use when creating the output image file. Pass these options with /options:XXXX, where XXXX is a decimal value. The best way to find the required options is to start the revision graph the usual way, set all user-interface options and close the graph. Then the options you need to pass on the command line can be read from the registry HKCU\Software\TortoiseSVN\RevisionGraphOptions.

:lockVerrouille un ou tous les fichiers dans un répertoire donné dans /path. La boîte de dialogue 'Verrouiller' s'affiche afin de permettre à l'utilisateur d'entrer un commentaire pour le verrou.
:unlockDéverrouille un fichier ou tous les fichiers d'un répertoire donné dans /path.
:rebuildiconcacheReconstruit le cache d'icône Windows. Utilisez-le seulement dans le cas où les icônes Windows sont corrompues. Un effet secondaire à cela (qui ne peut être évité) est que les icônes sur le bureau sont réarrangées. Pour supprimer la fenêtre d'information, passez /noquestion.
:properties

Shows the properties dialog for the path given in /path.

Pour traiter les propriétés versionnées, cette commande requiert une copie de travail.

Revision properties can be viewed/changed if /path is an URL and /rev:XXX is specified.

To open the properties dialog directly for a specific property, pass the property name as /property:name.

:sync

Exports/imports settings, either depending on whether the current settings or the exported settings are newer, or as specified.

If a path is passed with /path, then the path is used to store or read the settings from.

The parameter /askforpath will show a file open/save dialog for the user to chose the export/import path.

If neither /load nor /save is specified, then TortoiseSVN determines whether to export or import the settings by looking at which ones are more recent. If the export file is more recent than the current settings, then the settings are loaded from the file. If the current settings are more recent, then the settings are exported to the settings file.

If /load is specified, the settings are imported from the settings file.

Si /save est spécifié, alors les paramètres utilisés actuellement seront exportés dans le fichier de configuration.

Le paramètre /local est spécifié, alors les paramètres utilisés actuellement seront exportés dans le fichier de configuration.


Exemples (qui devraient être saisis sur une ligne):

TortoiseProc.exe /command:commit                 /path:"c:\svn_ct\fichier1.txt*c:\svn_ct\fichier2.txt"
                 /logmsg:"message de log de test" /closeonend

TortoiseProc.exe /command:update /path:"c:\svn_ct\" /closeonend

TortoiseProc.exe /command:log /path:"c:\svn_ct\fichier1.txt"
                 /startrev:50 /endrev:60 /closeonend

TortoiseSVN homepage