Home > Article > CMS Tutorial > WordPress Checkout revisited using Subversion
There are many reasons to like looking at open source software, one of which is the ability to learn from the code that others have built.
Other examples include:
Although there is a lot of open source software out there, it can be difficult to know how to keep up with such a pace of development when you are unfamiliar with the tools.
If you are an experienced developer who knows how to use bug trackers, version control, etc., then you are not the target audience for this tutorial. However, if you are a fan of WordPress and want to know how to keep up with the development of your project, then read on.
In this article, we’ll look at what nightly builds are, how to prepare our systems to get the latest version of WordPress source code every day, and how to use it ourselves.
Before we understand how to get the latest version of the source code every day, it is important to understand the definition of a "nightly build".
This sentence is not unique to WordPress. In fact, many software, both open source and closed source, include nightly builds. Whether we as the public have access to them is another matter.
Even Wikipedia defines this in the simplest of terms:
An event that occurs once a night.
Then again, the phrase itself doesn’t exactly sound like a technical term, does it? It doesn't matter.
Since we are talking about WordPress, and WordPress is open source, we will look at it from this perspective. According to the WordPress project’s Nightly Builds page:
You can track changes on the web or through our SVN mailing list, but many people choose to run nightly builds to help us identify bugs. If you would like to participate in this process, please join the WP testers mailing list and download the latest nightly build.
If you are interested in getting involved more than just getting the source code and following the steps above, please visit the link above. In the rest of this article, we'll look at what's required to get a nightly version of your source code.
There are many different version control or source control services and applications available. WordPress projects use a self-hosted version of Subversion to handle version control of the project.
If you are new to Subversion, you can learn more on the software's home page. However, Subversion has been around for quite some time and is widely used in many different companies and projects.
Subversion is an open source version control system. Founded in 2000 by CollabNet, Inc., the Subversion project and software has experienced incredible success over the past decade. Subversion has been and continues to be widely adopted in the open source and corporate worlds.
This tutorial won't provide an in-depth guide on how to use Subversion and everything you can do with it, but it will give you everything you need to know to install Subversion on your computer and get the latest version of the WordPress source code .
Subversion can be used in one of two ways:
Because Subversion is so widely used, you have many different clients to choose from, no matter which operating system project you work on.
For example:
Of course, these are just a few of the options you have. No matter which operating system you are using, one thing we all have in common is that Subversion is available as a command line tool, so we will be using that in this tutorial.
Installing Subversion via the command line depends on the operating system you are using. If you are using Linux, you will need an installer of some kind. If you're using Windows or Mac OS X, you'll need one for each system.
Once installed, the commands we issue in the terminal for the rest of this tutorial will be the same.
First, navigate to the Subversion Binary Packages page and find the version that corresponds to your operating system.
Second, download the installer, step through the steps provided, and then return to this tutorial.
Finally, we need to make sure Subversion is installed correctly. To do this, open a terminal (or command prompt if you are using Windows) and enter the following command:
$ svn --version
You should see something similar to this printed in the console:
This will contain a line of information including the version of the Subversion client. For example:
svn, version 1.7.22 (r1694152) compiled Feb 10 2016, 16:22:46
But the actual output you see may be slightly different. The bottom line is, if you are able to execute the svn
command, you should be able to follow the rest of the steps in this tutorial.
Before getting the latest copy of WordPress, we need to make sure we have a directory set up where we will download the latest source code.
For me, since I'm on OS X, I would place them in /Users/tommcfarlin/Downloads. Therefore, all my commands will be relative to this directory. Your directory will be related to whatever directory you choose for yourself.
So, within my Downloads directory, I will create a directory called wp
that will house the source code we are looking at from the official repository. In the terminal, enter the command responsible for creating the new directory.
For me, that’s:
$ mkdir wp
Now I have an empty directory into which I can pull the WordPress source code via Subversion.
The act of pulling the latest version of source code from a Subversion repository is called "checking out." Therefore, to view the latest version of WordPress, we need to issue the Subversion command on the command line.
This requires a few things:
co
). Using this information, first change the directory within the wp
directory you just created, then issue a Subversion checkout command using the provided URL. The complete set of commands will look like this:
$ cd wp $ svn co https://core.svn.wordpress.org/trunk/
Once completed, the terminal should start printing information as it is pulling the latest version of the source code.
One very important thing to note is that this is great for experimentation. Do not try to push any code to the repository (you will need to submit patches in a formal way, which is beyond the scope of this tutorial).
Think of this as an easy way to get "read-only" source code.
At this point, you should see a trunk
directory inside the wp
directory you created before this step. Trunk is a Subversion naming convention through which the main line of development of a project is completed.
Technically, the directory can be named anything you want; however, the general convention used when working with Subversion repositories is:
Branch
tag
trunk
If you navigate to the trunk directory using the command line or even your operating system's user interface, you will see the directory structure familiar to WordPress applications.
This means you can actually set up a working version of WordPress just like downloading it from the project homepage.
In my previous post, I detailed what you need to install a WordPress application. If you are new to WordPress, check out this tutorial as it will provide you with all the information you need to get up and running with WordPress.
If you have already read it or are familiar with how to set up a local copy of WordPress, then please continue:
When completed, you will be running a cutting-edge copy of WordPress that includes all features under development. If you've never done this before, it would be really good to see what's coming downstream in the next release.
You will need to update it as you continue to use the source code or want to ensure that you are using the latest version of the source code.
由于我们使用版本控制,因此可以轻松使用 Subversion 来更新驻留在我们计算机上的代码副本。每当您准备更新(可能是每小时或每天晚上)时,您只需从 trunk
目录中发出以下命令:
$ svn update
这个命令将拉取自您上次查看最新版本的源代码以来合并的所有代码。请注意,当您这样做时,您将面临破坏安装中某些内容的风险,但这就是运行前沿夜间构建的本质。
虽然本教程的主要目的之一是引导您在计算机上安装 Subversion 并使用它来查看 WordPress 源代码,但您也可以随时使用此 URL 获取最新版本的 WordPress。
不,这绝不是获取源代码的“漫长之路”。相反,它是为了让您通过使用日常使用 WordPress 时使用的工具和流程,更多地以开发人员的身份工作。
无论您是想查看每天推送到 WordPress 核心的所有新内容,还是希望最终为应用程序提供补丁,访问每晚版本的代码都是非常有趣的.
如果没有别的事,访问 WordPress 等开源项目(有数百人正在积极致力于该项目)可以教会您很多有关处理错误报告、票证、补丁、功能、合并等的知识.
我不建议在本地开发环境之外的任何地方运行此代码。也就是说,如果您是一名开发人员并且您有兴趣测试前沿的代码,则夜间构建可以让您做到这一点。
对于那些有兴趣继续了解有关 WordPress 的更多信息的人,我们专门提供了几门关于此主题的课程。除此之外,我们还在市场上提供了大量插件供您下载、学习和在日常工作中使用。
如果您有兴趣从开发角度了解有关 WordPress 的更多信息,请注意,我专门使用 WordPress,并且经常撰写相关文章。您可以在我的个人资料页面上观看我的所有课程和教程,也可以在我的博客和/或 Twitter(@tommcfarlin)上关注我,我在其中谈论 WordPress 背景下的软件开发。
请随时在下面的提要中留下任何问题或评论,我会尽力回复每个问题或评论。
The above is the detailed content of WordPress Checkout revisited using Subversion. For more information, please follow other related articles on the PHP Chinese website!