如果您是开发人员,版本控制软件允许您跟踪代码更改。这对于您作为团队成员工作的项目至关重要,可让您在更改发生时跟踪更改。虽然像GIT这样的服务很受欢迎,特别是对于开源软件,但像(open-source software)Subversion ( SVN ) 这样的替代方案提供了更多的控制。
存在各种SVN客户端,但对于Mac用户来说,一个流行的选项是SvnX。十多年前,我们第一次接触到这个简单、免费和开源的Mac SVN客户端,从那时起就有大量的新功能和变化可供深入研究。如果你想使用SvnX,这里有你需要知道的一切。
什么是(SVN)颠覆?
其他类型的版本控制,如GIT,依赖于分散的版本控制方法。每个工作人员都会获得一份代码副本,他们处理该代码,然后将更改修补(提交)到更大的代码库中。
Apache Subversion的工作方式不同。Subversion不是去中心化的方法,而是中心化的。只有一个单一的中央代码存储库,每个开发人员都在自己的部分上工作。对代码的每次修订都进行了跟踪,可以轻松恢复到过去的版本。
这为管理员提供了更多的控制权、更高的安全性,并且可以成为一个更容易开始使用的系统。如果集中式方法适合您,那么安装SvnX是您在Mac上使用(Mac)Subversion的第一步。该客户端向Subversion终端应用程序添加了一个GUI界面。(GUI)
在 macOS 上安装 SvnX Subversion
以前版本的SvnX需要在 macOS 上手动安装Subversion,然后客户端才能工作。值得庆幸的是,macOS 现在包含最新版本的Subversion,因此不再需要。
要安装和运行最新版本的SvnX,您需要安装适用于 macOS的Homebrew 包管理器。(Homebrew package manager)SvnX的其他可用版本,包括那些在“官方”上提供但早已被废弃的 SvnX 网站(long-since abandoned SvnX website),由于其较旧的 32 位状态,根本无法在最近的 macOS 安装上运行。
- 如果您没有在 macOS 上安装Homebrew,请打开终端窗口并输入/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )”开始安装。等待(Wait)下载和安装脚本完成,然后按照屏幕上的说明进行操作。
- 安装 Homebrew 后,在终端中输入brew cask install svnx,然后回车。这将下载并安装适用于 macOS 的最新 64 位版本的 SvnX。安装过程(brew cask install svnx in the terminal, and hit enter. This will download and install the latest, 64-bit version of SvnX available for macOS. Homebrew will alert you once the installation process has been )完成后,Homebrew 会提醒您。
- 您可以从Launchpad启动(Launchpad)SvnX ,或者在(SvnX)Finder的(Finder)Applications文件夹中双击该应用程序。但是,第一次执行此操作时,出于安全原因,macOS 可能会阻止该尝试。您需要通过单击Launchpad > System Preferences > Security & Privacy SvnX启动,然后在General选项卡中单击SvnX启动警告旁边的Open Anyway按钮。(Open Anyway)
- 在启动之前,macOS 会要求您进行最终批准。单击打开(Open)以允许SvnX最终启动应用程序。
首次启动后,macOS 将允许SvnX运行而不会出现任何进一步的安全问题。
如何使用 SvnX 颠覆(How To Use SvnX Subversion)
当您第一次启动SvnX时,您将看到一个相当基本的屏幕。左侧列出了两个类别,称为工作副本(Working Copies)和存储库。(Repositories.)
存储库是您连接到的中央SVN服务器。(SVN)SVN存储库包含项目的所有文件。当您更新文件时,会添加一个新的修订标签,以便您区分存储库文件的旧副本和新副本。
工作副本是保存存储库文件的本地副本的位置。这允许您在将文件提交到存储库之前在本地对文件进行更改。文件通常分为不同的焦点区域,如主干(trunk )(用于稳定副本)、分支(branch)(用于正在积极开发的文件)和标签(tag )(用于主 repo 的副本)。
- 要添加新存储库,请单击左侧菜单中的设置按钮,然后单击(Settings button)添加存储库(Add Repository)。
- 您需要提供有关您的 Subversion 服务器的详细信息以允许您连接。在URL(URL)框中键入SVN存储库服务器,在 Name下为存储库提供一个容易记住的名称(Name)。如果您有用户名和密码,请在“用户(Username)名”和“密码(Password)”框中键入这些内容。
- 准备好详细信息后,双击左侧菜单中的存储库条目,或单击Details > Refresh Now。这将打开您的SVN存储库的访问菜单,允许您访问现有的存储库文件和过去的修订,并根据需要进行更改。
- 如果要将 SV 存储库的副本导出为工作副本(working copy)以进行本地编辑,请选择修订版(在Rev.列下编号),然后选择屏幕底部的文件夹。
要制作本地副本,请单击右上角的Checkout按钮。在单击“结帐(Checkout)”按钮 之前,请确认您要将这些文件保存在何处。
- 您将能够在SvnX主启动窗口中找到有关已保存工作副本的更多信息,该窗口在左侧菜单的工作副本下列出。(Working Copies)对SVN(SVN)工作副本进行更改后,双击主SvnX启动窗口中的条目。
在出现的“工作副本”(Working Copy)窗口中,选择您已编辑的任何文件夹或文件夹,然后单击“提交(Commit)”将其保存为中央SVN存储库的新修订。
您所做的每个新修订都将在您的SVN服务器的存储库(Repository)窗口中列出。如果需要,您可以在旧版本上创建新的工作副本以“分叉”您的代码并恢复到旧版本。
使用 SvnX 进行有效的版本控制(Effective Version Control with SvnX)
如果您没有使用版本控制系统,那么您对代码所做的每一次更改都是最终的。您无法向后移动,也无法撤消您进一步做出的更改。在Mac上使用SvnX有助于解决这个问题,提供了一种简单有效的方法来跟踪代码更改。
不过, SvnX(SvnX)有点过时了,所以如果它不是适合您的Mac SVN客户端,请随意使用(Mac SVN)Versions之类的替代方案。当然,在你能走路之前你不能跑步,所以如果你想学习如何编码(learn how to code),有许多服务和应用程序可以帮助你。
Get Started with Subversion using SvnX
If you’re a dеveloрer, version control software allоws you to keep track of changes to your code. This is essentiаl on projects where you’re wоrking as part of a team, letting yоu track changes as they happen. While services like GIT are рopular, especially for open-source software, alternatives like Subversion (SVN) offer more control.
Various SVN clients exist, but for Mac users, a popular option is SvnX. We first touched upon this simple, free, and open-source Mac SVN client over a decade ago, with plenty of new features and changes to dive into since then. If you want to use SvnX, here’s everything you need to know to get started.
What is (SVN) Subversion?
Other types of version control, like GIT, rely on a decentralized approach to version control. Each worker gets a copy of the code, they work on that code, and the changes are then patched (committed) onto the larger codebase.
Apache Subversion works differently. Rather than a decentralized approach, Subversion is centralized. There’s only a single, central code repository, with each developer working on their own parts to it. Each revision to the code is tracked, with the ability to revert to past versions made easy.
This offers administrators more control, more security, and can be an easier system to begin using. If the centralized approach is for you, then installing SvnX is your first step to using Subversion on Mac. This client adds a GUI interface to the Subversion terminal app.
Installing SvnX Subversion on macOS
Previous versions of SvnX required a manual install of Subversion on macOS before the client would work. Thankfully, macOS now includes a recent version of Subversion, so this is no longer necessary.
To install and run the most up-to-date version of SvnX, you’ll need to install the Homebrew package manager for macOS. Other available versions of SvnX, including those provided on the “official” but long-since abandoned SvnX website, simply won’t work on recent macOS installations because of its older 32-bit status.
- If you don’t have Homebrew installed on macOS, open a terminal window and type /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” to begin the installation. Wait for the download and installation script to complete, and follow any on-screen instructions.
- Once Homebrew is installed, type brew cask install svnx in the terminal, and hit enter. This will download and install the latest, 64-bit version of SvnX available for macOS. Homebrew will alert you once the installation process has been completed.
- You can launch SvnX from Launchpad, or by double-clicking on the app in the Applications folder in Finder. However, the first time you do this, macOS will likely block the attempt for security reasons.
You’ll need to allow SvnX to launch by clicking Launchpad > System Preferences > Security & Privacy and, in the General tab, clicking the Open Anyway button next to the SvnX launch warning.
- Before launching, macOS will ask you for final approval. Click Open to allow SvnX to finally launch the app.
After its first launch, macOS will allow SvnX to run without any further security issues.
How To Use SvnX Subversion
When you first launch SvnX, you’ll be presented with a fairly basic screen. Listed on the left are two categories called Working Copies and Repositories.
Repositories are the central SVN servers you connect to. An SVN repository holds all the files for your project. When you update a file, a new revision tag is added to it, allowing you to distinguish between older and newer copies of your repository files.
Working copies are where local copies of repository files are saved. This allows you to make changes to your files locally before you commit them to the repository. Files are usually separated into different focus areas like trunk (for stable copies), branch (for files under active development) and tag (for copies of the main repo).
- To add a new repository, click the Settings button in the left-hand menu and click Add Repository.
- You’ll need to provide details about your Subversion server to allow you to connect. Type the SVN repository server in the URL box, giving the repository a memorable name under Name. If you have a username and password, type those in the Username and Password boxes.
- Once your details are in place, double-click on the entry for your repository in the left-hand menu, or click Details > Refresh Now. This will open the access menu for your SVN repository, allowing you to access existing repository files and past revisions, and make changes as required.
- If you want to export a copy of your SV repository as a working copy to make local edits, select a revision (numbered under the Rev. column), then select a folder at the bottom of the screen.
To make a local copy, click the Checkout button in the top-right. Confirm where you’d like to save these files before clicking the Checkout button.
- You’ll be able to find more information about your saved working copy in the main SvnX launch window, listed under Working Copies in the left-hand menu. Once you make changes to your SVN working copy, double-click on the entry in the main SvnX launch window.
In the Working Copy window that appears, select any folders or folders that you’ve edited, then click Commit to save it as a new revision to your central SVN repository.
Each new revision you make will be listed in the Repository window for your SVN server. You can make new working copies on older revisions to “fork” your code and revert back to an older version, should you need to.
Effective Version Control with SvnX
If you’re not using a version control system, every change you make to your code is final. You can’t move backward, and you can’t undo the changes you make further down the line. Using SvnX on Mac helps to deal with this problem, offering a simple and effective way to keep track of code changes.
SvnX is a little outdated, though, so feel free to use an alternative like Versions if it isn’t the right Mac SVN client for you. Of course, you can’t run before you can walk, so if you want to learn how to code, there are a number of services and apps out there to help you.