SVN Terminologies - checkouts, working copy, property, repository

后端 未结 3 1912
自闭症患者
自闭症患者 2021-01-02 08:24

While I\'m trying to learn how to use svn:externals, I\'m having hard time understanding the differences of these terms. How are they different?

  • <
3条回答
  •  醉酒成梦
    2021-01-02 08:47

    These are key Subversion concepts that should be clear from the beginning. The official Version Control with Subversion book has a Version Control Basics chapter with a brief overview but I'll explain them here with my own words:

    Main concepts

    Repository

    It's the central database where all the important data (including files and version history) is stored.

    You don't interact directly with the repository files, just like you don't edit MySQL data files. More specifically, you don't copy your source code there. Instead, you use a Subversion client to perform specific Subversion stuff. For this reason, you never refer to the repository by its file system path. Instead, you use an URI:

    • file:///C:/Data/Subversion/foo
    • svn://svn.example.com/foo
    • http://svn.example.com/foo
    • https://svn.example.com/foo

    The URI prefix depends on what tools you've configured.

    You only have one repository for given project because Subversion is a centralised version control system.

    Working copy

    It's the local directory tree where you can see your files and work with them.

    You work with your working copy files the same way you did before using version control: launch your editor/IDE, make changes, compile/run. The only difference is that your files are linked to a specific revision in the repository. As such, you need to take some extra steps:

    1. You have to create the working copy once so it's linked to the appropriate repository. That's called check out.

    2. You have to send your changes to the repository so they're saved in the common history and become available to others: that's called commit.

    3. You possibly want to fetch whatever changes some other co-worker has made: that's called update.

    You refer to working copies by their file system path:

    • C:\MyProjects\Foo\code

    You can have as many working copies as you need, even if they point to the same place.


    Other concepts

    Trunk

    It's a subdirectory that contains a copy of your code and you've decided that it represents your main development line. E.g.:

    • /trunk

    It's only a convention (the directory is not special for Subversion) but recommended and widely used.

    Branch

    It's a subdirectory that contains a copy of your code and you've decided that it represents a fork in your code (an unfinished task, a customization, a legacy version you still maintain...). E.g.:

    • /branches/unicode

    It's only a convention (the directory is not special for Subversion) but recommended and widely used.

    Tag

    It's a subdirectory that contains a copy of your code and you've decided that it represents a given release. You never write to it. E.g.:

    • /tags/2.0.0-alpha

    It's only a convention (the directory is not special for Subversion) but recommended and widely used.

    Property

    Subversion allows to store additional information regarding revisions, files and folders. Each piece of data is a property. That information is specific to Subversion and does not exist outside, thus you need specific tools to read and write them.

    Project

    This is not a Subversion term. It's just a common way to refer to all the stuff related to a specific piece of work you're doing.

提交回复
热议问题