File binari e traduzioni

In the most general sense, Subversion handles binary files more gracefully than CVS does. Because CVS uses RCS, it can only store successive full copies of a changing binary file. Subversion, however, expresses differences between files using a binary-differencing algorithm, regardless of whether they contain textual or binary data. That means that all files are stored differentially (compressed) in the repository.

Nel senso più generale, Subversion gestisce i file binari con più garbo di come lo faccia CVS. Dato che CVS utilizza RCS, può solamente immagazzinare copie successive complete di un file binario modificato. Subversion, comunque, fa uscire le differenze tra i file utilizzando un algoritmo di differenza binaria, senza tener conto se questi contengono dati testuali o binari. Questo significa che tutti i file sono immagazzinati nel repository in modo differenziale (compressi).

CVS users have to mark binary files with -kb flags, to prevent data from being garbled (due to keyword expansion and line-ending translations). They sometimes forget to do this.

Gli utenti CVS devono marcare i file binari con indicatori -kb, per impedire che i dati vengano alterati (a causa di espansioni di parole chiave o conversioni della fine linea). A volte si dimenticano di farlo.

Subversion takes the more paranoid route—first, it never performs any kind of keyword or line-ending translation unless you explicitly ask it do so (see sezione chiamata «svn:parolechiave» and sezione chiamata «svn:eol-stile» for more details). By default, Subversion treats all file data as literal byte strings, and files are always stored in the repository in an untranslated state.

Subversion usa la strada più paranoica—primo, non effettua mai nessun tipo di traduzione di parola chiave performs o fine riga a meno che non gli venga chiesto eplicitamente di farlo (vedere sezione chiamata «svn:parolechiave» e sezione chiamata «svn:eol-stile» per maggiori dettagli). In modo predefinito, Subversion tratta tutti i file di dati come una stringa di byte letterali, e i file sono sempre immagazzinati nel repository in uno stato non tradotto.

Second, Subversion maintains an internal notion of whether a file is text or binary data, but this notion is only extant in the working copy. During an svn update, Subversion will perform contextual merges on locally modified text files, but will not attempt to do so for binary files.

Secondo, Subversion mantiene una nozione interna del fatto che un file sia di dati «testo» o «binari», ma questa nozione è solamente esistente nella copia di lavoro. Durante un svn update, Subversion effettuerà fusioni contestuali sui file di testo modificati localmente, ma non tenterà di farlo per i file binari.

To determine whether a contextual merge is possible, Subversion examines the svn:mime-type property. If the file has no svn:mime-type property, or has a mime-type that is textual (e.g. text/*), Subversion assumes it is text. Otherwise, Subversion assumes the file is binary. Subversion also helps users by running a binary-detection algorithm in the svn import and svn add commands. These commands will make a good guess and then (possibly) set a binary svn:mime-type property on the file being added. (If Subversion guesses wrong, the user can always remove or hand-edit the property.)

Per determinare se una fusione contestuale sia possibile, Subversion esamina la proprietà svn:mime-type. Se il file non ha la proprietà svn:mime-type, o se ha un mime-type che è testuale (es. text/*), Subversion assume che sia testo. Altrimenti, Subversion assume che il file sia binario. Subversion inoltre aiuta gli utenti eseguendo un algoritmo di rilevamento binario nei comandi svn import e svn add. Questi comandi faranno una buona congettura e poi (possibilmente) imposteranno una proprietà binaria svn:mime-type sul file che sta per essere aggiunto. (Se Subversion sbaglierà a fare la congettura, l'utente potrà sempre rimuovere o gestire manualmente la proprietà.)