Autoversionamento

While the Subversion client is not a full DeltaV client, nor the Subversion server a full DeltaV server, there's still a glimmer of WebDAV interoperability to be happy about: it's called autoversioning.

Sebbene il client Subversion client non sia un client DeltaV completo, e nemmeno il server Subversion sia un server DeltaV completo, c'è ancora un barlume di interoperabilità WebDAV di cui essere felici: questo è chiamato autoversionamento.

Autoversioning is an optional feature defined in the DeltaV standard. A typical DeltaV server will reject an ignorant WebDAV client attempting to do a PUT to a file that's under version control. To change a version-controlled file, the server expects a series proper versioning requests: something like MKACTIVITY, CHECKOUT, PUT, CHECKIN. But if the DeltaV server supports autoversioning, then write-requests from basic WebDAV clients are accepted. The server behaves as if the client had issued the proper series of versioning requests, performing a commit under the hood. In other words, it allows a DeltaV server to interoperate with ordinary WebDAV clients that don't understand versioning.

L'autoversionamento è una caratteristica opzionale definita nello standard DeltaV. Un tipico server DeltaV rifiuterà un ignaro client WebDAV che tenta di fare una PUT su un file che è sotto controllo di versione. Per cambiare un file sotto controllo di versione, il server prevede una serie adeguata di richieste di versionamento: qualcosa come MKACTIVITY, CHECKOUT, PUT, CHECKIN. Ma se il server DeltaV supporta l'autoversionamento, allora le rischieste di scrittura da client base WebDAV sono accettate. Il server si comporta come se il client avesse pubblicato l'adeguata serie di richieste di versionamento, eseguendo un commit interno al sistema. In altre parole, questo permette a un server DeltaV di interoperare con i client ordinari WebDAV che non capiscono il versionamento.

Because so many operating systems already have integrated WebDAV clients, the use case for this feature borders on fantastical: imagine an office of ordinary users running Microsoft Windows or Mac OS. Each user mounts the Subversion repository, which appears to be an ordinary network folder. They use the shared folder as they always do: open files, edit them, save them. Meanwhile, the server is automatically versioning everything. Any administrator (or knowledgeable user) can still use a Subversion client to search history and retrieve older versions of data.

Dato che così tanti sistemi operativi hanno già dei client WebDAV integrati, il caso d'uso per questa caratteristica confina con il fantastico: immaginate un officio con utenti ordinari che usano Microsoft Windows o Mac OS. Ogni utente «monta» il repository Subversion, che appare essere una cartella di rete ordinaria. Utilizzano la cartella condivisa come sempre fanno: aprono file, li modificano, li salvano. Nel frattempo, il server sta automaticamente versionando ogni cosa. Ogni amministratore (o utente informato) può ancora utilizzare un client Subversion per cercare nello storico e recuperare vecchie versioni dei dati.

This scenario isn't fiction: it's real and it works, as of Subversion 1.2 and later. To activate autoversioning in mod_dav_svn, use the SVNAutoversioning directive within the httpd.conf Location block, like so:

Questo scenario non è finzione: è reale e funziona, a partire da Subversion 1.2 e successivi. Per attivare l'autoversionamento in mod_dav_svn, utilizzare la direttiva SVNAutoversioning all'interno del blocco Location in httpd.conf, in questo modo:

<Location /repos>
  DAV svn
  SVNPath /path/to/repository
  SVNAutoversioning on
</Location>

When SVNAutoversioning is active, write requests from WebDAV clients result in automatic commits. A generic log message is auto-generated and attached to each revision.

Quando SVNAutoversioning è attivo, le richieste di scritture da client WebDAV risultano in commit automatici. Un generico messaggio di log message viene generato automaticamente e attaccato ad ogni revisione.

Before activating this feature, however, understand what you're getting into. WebDAV clients tend to do many write requests, resulting in a huge number of automatically committed revisions. For example, when saving data, many clients will do a PUT of a 0-byte file (as a way of reserving a name) followed by another PUT with the real filedata. The single file-write results in two separate commits. Also consider that many applications auto-save every few minutes, resulting in even more commits.

Prima di attivare questa caratteristica, comunque, occorre capire in cosa si sta entrando. I client WebDAV tendono a fare molte richieste di scrittura, risultando in un gran numero di commit automatici di revisioni. Per esempio, quando si salvano i dati, molti client faranno un PUT di un file di 0-byte (un modo per riservare il nome) seguito da un altro PUT con i dati reali del file. La singola scrittura di file risulta in due commit separati. Inoltre considerare che molte applicazioni salvano automaticamente ogni pochi minuti, risultando in ulteriori commit aggiuntivi.

If you have a post-commit hook program that sends email, you may want to disable email generation either altogether, or on certain sections of the repository; it depends on whether you think the influx of emails will still prove to be valuable notifications or not. Also, a smart post-commit hook program can distinguish between a transaction created via autoversioning and one created through a normal svn commit. The trick is to look for a revision property named svn:autoversioned. If present, the commit was made by a generic WebDAV client.

Se si un aggancio post-commit che invia email, si potrebbe voler disabilitare la generazione di email complessivamente, o su determinate sezioni del repository; dipende se si pensa che l'influsso delle email risulterà essere ancora notifiche importanti o no. Inoltre, un programma astuto può distinguere tra una transazione creata via autoversionamento e una create attraverso un normale svn commit. Il trucco è cercare un proprietà di revisione nominata svn:autoversioned. Se presente, il commit è stato fatto da un client WebDAV generico.

Another feature that may be a useful complement for SVNAutoversioning comes from Apache's mod_mime module. If a generic WebDAV client adds a new file to the repository, there's no opportunity for the user to set the the svn:mime-type property. This might cause the file to appear as generic icon when viewed within a WebDAV shared folder, not having an association with any application. One remedy is to have a sysadmin (or other Subversion-knowledgable person) check out a working copy and manually set the svn:mime-type property on necessary files. But there's potentially no end to such cleanup tasks. Instead, you can use the ModMimeUsePathInfo directive in your Subversion <Location> block:

Un'altra caratteristica che può essere un utile complemento per SVNAutoversioning deriva dal modulo Apache mod_mime. Se un client WebDAV generico aggiunge un nuovo file al repository, non ci sono opportunità per l'utente di impostare la proprietà svn:mime-type. Questo può causare che il file appaia con un'icona «generica» quando visualizzato all'interno di una cartella condivisa WebDAV, non avendo un'associato con alcuna applicazione. Un rimedio chiedere ad un amministratore di sistema (o altra persona che conosce Subversion) di fare il check out di una copia di lavoro ed impostare manualmente la proprietà svn:mime-type sui file necessari. Ma potrebbe potenzialmente non esserci una fine a questi compiti di pulizia. Invece, si può utilizzare la direttiva ModMimeUsePathInfo nel proprio blocco Subversion <Location>:

<Location /repos>
  DAV svn
  SVNPath /path/to/repository
  SVNAutoversioning on

  ModMimeUsePathInfo on

</Location>

This directive allows mod_mime to attempt automatic deduction of the mime-type on new files that enter the repository via autoversioning. The module looks at the file's named extension and possibly the contents as well; if the file matches some common patterns, then the the file's svn;mime-type property will be set automatically.

Questa direttiva permette a mod_mime di provare a dedurre automaticamente il mime-type del nuovo file che entra nel repository via autoversionamento. Il modulo cerca nell'estensione del nome del file e possibilmente anche nei contenuti; se il file corrisponde a qualche modello comune, allora la proprietà del file svn;mime-type verrà impostata automaticamente.