SVN Terminologies - checkouts, working copy, prope

2020-02-28 06:32发布

问题:

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?

  • working copy and checkout

    Sometimes it is useful to construct a working copy that is made out of a number of different checkouts. (source)

  • property

    In Subversion, you declare externals definitions in groups using the svn:externals property. (source)

  • repository

    As a result branches and tags are very quick to create, and take up almost no extra space in the repository. (source)

    For example, you may want different files or subdirectories to come from different locations in a repository, or perhaps from different repositories altogether. (source)

  • project

    Set the svn:externals property for a folder in your project. (source)

I guess a working copy is a set of project files and a checkout is a working copy of project files or trunk files. Property sounds like a file but it just could be a definition instruction but I'm not sure. I also have hard time understanding the differences between repository and trunk. If I say "Users download the repository.", it is similar to say "Users download the trunk files."

Sorry, this must be a very basic English question!

回答1:

  • Working Copy (noun) - directory tree, which holds some slice of repository
  • Checkout (verb) - action of getting initial content from repo to folder, which become Working Copy after it
  • Property (noun) - attribute of repository-object
  • Repository (noun) - storage of versioned data and related metadata, with which interacts clients
  • Project (noun) - (in quoted context) combination of WC and related repo (ORed), may have meaning of WCs-set, which form full product

Repository is logical tree, there trunk is part of this tree



回答2:

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.



回答3:

I'm posting some descriptions I found online by myself.

Repository

At the core of the version control system is a repository, which is the central store of that system's data. The repository usually stores information in the form of a filesystem tree—a hierarchy of files and directories. Any number of clients connect to the repository, and then read or write to these files.

http://svnbook.red-bean.com/en/1.7/svn.basic.version-control-basics.html

Working Copy

A working copy is, quite literally, a local copy of a particular version of a user's VCS-managed data upon which that user is free to work. Working copies appear to other software just as any other local directory full of files, so those programs don't have to be “version-control-aware” in order to read from and write to that data.

http://svnbook.red-bean.com/en/1.7/svn.basic.version-control-basics.html

Checkout

...checkout creates a working copy, whereas update brings down changes to an existing working copy. by karoberts

...a checkout includes the .svn dirs thus it is a working copy and will have the proper info to make commits back (if you have permission). by notbenh

svn checkout allows you to use version control in the directory made by Gerald Kaszuba