电子创作和编辑环境的最大优势之一是可以轻松地创建和修改文件。这种能力意味着可以快速捕捉、探索和开发各种创意和想法,但这也意味着要跟踪对源代码和电子设计数据等有价值文件所做的更改是很困难的。
跟踪对文件进行修改的需要,加上需要一个系统的解决方案来管理以电子形式捕获的源代码,使得版本控制系统(VCS)应运而生。版本控制系统是一种软件工具,不仅能够保持文件的各种版本的历史记录,还支持打开该文件的任何修订版本,以及比较文件的任何两个版本之间的不同。版本控制系统通常会通过为文件夹和文件提供额外的版本控制功能和操作来与本地“操作系统”(OS)集成。
版本控制系统可以完全独立于用于创建文件的写作和编辑环境来操作。版本控制系统提供允许您将文件添加提交至一个称为中央存储库的中央存储区域的界面、将文件从中央存储库复制到活动文件夹的检出功能、重新检入对中央存储库的任何更改的提交功能,以及记录有关更改的信息的方法。
These features are found in Windows shell extensions such as the Tortoise client, and are also included in Altium NEXUS itself. VCS operations can be performed within the Altium NEXUS environment, without the need to access the OS file system.
通常情况下,版本控制系统也可以处理文件被多人检出和修改的情况,然后他们可以相互检查他们的更改,可能会失去最新版本的工作。要处理这个问题,需要使用工具来比较文件版本以检测差异,以及将差异合并回单一版本的文件的交互式工具,例如Altium NEXUS PCB ”协作”功能。
了解版本控制系统使用的术语是很有帮助的。尽管有许多可用的系统,但是它们通常都使用类似的术语来描述它们的功能。
版本控制基础
The basic approach to working with a Version Control System (VCS) is to access a copy of the project files that you want to work on from a repository, edit the files in Altium NEXUS and then ‘commit’ the modified files back to the repository. The interaction with the repository is through a version control system interface, Altium NEXUS内置在该界面的“储存管理器”面板和“项目”面板中。
-
Subversion 版本控制系统
- 下图显示了Subversion中央存储库的概念,该中央存储库包含一系列设计文件修订版(最多5版),并在工作文件夹中检出 (文件 » 检出) 最新的副本。当工作文件夹中的文件在Altium NEXUS环境中打开时,Altium NEXUS会认识到项目文件处于版本控制之下,其当前版本控制状态显示在“储存管理器”和“项目”面板中。
-
-
Git VCS
The figure below illustrates the concept of a Remote Git repository share that holds a sequence of design file revisions (up to revision 5), where its content has been copied to a local Working Git repository – typically by Cloning the remote repository or Pulling its data into the working repository. When the files in the working repository are opened in the Altium NEXUS environment, Altium NEXUS recognizes that a project file is under Git version control, with its current version control status being shown in both the Storage Manager and Projects panel.
- ► See Add To Git Version Control and Clone a Git repository for more information.
In both of the above VCS systems, the link between the source repository and the working location is referenced in the latter’s VCS database (in the .svn
or .git
system subfolder).
► See Using Version Control for more information on working with SVN and Git version control systems in Altium NEXUS.
When VCS working files are open in Altium NEXUS the right-click menu in the Storage Manager panel (and the Projects panel) allows you to a perform standard VCS actions, such as committing a changed file to the central repository (SVN) or working respository (Git).
The Commit command registers the updated file in the repository, increments the revision number (stored internally in the VCS), logs a message that you can enter to describe the changes made to the file, and in the case of Subversion, stores the copy of the file in the central repository. In the Git arrangement, the updated file may be copied from the Working repository to the Remote repository at any time using the Push command.
The Altium NEXUS Version Control interface can be accessed directly from the Projects panel or from the Storage Manager panel, where more options are available.
Both the SVN and Git version control capabilities that are available in Altium NEXUS are enabled by their respective
Extensions –
VCS Provider - SVN and
VCS Provider - Git. These are installed by default and may be accessed through the software’s
Extension & Updates view.
多用户访问
In most situations a company’s Version Control infrastructure will be based on central server-based SVN or Git repositories, served over the network using one of the available protocol methods – svn
, svn+ssh
, https
, etc. This provides access to all users on the network, subject to server-based permissions, and a vehicle for collaborative project development from a single managed source.
In turn, the multiple access capabilities allows different team members to continue working on a project independently, without having to wait for someone else to check a file back in before they can work on it. A centralized Git version control system takes this advantage one step further by allowing files to be committed to the local working repository as you work, and those committed changes ‘pushed’ back to the central Git repository at any later time – and as such, does not require a network connection until then.
Nevertheless a team compatible VCS does require that the tools and techniques are available to resolve the inevitable situation where two users have modified the same file. When these capabilities are available, the foundation is in place for true multi user design collaboration and its associated benefits.
To support this situation, Altium NEXUS includes schematic and PCB comparison (or 'diff') capabilities, available through the Storage Manager and Collaborate, Compare and Merge panels. Altium NEXUS offers sophisticated PCB design collaboration features that allow file merge differences to be viewed and resolved within the editor, to ultimately create a new Head revision in the VCS. The advanced PCB collaboration functionality also allows for live design collaboration between multiple users, with the ability to define and assign sections of a design as user Work Regions.
► See Using Version Control for a guide to applying version control to project design in Altium NEXUS.
版本控制系统中央存储库
在使用版本控制之前,项目文件必须被版本控制系统和Altium NEXUS识别为处于版本控制之下。对于不同的版本控制系统方法和应用程序,这个过程可能是不同的,但是它基本上需要创建和/或连接到设计中央存储库并将设计项目文件添加到该中央存储库中。
设计中央存储库基于数据库结构,并在内部将信息存储在文件和目录的层次结构中,这称为文件树。 The actual repository that you connect can be a central SVN repository, a Git working repository (that is associated with a remote Git repository), 也可以是在可访问位置(如本地个人电脑或共享网络位置)创建的中央存储库。
根据中央存储库的类型,可以通过一系列协议访问中央存储库,包括:
- 传统的文件访问,通常用于本地或基于网络的中央存储库。
- 使用纯文本或TCP / IP,通过svn协议访问基于服务器的中央存储库。 – or the secure
svn+ssh
equivalent.
- 使用http方法访问基于服务器的中央存储库,通常使用http上的WebDAV – or the secure
https
equivalent.
Subversion (SVN) 中央存储库连接到,并在必要时在“优选设置”对话框的“数据管理-设计中央存储库”页面中创建。
- Git type repositories are created outside of Altium NEXUS, and the content of a local working Git repository is accessed by opening files from its host folder.
- The management of both remote and local working Git repositories is typically through company systems and external Git tools, while file level operations (Commit, Push, Update etc) are handled in the Altium NEXUS editing environment.
- The management of repositories is handled automatically when using Managed Projects in an Altium managed content server.
连接到SVN中央存储库
要连接到现有的SVN设计中央存储库,使用 按钮打开“SVN设计中央存储库”对话框。这提供了设计中央存储库属性设置,使您可以为检出的设计文件定义中央存储库连接的本地名称及其目标文件夹路径。
When an existing SVN repository is registered in Altium NEXUS it allows design files to be included under Subversion version control.
对话框的中央存储库选项需要配置为匹配可用中央存储库的位置,一个可选的子文件夹目标以及用于连接的兼容协议方法。请注意,svn和http访问方法需要与主机服务器及其访问相关的附加信息。
This connection process is not required for a repository that is available in (has been added to) an Altium managed content server. Altium NEXUS will automatically connect to the server-hosted SVN/Git repository(s) when a user signs in to that server. See Accessing a Server from Altium NEXUS.
有关更多信息,请参阅:
► “优选设置”对话框的“数据管理-设计中央存储库”页面。
► SVN设计中央存储库对话框页面。
创建一个中央存储库
To create a local SVN design repository, go to the Data Management – Design Repositories page of the Preferences dialog and use the button to open the Create SVN Design Repository dialog.
To create a local SVN design repository, go to the Data Management – Design Repositories page of the Preferences dialog and use the button to open the Create SVN Design Repository dialog.
要创建一个本地的SVN设计中央存储库,请进入“优选设置”对话框的“数据管理-设计中央存储库”页面,并使用按钮打开“创建SVN设计中央存储库”对话框。
该对话框提供了一系列配置选项,使您可以定义中央存储库的文件夹位置和方法(连接协议)以及检出的设计文件的本地连接名称和目标文件夹路径。请注意,svn和http访问方法需要与主机服务器及其访问相关的附加信息。有关更多信息,请参阅上面的链接。
指定或创建将被配置为指定的版本控制系统中央存储库的本地文件夹。
安装的版本控制系统随后将在指定的中央存储库文件夹中创建正确的版本控制文件结构和数据库。一旦创建和注册,新的中央存储库条目将被连接并列在“优选设置”对话框的“数据管理——设计中央存储库”页面中。点击 或 确认更改。
创建版本控制系统中央存储库的过程(传统上使用外部(单独的)版本控制系统客户端完成)可以直接在Altium NEXUS的“优选设置”对话框中完成。
Use a SVN Repository
通过Altium NEXUS可用的新的或现有的设计中央存储库,可以使用“储存管理器”和“项目”面板以及主菜单中的命令,向中央存储库中添加和从中央存储库检索(检出)项目设计文件。由于中央存储库文件在版本控制下存在,因此所有的设计修订都可以在Altium NEXUS中进行跟踪和访问。
使用“储存管理器”或“项目”面板中的项目名称右键单击上下文菜单,将完整的项目文件夹(及其组成设计文件)添加、提交至版本控制 - 版本控制 » 将项目文件夹添加至版本控制。
Alternatively, a new project can be added to version control while being created through the New Project dialog – File » New » Project » Project. Choose VCS
as the Project Kind and select the target respository from the registered options in the Repository drop down menu.
The design files under version control in the repository can be subsequently checked out and loaded in Altium NEXUS using the File » Check Out command, and ultimately Committed back to the repository (checked in) as new revisions when the edits are complete.
一旦在Altium NEXUS中可以访问兼容的版本控制系统存储库,可以将设计文件添加到并从中央存储库中检出。
► 请参阅“使用版本控制”获取将版本控制应用于Altium NEXUS中的项目设计文件的指南。
Altium Managed Content Server VCS
Most advanced form of working with projects under version control is to harness the capabilities of an Altium managed content server, such as an Altium NEXUS Server. The server offers the advanced construct of a Managed Project, which offers a simplified workflow, full lifecycle management, enhanced collaboration capabilities and more.
The target VCS repository in a managed content server is tightly integrated with both the server and Altium NEXUS (when signed in), which eliminates the need to setup and configure separate VCS repositories. User/Group access, the repository content and the status of projects can be managed through the server browser interface. In Altium NEXUS, projects are managed in the Explorer panel and the usual VCS commands are available in the Projects and Storage Manager panels.
For more information see:
► Managed Projects and Releasing a Design
► Working with a Managed Content Server
Additional information
Version Control Terminology
Version Control Terminology
VCS
|
Version Control System: A generic term applied to any tool that is capable of managing file version history and file retrieval.
|
Repository
|
The master storage of all the files under version (or source) control – can also be known as the database.
|
Database
|
The master record of all the files under version (or source) control – also known as the Repository in practice.
|
Check-in
|
To save your working copy of the file into the repository. Referred to as Commit in Altium NEXUS.
|
Check-out
|
To take a copy of a file from the VCS repository into a working folder. This is generally the latest revision of the file, but all earlier revisions can also be checked out. Depending on the VCS, the file can be flagged as simply checked-out, or checked-out exclusively (locked).
|
Commit
|
Save the working copy of the file back into the repository. Referred to as Check-in in some version control systems. In Altium NEXUS, the normal Save command saves an edited file to the working folder, whereas Commit saves that folder file to the repository as a new revision (version).
|
Push |
To update a remote Git repository with the file(s) in its local working repository – to synchronize the local and remote repositories. This command is available when a file in the local Git repository is newer than its counterpart in the remote Git repository. Notionally the compliment of a Git Pull command.
|
Conflict
|
The situation when two Altium NEXUS users attempt to commit changes that affect the same region of the same file. These must be resolved, either using a Merge tool, manually, or by determining which version will dominate (become the new revision).
|
Update
|
The act of checking for and 'pulling in' changes from the repository version of a file to a working copy (the compliment of Commit, or Check-in). The process of merging in any differences requires a Merge tool, or manual updating.
|
SVN |
Subversion is an open source version control system. Altium NEXUS incorporates SVN capabilities (through the VCS Provider - SVN extension), allowing revisions to be directly tracked and accessed from its Storage Manager and Projects panels.
|
Git
|
Git is an open source version control system. Altium NEXUS incorporates Git capabilities (through the VCS Provider - Git extension), allowing revisions to be directly tracked and accessed from its Storage Manager and Projects panels.
|
Clone |
A Git command that copies (clones) a remote Git repository to a working Git repository in a local folder, while automatically checking out the HEAD (latest) version to the folder. The local repository includes the link reference to the remote repository (origin in this case), so files that are are updated in the local working repository may be uploaded to the remote repository using the Push command. |
Working folder
|
The folder where files are checked out to from the repository, so they can be worked on – with Git, this is a local Working Repsitory. Files checked out from Altium NEXUS are automatically loaded.
|
Log message
|
A comment about changes made to a revision when it is checked back in (committed) to the repository. The log messages can be used as a summary of the progress of changes in a file.
|
Working copy
|
The 'local' copy of a file that changes are made to – normally resides in the Working Folder.
|
Revision
|
A committed change in the history of a file or set of files. This is the alpha-numerical reference supplied by the VCS to track the different editions (versions) it is holding of the file.
|
Head
|
The latest revision committed to the version control system.
|
Base |
The revision in the repository that you checked out to be your local Working Copy. Also called the checked out revision.
|
Project |
Many version control systems support the concept of a project. A VCS project is a set of related files which can be checked-in/out as a set. The VCS may also support other project-type features, such as setting a version number on all files in a project. This is distinct from the concept of an Altium NEXUS project, which can be added to Version Control using the 'Add Project Folder to Version Control' command. |
References
References