⇤ ← Revision 1 as of 2016-11-10 14:54:45
Size: 4639
Comment:
|
Size: 4316
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
SVN ist ein Versionsmanagementsystem. Es verwaltet beliebige Daten (meistens jedoch so etwas wie Text oder Programmcode) auf einem zentralen Rechner (in unserem Fall ein Rechner bei uns am Lehrstuhl) in einem sogenannten ''Repository''. Sie können sich Ihre Dateien von diesem Rechner holen (''svn checkout''), sie können neue Dateien hinzufügen (''svn add''), und den Inhalt von neuen oder geänderten Dateien in das Repository hochladen (''svn commit''). Wenn jemand anderes etwas an Ihren Daten ändert (in unserem Fall die Tutoren die Ihre Programm korrigieren) bekommen Sie die neueste Version mit ''svn update''. | SVN is a version management system. With its help, you can manage any data (in most cases however text or program code) on a central computer (in our case a computer at our premises) in a so-called “repository”. You may download your files from this computer (“svn checkout”), you may add new files (“svn add”) and upload the contents of new or edited files into the repository (“svn commit”). If someone else edits your data (in our case the tutors correcting your program), you will get the latest version with “svn update”. |
Line 5: | Line 5: |
Wir haben für diese Vorlesung ein eigenes SVN repository. Darin hat jeder Teilnehmer und jede Teilnehmerin ein Unterverzeichnis. Der Name dieses Unterverzeichnisses ist genau der Name ihres RZ-Accounts. Zum Auschecken Ihres Unterverzeichnisses machen Sie folgendes (unter Unix / Linux), wobei ''MYUSERNAME'' der Benutzername Ihres RZ-Accounts ist und ''MYFOLDER'' ein Verzeichnis Ihrer Wahl: | For this lecture we have a special SVN repository. In this repository, each participant as his or her own subdirectory. The name of this subdirectory corresponds exactly to the name of your University IT Services account. In order to check out your subdirectory, please proceed as follows (under Unix / Linux), whereas “MYUSERNAME” is the user name of your University IT Services account and “MYFOLDER” is a directory of your choice: |
Line 11: | Line 11: |
Um eine Datei ''FILE'' die bisher noch nicht im Repository war, diesem hinzuzufügen, macht man | In order to add a new “FILE” to the repository, please proceed as follows |
Line 16: | Line 16: |
Es wird durch dieses Kommando allerdings noch nichts auf den Server hochgeladen, sondern die betreffenden Dateien werden für das Hochladen "gescheduled" (markiert). Das eigentliche Hochladen passiert beim nächsten ''svn commit'', siehe unten. ''svn add'' klappt auch mit mehreren Dateien gleichzeitig, zum Beispiel für ''FILE1'', ''FILE2'' und ''FILE3'' | With this command, the file is however not uploaded to the server; the files in question are only scheduled (marked) for the upload. The upload itself will take place with the next “svn commit”, see below. “svn add” does also work with several files at a time, e.g. for “FILE1”, “FILE2” and “FILE3” |
Line 21: | Line 21: |
Wenn einer der Dateien ein Ordner ist wird nicht nur der Ordner sondern gleich auch alle Dateien in diesem Ordern ge''add''ed. Wenn man das macht, sollte man aufpassen, dass auch wirklich alle Dateien in dem Ordner in das Repository sollen und irgendwelche "Nebenprodukte" wie Backup-Dateien vom Editory, ''.o'' Dateien oder ausführbare Dateien vorher löschen. | If one of the files is a folder, the folder will be “added” including all the files it contains. If you do this, please make sure that all files in the folder are intended to be uploaded into the repository and that any by-products such as editory backup files, “.o”-files or executable files are deleted (or moved) before. |
Line 23: | Line 23: |
Wenn man eine Datei für die man schon ''svn add'' gemacht hat, doch nicht ''add''en will macht man einfach ''svn revert'' gefolgt von dem oder den betreffenden Dateinamen. | If you find that you do not wish to add a file for which the “svn add” has already been executed, please use “svn revert” followed by the respective file name(s). |
Line 29: | Line 29: |
Setzt eine Datei auf den zuletzt commiteten Stand zurück. Ein ''svn add'' kann damit rückgängig gemacht werden, solange kein ''svn commit'' durchgeführt wurde. | Will reset a file to the last committed version. A “svn add” may thus be reverted, as long as no “svn commit” has been executed. |
Line 32: | Line 32: |
Mit diesen Befehl werde alle Änderungen an der lokalen Arbeitskopie auf den Rechner übertragen wo das Repository liegt. Also in unserem Fall, der Rechner an unserem Lehrstuhl. Änderungen sind dabei sowohl Änderungen an Dateien, die schon im Repository waren, als auch Dateien, die mit ''svn add'' erstmalig dem Repository hinzugefügt wurden. | With this command, all changes to the local working copy are transmitted to the computer where the repository is located. This means in our case the computer at our premises. Changes mean either changes to files already in the repository or files added to the repository for the first time with the aid of “svn add”. |
Line 34: | Line 34: |
''svn commit'' schlägt fehl, wenn Dateien geändert werden sollen, welche in gesperrten Verzeichnissen liegen. Dies ist bei älteren Übungsblättern nach dem Ablauf der Abgabefrist der Fall. | “svn commit” fails for files to be edited which are stored in locked directories. This would be the case for older exercise sheets after the submission deadline. |
Line 37: | Line 37: |
Hiermit werden alle Änderungen im zentralen Repository auf Ihre Arbeitskopie übertragen. Wenn sich im Repository nichts geändert hat, passiert einfach nichts. Wenn sich im Repository etwas geändert hat an einer Datei an der sie zwischenzeitlich auch etwas geändert haben, versucht SVN diese beiden Änderungen zusammen zu bringen, das nennt sich ''merge''. Wenn die Änderungen an verschiedenen Stellen in der Datei sind gelingt das meisten. Wenn die Änderungen an der gleichen Stelle in der Datei waren, gibt es einen sogenannten ''conflict''. | With this, all changes in the central repository are transmitted to your working copy. If there were no changes in the repository, nothing will happen at all. If there was a change to a file in the repository which you edited in the meantime as well, svn will try to keep both changes, which is called “merge”. In most cases, this is successful, if the changes were made in different passages in the file. If the changes happen to be in the same passage in the file, there is a conflict. |
Line 39: | Line 39: |
Im Falle eines ''conflicts'' zeigt SVN für die betreffende Datei ein ''C'' an. Sie müssen die Datei dann editieren und den Konflikt beheben. Konkret sieht das so aus, dass in der Datei die Stellen mit dem Konflikt markiert sind (die Markierungen sind nicht zu übersehen). Es stehen dann beide Versionen da. Sie können sich dann überlegen was da stehen soll, die Datei entsprechend ändern und die Markierungen dann entfernen. Danach müssen Sie SVN explizit mitteilen, dass Sie sich um den ''conflict'' gekümmert haben und das geht mit ''svn resolved'' gefolgt von dem Namen der Datei. | In the event of a conflict, svn will indicate a “C” for the file in question. In this case, please edit the file in order to eliminate the conflict. You will find that the passages affected by the conflict are highlighted in the file (the marks cannot be missed). Both versions are displayed. You may then decide, which version you want to keep, edit the file accordingly and remove the marks). After that, you have to tell SVN explicitly, that the conflict has been resolved by using “svn resolved” followed by the file name. |
Line 45: | Line 45: |
Entfernt die Datei sowohl lokal als auch im Repository. Die Änderung muss per ''svn commit'' übermittelt werden. | Removes the file locally as well as in the repository. This change must be transmitted by “svn commit”. |
Line 48: | Line 48: |
Hiermit können alle verfügbaren Befehle für "svn" aufgelistet werden und weitere Informationen darüber abgefragt werden. Im Prinzip ersetzt dieser Befehl die Man-Pages für ''svn''. | With this, all available commands for “svn” can be listed and further information can be requested. As a matter of principle, this command replaces the Man-Pages for “svn”. |
Subversion (SVN)
SVN is a version management system. With its help, you can manage any data (in most cases however text or program code) on a central computer (in our case a computer at our premises) in a so-called “repository”. You may download your files from this computer (“svn checkout”), you may add new files (“svn add”) and upload the contents of new or edited files into the repository (“svn commit”). If someone else edits your data (in our case the tutors correcting your program), you will get the latest version with “svn update”.
svn checkout
For this lecture we have a special SVN repository. In this repository, each participant as his or her own subdirectory. The name of this subdirectory corresponds exactly to the name of your University IT Services account. In order to check out your subdirectory, please proceed as follows (under Unix / Linux), whereas “MYUSERNAME” is the user name of your University IT Services account and “MYFOLDER” is a directory of your choice:
svn checkout https://daphne.informatik.uni-freiburg.de/ss2016/ProgrammierenCplusplus/svn/MYUSERNAME MYFOLDER --username MYUSERNAME
svn add
In order to add a new “FILE” to the repository, please proceed as follows
svn add FILE
With this command, the file is however not uploaded to the server; the files in question are only scheduled (marked) for the upload. The upload itself will take place with the next “svn commit”, see below. “svn add” does also work with several files at a time, e.g. for “FILE1”, “FILE2” and “FILE3”
svn add FILE1 FILE2 FILE3
If one of the files is a folder, the folder will be “added” including all the files it contains. If you do this, please make sure that all files in the folder are intended to be uploaded into the repository and that any by-products such as editory backup files, “.o”-files or executable files are deleted (or moved) before.
If you find that you do not wish to add a file for which the “svn add” has already been executed, please use “svn revert” followed by the respective file name(s).
svn revert
svn revert FILE
Will reset a file to the last committed version. A “svn add” may thus be reverted, as long as no “svn commit” has been executed.
svn commit
With this command, all changes to the local working copy are transmitted to the computer where the repository is located. This means in our case the computer at our premises. Changes mean either changes to files already in the repository or files added to the repository for the first time with the aid of “svn add”.
“svn commit” fails for files to be edited which are stored in locked directories. This would be the case for older exercise sheets after the submission deadline.
svn update
With this, all changes in the central repository are transmitted to your working copy. If there were no changes in the repository, nothing will happen at all. If there was a change to a file in the repository which you edited in the meantime as well, svn will try to keep both changes, which is called “merge”. In most cases, this is successful, if the changes were made in different passages in the file. If the changes happen to be in the same passage in the file, there is a conflict.
In the event of a conflict, svn will indicate a “C” for the file in question. In this case, please edit the file in order to eliminate the conflict. You will find that the passages affected by the conflict are highlighted in the file (the marks cannot be missed). Both versions are displayed. You may then decide, which version you want to keep, edit the file accordingly and remove the marks). After that, you have to tell SVN explicitly, that the conflict has been resolved by using “svn resolved” followed by the file name.
svn remove
svn remove FILE
Removes the file locally as well as in the repository. This change must be transmitted by “svn commit”.
svn help
With this, all available commands for “svn” can be listed and further information can be requested. As a matter of principle, this command replaces the Man-Pages for “svn”.
svn help
svn help add