This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
svn:start [2012/07/20 10:15] szymon.kulis |
svn:start [2022/12/21 17:08] (current) marek.idzik |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== SubVersion ====== | ====== SubVersion ====== | ||
- | ===== links ===== | + | ===== Links ===== |
* [[http://subversion.apache.org/ | SVN Project website ]] | * [[http://subversion.apache.org/ | SVN Project website ]] | ||
* SVN Book [[http://svnbook.opensys.pl/ | PL ]] [[ http://svnbook.red-bean.com/ | ENG ]] | * SVN Book [[http://svnbook.opensys.pl/ | PL ]] [[ http://svnbook.red-bean.com/ | ENG ]] | ||
- | * [[ http://svn.lumifun.ftj.agh.edu.pl/ ]] (doesn't work yet) | + | * [[ http://svn.asic.fis.agh.edu.pl/ ]] |
+ | |||
+ | ===== SVNShell & SmartSVN ===== | ||
+ | {{:svn:svnshell.tar| SVNShell_script}} **DO NOT USE -- OLD**\\ | ||
+ | {{:svn:smartsvn.tar| SmartSVN_script}} **DO NOT USE -- OLD**\\ | ||
+ | Download, untar (''tar -xf name.tar'') and add to ''$PATH''. | ||
+ | |||
+ | ===== Administrators ===== | ||
+ | * SVN administrators : **Kuba Moron**, **Szymon Kulis** | ||
+ | * People who can help : **Krzysztof Swientek** | ||
===== Using SVN ===== | ===== Using SVN ===== | ||
Line 14: | Line 23: | ||
==== Starting svn shell ==== | ==== Starting svn shell ==== | ||
- | Before you start using svn you have to start svn shell (or provide keys to ssh client in diferent way) | + | Before you start using svn you have to start **svnshell**. The main function of this script is to simplify key management, you will be asked only once to enter yours pass-phrase at script startup (if you don't like this script you may configure your ssh client in different way). Script is pre-installed on all production servers (koi, ibm). To start shell, just type: |
<code> svnshell </code> | <code> svnshell </code> | ||
You should see modified prompt : | You should see modified prompt : | ||
<code> [SVN] promt$ </code> | <code> [SVN] promt$ </code> | ||
+ | |||
+ | **Notes:** | ||
+ | * script assumes existence of public/private-key named **svn** and **svn.pub** in yours **.ssh** directory (''.ssh/svn'' and ''.ssh/svn.pub'') | ||
+ | * script doesn't have any significant dependencies you may copy it to you workstation and use it | ||
+ | * script source is in ''svn : cds_etc/trunk/etc/svn_scripts/svnshell'' | ||
Line 23: | Line 37: | ||
==== Getting repository ==== | ==== Getting repository ==== | ||
To get local copy of repository : | To get local copy of repository : | ||
- | <code> svn checkout svn+ssh://svn@lumifun.ftj.agh.edu.pl/REPOSITORY_NAME </code> | + | <code> svn checkout svn+ssh://svn@asic.fis.agh.edu.pl/REPOSITORY_NAME </code> |
+ | or optionally | ||
+ | <code> svn checkout svn+ssh://[email protected]/REPOSITORY_NAME/trunk REPOSITORY_NAME </code> | ||
==== Update ==== | ==== Update ==== | ||
+ | |||
+ | To download most recent version form repository use: | ||
+ | <code> svn update</code> | ||
==== Commit ==== | ==== Commit ==== | ||
+ | To commit (send to server) yours changes use: | ||
+ | <code> svn commit </code> | ||
+ | |||
+ | You may also add specific resource to be added: | ||
+ | <code> svn commit dir/filename </code> | ||
+ | |||
+ | In addition you may provide commit comment from command line using **-m** option: | ||
+ | <code> svn commit -m "comment to my commit"</code> | ||
+ | |||
+ | ==== Adding ==== | ||
+ | To add new resource (file / directory) use: | ||
+ | <code> svn add file </code> | ||
+ | **NOTE:** Be careful, adding directory means adding directory itself and all files inside it. | ||
+ | |||
+ | To add **only directory** without files inside you need to: | ||
+ | <code> svn add -N dirname </code> | ||
+ | |||
+ | ==== Deleting ==== | ||
+ | To remove resource (file / directory) use: | ||
+ | <code> svn del file </code> | ||
==== Working with Cadence ==== | ==== Working with Cadence ==== | ||
+ | In order to simplify process of adding new resources created during work with Cadence an helper script **smartsvn.py** was prepared. | ||
+ | The main aim of this script is to scan over directory tree and look for new cells / views to be added to repository. | ||
+ | To run script use: | ||
+ | <code> smartsvn.py </code> | ||
+ | ==== How to revert to a previous revision ==== | ||
+ | - make sure that you haven't made any changes to you repository. If you changed something, it will cause problems. The easies way is to <code>rm ./* | ||
+ | svn update</code> | ||
+ | - use this command to see what is going to be changed when you go from current revision to **NNN** revision of **dir** <code>svn merge -rHEAD:NNN dir</code> | ||
+ | - if you like action proposed by previous command, just remove **--dry-run** to revert: <code>svn merge --dry-run -rHEAD:NNN dir</code> | ||
+ | - real life example <code>cd AMS400/EUDET_VI_AMS/ | ||
+ | svn merge -rHEAD:128 .</code> | ||
===== Setting up svn ===== | ===== Setting up svn ===== | ||
Line 37: | Line 87: | ||
==== getting access to svn server ==== | ==== getting access to svn server ==== | ||
- | Generating ssh key pair: | + | Access to repository is granted based on public/private-key authorization mechanism. |
+ | You need to generate ssh key pair: | ||
<code>ssh-keygen -t rsa -b 2048 -f ~/.ssh/svn</code> | <code>ssh-keygen -t rsa -b 2048 -f ~/.ssh/svn</code> | ||
+ | Send generated **PUBLIC KEY (~/.ssh/svn.pub)** to SVN Administrator. | ||
==== setting environment ==== | ==== setting environment ==== | ||
- | In file ''~/.bashrc'' you have to specify editor wich will be used to edit commit description: | + | SVN utilizes one of system editors to allow entering commit comments in interactive mode. |
- | <code> export SVN_EDITOR=gedit </code> | + | Editor to be invoked is specified by environmental variable SVN_EDITOR. To change |
- | You have to add ''scripts'' directory to You PATH: | + | default editor you should set this variable in yours ''~/.bashrc'' file, e.g: |
- | <code> export PATH=~/AMS400/EUDET_V/scripts:$PATH</code> | + | <code> export SVN_EDITOR=gvim </code> |
===== typical use case ===== | ===== typical use case ===== | ||
- | - going into repository directory <code>cd ~AMS400/EUDET_V</code> | + | - going into repository directory <code>cd YOUR_REPO</code> |
- getting latest version<code>svn update</code> | - getting latest version<code>svn update</code> | ||
- **work very hard** | - **work very hard** | ||
Line 55: | Line 106: | ||
* getting latest version (someone **may changed something while you were working on Yours local copy of data**) <code>svn update</code> | * getting latest version (someone **may changed something while you were working on Yours local copy of data**) <code>svn update</code> | ||
* if there are were any changes You **should check if Your work is compatible** with changes commited by someone | * if there are were any changes You **should check if Your work is compatible** with changes commited by someone | ||
- | * if You created any new files (cells, schematics, layouts, ...) You should **add them to repository** <code>svn_helper.py add [dir/file]</code> | + | * if You created any new files (cells, schematics, layouts, ...) You should **add them to repository** <code>smartsvn.py </code> |
* at the end You have to **send changes to repository** <code>svn commit</code> **You should put (not to long, but having sense) comment ** | * at the end You have to **send changes to repository** <code>svn commit</code> **You should put (not to long, but having sense) comment ** | ||
- | |||
- | |||
- | ===== svn_helper.py ===== | ||
- | * this script was written to **help with adding new files** to repository | ||
- | * it is placed at : ''scripts/svn_helper.py'' | ||
- | * there are two configuration files : | ||
- | * ''scripts/files.cnf'' - tells which files should be added | ||
- | * ''scripts/dirs.cnf'' - tells which directories should be added | ||
- | * typical output : | ||
- | <code>kulis@lumifun:~/EUDET_V$ svn_helper.py add | ||
- | Creating /home/kulis/EUDET_V/scripts/logs/svn_helper_2010_05_10_14_21_50.sl | ||
- | scripts/known_type.py [file] [PY ] [+] | ||
- | scripts/unknow_type.123 [file] [!!!] [-] | ||
- | scripts/logs/svn_helper_2010_05_10_14_21_50.sl [file] [SL ] [-] | ||
- | Unmached files: | ||
- | scripts/unknow_type.123</code> | ||
- | * meaning of columns in [] : | ||
- | - file system node type (file or directory) | ||
- | - identified object type (schematic, layout, script) (if colour is green it means that object was identified, if colour is red and string is "!!!" it means that type is unknown and proper pattern should be added to files/dirs.cnf) | ||
- | - will object be added to repository (+ yes, - no) | ||
- | * ** If there are unknown types of files script will not allow to proceed ** | ||
| | ||
===== FAQ ===== | ===== FAQ ===== | ||
Line 103: | Line 133: | ||
Last Changed Date: ... | Last Changed Date: ... | ||
- | $svn switch --relocate http://svn.lumifun.ftj.agh.edu.pl/YOUR_REPO svn+ssh://[email protected]/YOUR_REPO . | + | $svn switch --relocate http://svn.lumifun.ftj.agh.edu.pl/YOUR_REPO svn+ssh://svn@asic.fis.agh.edu.pl/YOUR_REPO . |
+ | </code> | ||
+ | |||
+ | Example | ||
+ | |||
+ | <code> | ||
+ | $cd ~/IBM013/EUDET_VI_IBM | ||
+ | |||
+ | $ svn info | ||
+ | Ścieżka: . | ||
+ | URL: http://svn.lumifun.ftj.agh.edu.pl/EUDET_VI_IBM/tunk | ||
+ | Katalog główny repozytorium: http://svn.lumifun.ftj.agh.edu.pl/EUDET_VI_IBM | ||
+ | UUID repozytorium: 134063e6-8b79-43c4-80ea-df54b304f938 | ||
+ | Wersja: 789 | ||
+ | Rodzaj obiektu: katalog | ||
+ | Zlecenie: normalne | ||
+ | Autor ostatniej zmiany: przyboro | ||
+ | Ostatnio zmieniona wersja: 789 | ||
+ | Data ostatniej zmiany: 2012-05-18 15:57:54 +0200 (pią) | ||
+ | |||
+ | $svn sw --relocate http://svn.lumifun.ftj.agh.edu.pl/EUDET_VI_IBM/trunk svn+ssh://[email protected]/EUDET_VI_IBM/trunk . | ||
+ | |||
+ | $ svn info | ||
+ | Ścieżka: . | ||
+ | URL: svn+ssh://[email protected]/EUDET_VI_IBM/trunk | ||
+ | Katalog główny repozytorium: svn+ssh://[email protected]/EUDET_VI_IBM | ||
+ | UUID repozytorium: 134063e6-8b79-43c4-80ea-df54b304f938 | ||
+ | Wersja: 789 | ||
+ | Rodzaj obiektu: katalog | ||
+ | Zlecenie: normalne | ||
+ | Autor ostatniej zmiany: przyboro | ||
+ | Ostatnio zmieniona wersja: 789 | ||
+ | Data ostatniej zmiany: 2012-05-18 15:57:54 +0200 (pią) | ||
+ | |||
+ | </code> | ||
+ | |||
+ | ===== Relocate to asic ===== | ||
+ | |||
+ | To relocate **YOUR_REPO** from lumifun to asic please follow the instructions given below: | ||
+ | - Go to **YOUR_REPO** directory <code>$ cd path_to_YOUR_REPO </code> | ||
+ | - Check current URL **(third line below between > and <)**<code>$ svn info | ||
+ | Path: . | ||
+ | URL: >>> svn+ssh://[email protected]/YOUR_REPO <<< | ||
+ | Repository Root: svn+ssh://[email protected]/YOUR_REPO | ||
+ | Repository UUID: a855ac54-1f2a-4fde-b2df-7ae56cbf9e90 | ||
+ | Revision: 107 | ||
+ | Node Kind: directory | ||
+ | Schedule: normal | ||
+ | Last Changed Author: someone | ||
+ | Last Changed Rev: 1 | ||
+ | Last Changed Date: 2014-02-08 17:47:30 +0100 (Sat, 08 Feb 2014) | ||
+ | </code> | ||
+ | - Run svnshell | ||
+ | - Copy current URL (between > and < above) and perform command:<code> | ||
+ | $ svn sw --relocate CURRENT_URL_FROM_SVN_INFO svn+ssh://[email protected]/YOUR_REPO | ||
</code> | </code> | ||
+ | ===== Windows ===== | ||
+ | - Install putty using installer (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) | ||
+ | - Use **puttygen.exe** to generate keys | ||
+ | - enter ** PASSPHRASE ** | ||
+ | - change key lenght to **2048 RSA** | ||
+ | - move mouse during key generation | ||
+ | - after generation **save keys to disk** (both private and public) | ||
+ | - **send** public key to SVN administrator | ||
+ | - Open putty | ||
+ | - go to Session -> Connection -> SSH -> Auth | ||
+ | - click the "Browse..." button and select the ppk file that you just saved using PuTTYgen | ||
+ | - now return to the "Session" category | ||
+ | * enter hostname : **lumifun.ftj.agh.edu.pl** | ||
+ | * saved sessions : **lumifun** | ||
+ | * clic **save** | ||
+ | - Open TortoiseSVN -> Settings | ||
+ | * Select the **Network configuration** and point the SSH client to **TortoisePlink.exe** (location where you installed Tortoise) | ||
+ | - Use svn, ass a path to repository use <code>svn+ssh://[email protected]/REPO_NAME</code> | ||
+ | - To avoid entering passphrase each time you need: | ||
+ | * run **pageant.exe** (putty instalation directory) | ||
+ | * click on your private key to unlock it | ||
+ | * You need to do it after each reboot |