Uvažanje podatkov v skladišče

Uvoz

If you are importing into an existing repository which already contains some projects, then the repository structure will already have been decided. If you are importing data into a new repository, then it is worth taking the time to think about how it will be organised. Read “Postavitev skladišča” for further advice.

This section describes the Subversion import command, which was designed for importing a directory hierarchy into the repository in one shot. Although it does the job, it has several shortcomings:

  • Datotek in map, ki jih želite vključiti, ne morete izbrati, lahko pa si pomagate z nastavitvami splošnega vzorca prezrtih elemetov.

  • Uvožena mapa ne postane delovna kopija. Narediti morate prevzem datotek iz strežnika.

  • Povsem preprosto je uvoziti v napačno mapo znotraj hierarhije skladišča.

For these reasons we recommend that you do not use the import command at all but rather follow the two-step method described in “Uvažanje na mestu”, unless you are performing the simple step of creating an initial /trunk /tags /branches structure in your repository. Since you are here, this is how the basic import works ...

Preden projekt uvozite v skladišče, morate:

  1. Odstraniti vse datoteke, ki niso potrebne za gradnjo projekta (začasne datoteke, datoteke, ki jih generira prevajalnik, n. pr. *.obj, prevedene dvojiške datoteke...).

  2. Organizirajte datoteke v mape in podmape. Čeprav je možno preimenovanje/premikanje tudi kasneje, je zelo priporočljivo, da postavite strukturo projekta pred uvažanjem.

Sedaj izberite vrhnjo datoteko vašega projekta v Raziskovalcu in desno kliknite. S tem odprete kontekstni meni. Izberite ukaz TortoiseSVNUvozi..., ki prikaže naslednje okno:

Slika 4.6. Okno za uvažanje

Okno za uvažanje


In this dialog you have to enter the URL of the repository location where you want to import your project. It is very important to realise that the local folder you are importing does not itself appear in the repository, only its content. For example if you have a structure:

C:\Projects\Widget\source
C:\Projects\Widget\doc
C:\Projects\Widget\images
      

and you import C:\Projects\Widget into http://mydomain.com/svn/trunk then you may be surprised to find that your subdirectories go straight into trunk rather than being in a Widget subdirectory. You need to specify the subdirectory as part of the URL, http://mydomain.com/svn/trunk/Widget-X. Note that the import command will automatically create subdirectories within the repository if they do not exist.

Sporočilo uvoza se uporabi kot sporočilo dnevniškega zapisa.

Po privzetih nastavitvah se datoteke in mape, ki ustrezajo splošnemu vzorcu prezrtih elementov, ne uvozijo. Če želite to pri posameznem uvozu spremeniti, potrdite potrditveno polje Vključi prezrte datoteke. Preberite “Splošne nastavitve” za več informacij o nastavljanju splošnih vzorcev prezrtih elementov.

Ko pritisnete gumb V redu, TortoiseSVN uvozi celotno strukturo map, vključno z vsemi datotekami, v skladišče. Projekt je sedaj shranjen v skladišču pod nadzorom različic. Upoštevajte, da mapa, ki ste jo uvozili, NI pod nadzorom različic! Da bi dobili delovno kopijo datotek pod nadzorom, morate narediti prevzem verzije, ki ste jo pravkat uvozili. Ali pa berite naprej, da izveste, kako uvoziti mapo na mestu.

Uvažanje na mestu

Ob predpostavki, da skladišče že imate in želite dodati vanj novo drevesno strukturo, naredite naslednje:

  1. Use the repository browser to create a new project folder directly in the repository. If you are using one of the standard layouts you will probably want to create this as a sub-folder of trunk rather than in the repository root. The repository browser shows the repository structure just like Windows explorer, so you can see how things are organised.

  2. Checkout the new folder over the top of the folder you want to import. You will get a warning that the local folder is not empty. Ignore the warning. Now you have a versioned top level folder with unversioned content.

  3. Uporabite TortoiseSVNDodaj... na mapi pod nadzorom. S tem lahko dodate delno ali celotno vsebino, dodate ali odstranite datoteke, nastavite lastnosti svn:ignore na mapah in naredite vse ostale spremembe, ki so potrebne.

  4. Objavite vrhnjo mapo in dobili ste novo drevo pod nadzorom in krajevno delovno kopijo, ustvarjeno iz obstoječe mape.

Posebne datoteke

Včasih imate v sistemu različic datoteko, ki vsebuje podatke, specifične za uporabnika. To pomeni, da imate datoteko, ki jo mora vsak uporabnik urediti, da ustreza njegovi/njeni namestitvi. Imeti takšno datoteko pod nadzorom je težko, ker bi vsak uporabnik ob vsaki objavi objavil svoje spremembe te datoteke.

V takšnih primerih priporočamo uporabo predlog. Ustvarite datoteko, ki vsebuje vse podatke, ki jih razvijalci potrebujejo, jo dodajte v sistem nadzora različic in pustite, da jo razvijalci prevzamejo. Nato si vsak razvijalec naredi kopijo te datoteke in jo preimenuje. Po tem spreminjanje kopije ni več problematično.

As an example, you can have a look at TortoiseSVN's build script. It calls a file named default.build.user which doesn't exist in the repository. Only the file default.build.user.tmpl. default.build.user.tmpl is the template file which every developer has to create a copy from and rename that file to default.build.user. Inside that file, we added comments so that the users will see which lines they have to edit and change according to their local setup to get it working.

So as not to disturb the users, we also added the file default.build.user to the ignore list of its parent folder, i.e. we've set the Subversion property svn:ignore to include that filename. That way it won't show up as unversioned on every commit.