Before we go on, you should know a bit about how to identify a particular revision in your repository. As you learned in sezione chiamata «Revisioni», a revision is a “snapshot” of the repository at a particular moment in time. As you continue to commit and grow your repository, you need a mechanism for identifying these snapshots.
Prima di andare avanti, bisogna sapere qualcosa su come identificare una particolare revisione nel proprio repository. Come si è visto in sezione chiamata «Revisioni», una revisione è «un'istantanea» del repository fatta in un particolare istante di tempo. Man mano che si continua a fare commit aumentano le dimensioni del repository, perciò bisogna avere un metodo per identificare queste istantanee.
You specify these revisions by using the
--revision
(-r
) switch plus
the revision you want (svn --revision REV) or
you can specify a range by separating two revisions with a colon
(svn --revision REV1:REV2). And Subversion
lets you refer to these revisions by number, keyword, or
date.
Per specificare le revisioni si usa l'opzione
--revision
(-r
) unito alla
revisione desiderata (svn --revision REV) oppure si
può specificare un intervallo separando le due revisioni con i due
punti «:» (svn --revision
REV1:REV2).Subversion permette di referenziare queste
revisioni attraverso numeri, chiavi oppure data.
When you create a new Subversion repository, it begins its life at revision zero and each successive commit increases the revision number by one. After your commit completes, the Subversion client informs you of the new revision number:
Quando si crea un nuovo repository Subversion, questo comincia la sua vita dalla revisione zero ed ogni successivo commit incrementa il numero di revisione di uno. Quando si completa la commit, il client Subversion comunica il nuovo numero della revisione:
$ svn commit --message "Corrected number of cheese slices." Sending sandwich.txt Transmitting file data . Committed revision 3.
If at any point in the future you want to refer to that revision (we'll see how and why we might want to do that later in this chapter), you can refer to it as “3”.
Se ad un certo punto in futuro ci si vorrà riferire a quella particolare revisione (si vedrà come e perché si dovrebbe volerlo nel seguito di questo capitolo), ci si potrà riferire ad essa con il numero «3».
The Subversion client understands a number of
revision keywords. These keywords
can be used instead of integer arguments to the
--revision
switch, and are resolved into
specific revision numbers by Subversion:
Il client Subversion riconosce un numero di chiavi di
revisioni. Queste chiavi possono essere usate al posto
degli argomenti interi con l'opzione --revision
,
e vengono risolte da Subversion in specifici numeri di revisione:
![]() |
Nota |
---|---|
Each directory in your working copy contains an
administrative subdirectory called
Ogni directory della propria copia di lavoro contiene una
sottodirectory di amministrazione chiamata
|
The latest (or “youngest”) revision in the repository.
L'ultima revisione (o «la più recente») nel repository.
The revision number of an item in a working copy. If the item has been locally modified, the «BASE version » refers to the way the item appears without those local modifications.
Il numero di revisione di un oggetto in una copia di lavoro. Se l'oggetto è stato modificato in locale, la «versione BASE» fa riferimento al modo in cui l'oggetto appare senza le modifiche effettuate.
The most recent revision prior to, or equal to,
BASE
, in which an item changed.
La revisione più recente prima di, o uguale a
BASE
, nella quale è cambiato un oggetto.
The revision immediately before
the last revision in which an item changed.
(Technically, COMMITTED
- 1.)
La revisione immediatamente precedente
rispetto all'ultima revisione nella quale è cambiato un
oggetto. (Tecnicamente, COMMITTED
- 1.)
![]() |
Nota |
---|---|
|
Here are some examples of revision keywords in action. Don't worry if the commands don't make sense yet; we'll be explaining these commands as we go through the chapter:
Diamo alcuni esempi di chiavi di revisione in azione. Non bisogna preoccuparsi se i comandi sembrano non aver senso; saranno spiegati in seguito.
$ svn diff --revision PREV:COMMITTED foo.c
# shows the last change committed to foo.c
$ svn log --revision HEAD
# shows log message for the latest repository commit
$ svn diff --revision HEAD
# compares your working file (with local changes) to the latest version
# in the repository
$ svn diff --revision BASE:HEAD foo.c
# compares your «pristine» foo.c (no local changes) with the
# latest version in the repository
$ svn log --revision BASE:HEAD
# shows all commit logs since you last updated
$ svn update --revision PREV foo.c
# rewinds the last change on foo.c
# (foo.c's working revision is decreased)
These keywords allow you to perform many common (and helpful) operations without having to look up specific revision numbers or remember the exact revision of your working copy.
Queste chiavi permettono di effettuare le più comuni (ed utili) operazioni senza bisogno di specificare i numeri di revisione o di ricordare l'esatta revisione della propria copia di lavoro.
Anywhere that you specify a revision number or revision keyword, you can also specify a date inside curly braces “{}”. You can even access a range of changes in the repository using both dates and revisions together!
Ovunque si specifichi un numero di revisione o una chiave di revisione, si può anche specificare una data racchiusa fra parentesi graffe «{}». Sarà addirittura possibile accedere ad un insieme di cambiamenti nel repository usando assieme le date e le revisioni!
Here are examples of the date formats that Subversion accepts. Remember to use quotes around any date that contains spaces.
Qui potete trovare alcuni esempi di formati di data accettati da Subversion. Ricordatevi di racchiudere la data tra doppi apici se al suo interno sono presenti degli spazi.
$ svn checkout --revision {2002-02-17} $ svn checkout --revision {15:30} $ svn checkout --revision {15:30:00.200000} $ svn checkout --revision {"2002-02-17 15:30"} $ svn checkout --revision {"2002-02-17 15:30 +0230"} $ svn checkout --revision {2002-02-17T15:30} $ svn checkout --revision {2002-02-17T15:30Z} $ svn checkout --revision {2002-02-17T15:30-04:00} $ svn checkout --revision {20020217T1530} $ svn checkout --revision {20020217T1530Z} $ svn checkout --revision {20020217T1530-0500} …
When you specify a date as a revision, Subversion finds the most recent revision of the repository as of that date:
Quando si speicifica una data come revisione, Subversion trova la più recente revisione del repository registrata fino a quella specifica data:
$ svn log --revision {2002-11-28} ------------------------------------------------------------------------ r12 | ira | 2002-11-27 12:31:51 -0600 (Wed, 27 Nov 2002) | 6 lines …
You can also use a range of dates. Subversion will find all revisions between both dates, inclusive:
Si può anche usare un intervallo di date. Subversion troverà tutte le revisioni comprese tra le due date (estremi compresi):
$ svn log --revision {2002-11-20}:{2002-11-29} …
As we pointed out, you can also mix dates and revisions:
Come abbiamo visto, è possibile combinare le date e le revisioni:
$ svn log --revision {2002-11-20}:4040
Users should be aware of a subtlety that can become quite a stumbling-block when dealing with dates in Subversion. Since the timestamp of a revision is stored as a property of the revision—an unversioned, modifiable property—revision timestamps can be changed to represent complete falsifications of true chronology, or even removed altogether. This will wreak havoc on the internal date-to-revision conversion that Subversion performs.
Gli utenti dovrebbero fare attenzione ad una sottigliezza che si potrebbe rilevare un ostacolo quando si utilizzano le date in Subversion. Poiché il timestamp di una revisione è salvato come una proprietà della revisione — una proprietà modificabile e non gestita dal sistema di controllo di versione — i timestamp di revisione possono essere modificati per falsificare completamente l'ordine cronologico, o possono essere rimossi completamente. Questo porterà problemi sul sistema di conversione data-revisione utilizzato da Subversion.