Tortoises SVN

Embed Size (px)

Citation preview

  • 8/18/2019 Tortoises SVN

    1/37

    TortoiseSVN

    TutorialBy: Dung Nguyen

    Date: May 26th, 2008Duration: 1h30’

    Topic: version control

  • 8/18/2019 Tortoises SVN

    2/37

    Contents

    1. Concepts of version control & SVN

    2. Common functions in TortoiseSVN

    3. Best practices

    4. Q&A

    5. Test

  • 8/18/2019 Tortoises SVN

    3/37

    1. Concepts of version control & SVN

    1. !at is version control"

    2. Versionin# mo$els

    3. !at is SVN"

    4. SVN clients an$ plu#%ins

  • 8/18/2019 Tortoises SVN

    4/37

    1.1. What is version control?

    T!e mana#ement of c!an#es to information 'p!(sical) files*.

     Allo+ concentratin# an$ s!arin# files over t!e net+or,.

    Support aut!orit( an$ securit(.

    Cooperate mem-ers c!an#es.

    /ana#e files +it! version0 allo+ recoverin# of $esire$ version.

     Allo+ c!ec,in# t!e mo$ification.

    Support C/ process.

  • 8/18/2019 Tortoises SVN

    5/37

    1.2. Versioning models (12!

    ile%s!arin# +it!out control)

    ones $ata ma( -e acci$entall(

    over+ritten -( ot!ers.

    oc,%/o$if(%nloc, solution) +ea,

    point is not allo+ man( persons to +or,

    on t!e same file at t!e same time.

  • 8/18/2019 Tortoises SVN

    6/37

    1.2. Versioning models (22!

    Cop(%/o$if(%/er#e solution 'SVN recommen$e$*) allo+ man( persons to +or,

    on t!e same file at t!e same time0 -ut must appl( file mer#in# -efore

    su-mittin#.

  • 8/18/2019 Tortoises SVN

    7/37

    1.". What is SVN? (12!

    Su-version 'a--reviate$ SVN* is a free open%source version control s(stem.

    /ana#e$ fol$ersfiles are place$ into a repository. A repository is muc! li,e

    an or$inar( file server.

    Su-version allo+s (ou to recover ol$ versions of (our $ata0 or eamine t!e

    !istor( of !o+ (our $ata c!an#e$.

    SVNRepositor

    y

    checout !oringcopy

  • 8/18/2019 Tortoises SVN

    8/37

    1.". What is SVN? (22!

    !( use SVN 'versus Visual Source Safe%VSS*

     6 Sufficient features

     6 ree

     6 Support in$o+s0 N780 inu

     6 ar#e communit() man( clientss!ells 'TortoiseSVN0 S(ncro0 SmartSVN9*0man( plu#ins 'VS .N:T0 :clipse0 8Co$e 7;:9*

     6

  • 8/18/2019 Tortoises SVN

    9/37

    1.# SVN Clients and $l%gins

    SVN Client for in$o+s)

    !ttp)tortoisesvn.ti#ris.or#

    SVN

  • 8/18/2019 Tortoises SVN

    10/37

    2. Common functions in TortoiseSVN

    1. Setup TortoiseSVN0 #rant access ri#!t

    2. Bro+se repositor(

    3. A$$ filefol$er to repositor(

    4. C!ec, out a +or,in# cop(

    5. oc,>elease repositor( files

    ?. Commit to repositor(

    @. C!ec, mo$ification

    . p$ate +or,in# cop(

    . >evision lo# $ialo#

    1. Vie+ $ifferences

    11. Clean up

    12. Status of version controlle$ filesfol$ers

  • 8/18/2019 Tortoises SVN

    11/37

    2. Common functions in TortoiseSVN (cont.)

    Bro+se A$$ file C!ec,out

    oc,

    /er#e

    Commit p$ate :port

    Create rep

  • 8/18/2019 Tortoises SVN

    12/37

    2.1. Setup TortoiseSVN, grant access right (

     in$ t!e latest TortoiseSVN at) !ttp)tortoisesvn.ti#ris.or#$o+nloa$.!tml

     ;o+nloa$ an$ install t!e pac,a#e) TortoiseSVN%.msi

     After installin#0 TortoiseSVN is inte#rate$into in$o+s :plorer)

      % Dpen in$o+s :plorer 

      % >i#!t clic,0 popup menu opene$

      % Select TortoiseSVN

    Note: for stand-alone PC, TortoiseSVN can beused as a source control system, it’s not

    necessary to setup a SVN server.

    http://tortoisesvn.tigris.org/download.htmlhttp://tortoisesvn.tigris.org/download.html

  • 8/18/2019 Tortoises SVN

    13/37

    or,in# mo$el) client 'TortoiseSVN* 6 server 'SVN*

    >ole) A$min or

  • 8/18/2019 Tortoises SVN

    14/37

    2.2. Browse repositor

    7n in$o+s :plorer0 ri#!t clic,KTortoiseSVNK>epo%-ro+ser 

    into t!e $ialo# -o

    o#in +it! #iven username an$ pass+or$

    T!e >epo%-ro+ser opene$

  • 8/18/2019 Tortoises SVN

    15/37

    2.!. "## $le/fol#er to repositor

    7n >epo%-ro+ser0 ri#!t clic,KA$$ fol$er9

    Select source filefol$er to -e a$$e$

    = Ne! files"folders !ill be added under current

    selected folder.

    Cop( ne+ filefol$er to t!e +or,in# cop( fol$er 

    7n in$o+s :plorer0 select ne+ filefol$er0

    ri#!t clic,KTortoiseSVNKA$$9

    TortoiseSVNKCommit9

    = Ne! file"folder #as a c#ec$ mar$.

    '. Witho%t (local! oring cop) folder 

    *. With (local! oring cop) folder (recommended!

  • 8/18/2019 Tortoises SVN

    16/37

    2.%. Chec& out a wor&ing copSVN: Checo%t (head rev.! + VSS: ,et latest version

    7n in$o+s :plorer0 select +or,in# fol$er0 ri#!t clic,KSVN C!ec,out9 D>

    7n >epo%-ro+ser0 select t!e fol$er to c!ec, out0 ri#!t clic,KC!ec,out9

    ;esire$

    revision

  • 8/18/2019 Tortoises SVN

    17/37

    2.'. oc&/elease repositor $les (1/2)

    T!is is to avoi$ t!e conflict +!en anot!er user up$ates t!e repositor(

    +!ile (ou are +or,in# on (our +or,in# cop(.

    SVN: Checo%t - oc + VSS: Chec/o%t

    Eo+ to) 7n t!e +or,in# cop(0 select file to loc,0

    ri#!t%clic,KTortoiseSVNK=et loc,9

    = %oc$ed file #as a loc$-icon mar$.

    &t#er users !ill not be able to commit until you

    release t#e loc$ed files.

  • 8/18/2019 Tortoises SVN

    18/37

    2.'. oc&/elease repositor $les (2/2)

    T!is is to release t!e loc,e$ files for ot!ers to commit.

    Eo+ to) 

    Select loc,e$ fileKTortoiseSVNK

    >elease loc,

    T#is !ay !ill steal ot#er’s loc$ and replace by

    your loc$. Not recommended. 't’d be better to

    as$ t#e aut#or to release #is loc$.

    Steal t!e loc,s)

    % Select loc,e$ fileKTortoiseSVNK

      =et loc,9

    % C!ec, Steal t!e loc,s

  • 8/18/2019 Tortoises SVN

    19/37

    2.*. Commit to repositor

    T!is is to sen$ t!e c!an#es (ou ma$e on +or,in# cop( to t!e repositor(.

    SVN: Commit + VSS: Chec/in

    Eo+ to)

    Dn t!e +or,in# cop(0 ri#!t clic,KSVN Commit9

    (efore committin), you

    s#ould ma$e sure t#at your

    !or$in) copy is up-to-date.

    S!oul$ #ive

    comments

  • 8/18/2019 Tortoises SVN

    20/37

    2.+. Chec& mo#i$cation

    T!is is to ,no+ t!e mo$ification status of selecte$ file in comparison +it!

    t!at file on t!e repositor(.

    Eo+ to)

    % Dn +or,in# cop(0 select mo$ifie$ file

    % ri#!t clic,KTortoiseSVNKC!ec, for mo$ifications

    T#e *or$in) Copy dialo) s#o!s t#e

    status of t#e selected files in

    comparison !it# t#at file on t#e

    repository.

  • 8/18/2019 Tortoises SVN

    21/37

    2.. -p#ate wor&ing cop (1/2)

    T!is is to up$ate (our +or,in# cop( +it! ne+ c!an#es on t!e repositor(.

    SVN: 0pdate + VSS: ,et latest version

    o to:

    Dn t!e +or,in# cop(0 select fol$er to -e up$ate$0 ri#!t clic,KSVN p$ate9

  • 8/18/2019 Tortoises SVN

    22/37

    2.. -p#ate wor&ing cop (2/2)

    To ma,e $ate time of local files matc! +it! $ate time of files at SVN.

    o to:  TortoireSVNKSettin#s to open TortoiseSVN Settin#s $ialo#. Turn on option GSet file$ates to Llast commit timeMH.

  • 8/18/2019 Tortoises SVN

    23/37

    2.. Show eision log message

    or ever( c!an#e (ou ma,e an$ commit0 s!oul$ provi$e a lo#

    messa#e $escri-es t!e meanin# of (our c!an#e.

    T!e o# /essa#es $ialo# retrieves all t!ose lo# messa#es an$ allo+s

    (ou to select t!e $esire$ revision.

    >evision num-er is applie$ for t!e

      +!ole repositor(.

  • 8/18/2019 Tortoises SVN

    24/37

    2.10. View #ierences

    Compare oring cop) ith a given SVN revision.

    o to:% Dn +or,in# cop(0 select file to compare% >i#!t clic,KS!o+ lo# K o# messa#es $ialo# opene$% Select t!e revison to compare0 ri#!t clic,KCompare +it! local cop(

  • 8/18/2019 Tortoises SVN

    25/37

    2.11. Clean up

    7f a Su-version comman$ cannot complete successfull(0 per!aps $ue to

    server or net+or, pro-lems0 (our +or,in# cop( can -e left in an

    inconsistent state.

    7t is a #oo$ i$ea to $o Lclean upM at t!e top level of t!e +or,in# cop(.

  • 8/18/2019 Tortoises SVN

    26/37

    2.12. Stat%s of version controlled filesfolders

    =reen c!ec,mar,) normal status0 un$er control

    >e$ eclamation) file !as -een mo$ifie$ since last up$ate an$ nee$s to

    -e committe$.

    Oello+ eclamation) a conflict occurs $urin# an up$ate.

    =re( c!ec,mar,) t!is file nee$s to -e loc,e$ first -efore e$itin#.

    oc,e$ loc,) file is loc,e$. Nee$ to unloc, for ot!er to commit.

    >e$ $eletion) missin# file or file to -e $elete$ un$er version control.

    Blue plus) ile to -e a$$e$ to version control.

  • 8/18/2019 Tortoises SVN

    27/37

    ". *est practices

    Best practices for t!e correct%usa#e

     Avoi$ conflict over multi%user repositor(

    :nforce control an$ cooperation amon# team

  • 8/18/2019 Tortoises SVN

    28/37

    ". *est practices (1!

    ,ive comments for the commit

     6 i#!t%clic,KSVN p$ate

  • 8/18/2019 Tortoises SVN

    29/37

    ". *est practices (2!

    Self/manage the merging4 do not let TortoiseSVN to merge files

     6 7n case t!ere is conflict -et+een (our +or,in# cop( an$ t!e

    repositor(0 (ou s!oul$ mer#e file -( (ourself.

     6 Steps)

  • 8/18/2019 Tortoises SVN

    30/37

    ". *est practices ("!

    f1.tt.

    r@

    f1.tt.

    r@1

    f1.tt.

    mine

    f1.tt/er#eCommit"

    ser 1

    ser 2

  • 8/18/2019 Tortoises SVN

    31/37

    ". *est practices (#!

    Checo%t/oc/5dit/Commit/0nloc

    'VSS) sin#le c!ec,out*

     6  Appl( t!e auto nee$%loc, propert(.

     6 Eo+ to use"

    Before e$itin# one file0 perform =et loc, K file is rea$( to

    up$ate0 also t!e repositor( file is loc,e$ so t!e ot!er cannot

    commit t!eir c!an#es.

    Commit (our file after e$itin#

    >elease loc, K t!e ot!er can e$it an$ commit t!eir c!an#es.

    6o not use in$o+s :plorer to set file attri-utes.

  • 8/18/2019 Tortoises SVN

    32/37

    ". *est practices (!

    0se TortoiseSVN commands (right clic4 drag and drop!

    don not %se the Windos 57plorer commands.

     6 T!is to ,eep t!e consistenc( -et+een (our +or,in# cop( to t!e

    repositor(. T!e actions !ave effect on -ot! (our +or,in# cop( an$

    repositor(.

  • 8/18/2019 Tortoises SVN

    33/37

    #. 8&' (1"!

    Eo+ to o-tain a LcleanM +or,in# cop( 'ori#inal sources onl(* an$

    eclu$e .svn fol$ers.

     6 Select +or,in# cop(Kri#!t%clic,KTortoiseSVNK:port

     6

  • 8/18/2019 Tortoises SVN

    34/37

    #. 8&' (2"!

    Eo+ to -rea,steal loc,

     6 T!is is to -rea, t!e loc,in# on file -( overri$e t!e loc,in# aut!or.

     6 C!ec, for mo$ificationsKselect loc,e$ filesK-rea, loc,0 D>

     6 >i#!t clic,KTortoiseSVNK=et loc,0 c!ec, t!e Steal option0 D.

     6 >ecommen$) s!oul$ not use t!is function unless (ou !avea#reement of t!e

  • 8/18/2019 Tortoises SVN

    35/37

    #. 8&' (""!

    Eo+ to c!ec, out an SVN $irector( 'recursivel(* to local eistin#

    fol$er" 'Similar to #et latest version in VSS & over+rite all local*

     6 S!oul$ c!ec,out to an empt( +or,in# cop(.

     6 :istin# +or,in# cop( ma( cause file conflict or leave files not un$er

    source control.

    Eo+ to #et specific version of co$e from SVN"

     6 Select filefol$er in t!e +or,in# cop(

     6 TortoiseSVNKp$ate to revision9

     6 Select t!e option >evision0 input $esire$ revision 6 Oou can S!o+ lo# to ,no+ t!e lo# messa#e.

  • 8/18/2019 Tortoises SVN

    36/37

    . Test

  • 8/18/2019 Tortoises SVN

    37/37

    Than& ou3or our Comment an#

    -p#ate.