站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
建站程序
开发
服务器
办公软件
开发教程
服务器教程
软件使用教程
运营教程
热门电子书
WordPress教程
宝塔面板教程
CSS教程
Shopify教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Using Subversion
”
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
__TOC__ __TOC__ '''This page only applies to developers, so if it's all Greek to you, don't worry!''' '''这个网页适用于开发人员,因此如果你完全不懂,请不要担心! ''' Most software projects, including WordPress, use a version-control system to keep track of their source code and its revisions behind the scenes, and periodically release versions of the software for public use. Prior to the [[WordPress:Changelog/1.5|WordPress 1.5]] release, the WordPress source code was stored in the CVS version-control system at [http://sourceforge.net/ Sourceforge]. Since WordPress 1.5, WordPress has been using its own installation of [http://subversion.tigris.org/ Subversion] for version control. Most WordPress users will never want to use Subversion, because they will only install the released versions of WordPress. However, developers of plugins and themes may want to test their software against the latest development version of WordPress, and people interested in [[WordPress:Contributing to WordPress]] by testing or fixing bugs will also need to have access to the code that is in development. 大多数软件包,包括WordPress,使用版本控制系统,追踪后台的源码和修订本,而且定期地发行软件,供公众使用。在发行[[WordPress:Changelog/1.5|WordPress 1.5版本]] 之前,WordPress源码储存在 [http://sourceforge.net/ Sourceforge]中的CVS版本控制系统中。从WordPress 1.5版本开始, WordPress 使用自身安装的 [http://subversion.tigris.org/ 子版本]进行版本控制。大多数用户永远都不想使用子版本,因为他们只会安装WordPress已经发行的版本。然而,插件和主题的开发人员可能想要测试最新的WordPress版本上的软件,而且有兴趣通过测试或者解决程序问题 [[WordPress:Contributing to WordPress|奉献于WordPress]]的人,也需要使用正在研发的代码。 This development code can only be accessed via Subversion. In this article, we'll cover the basics of connecting to the WordPress Subversion repository and running the commands that are available to most WordPress users. This article assumes that you have Subversion (or at least a Subversion client) installed already, and it only covers the most basic commands. For installation instructions, alternative clients, and more detailed information, check out these resources: 处于研发状态的代码,只有通常查看子版本,才能够被用到。在这篇文章中,我们会介绍一些基本信息,关于连接到WordPress子版本资源库,以及运行大多数WordPress用户能够使用的字符串。 * [http://subversion.tigris.org/ Subversion web site] * [http://subversion.tigris.org/faq.html Subversion FAQ] * [http://subclipse.tigris.org/ Subclipse] - a Subversion plugin for the [http://www.eclipse.org/ Eclipse] development environment * [http://tortoisesvn.tigris.org/ Tortoise SVN] - a popular Windows Subversion client * [http://svnbook.red-bean.com/ The Subversion Book] - available free online * [http://subversion.tigris.org/ 子版本网站] * [http://subversion.tigris.org/faq.html 子版本 FAQ] * [http://subclipse.tigris.org/ Subclipse] - [http://www.eclipse.org/ Eclipse] 发展环境的一个子版本插件 * [http://tortoisesvn.tigris.org/ Tortoise SVN] – 一个受欢迎的Windows子版本client * [http://svnbook.red-bean.com/ Subversion 书籍] – 在线免费获取 Note that if you choose to use Tortoise, Subclipse, or another graphical client, the commands below will be menu selections -- however, the same principles apply. Check the help files for your client to figure out how to connect to the repository and execute the equivalent commands. 注如果你选择使用Tortoise, Subclipse,或者其它的图形client,下面的命令就会是菜单选择—然而,同样的原则也可以使用。为你的client查看帮助文件,了解怎样链接到子版本资源库,执行对等的命令。 == Repository, Branches, Trunk, and Tags == == 资源库, Branches, Trunk, 标签 == The basic idea of Subversion is that the source code and revisions are kept in a ''repository'' on a server. Users connect to the repository by using a ''client'' program, which allows the user to check out, view, edit, patch, and commit changes to the source code files (depending on the client's permission level; in the WordPress project, only a couple of people have permission to commit changes to the repository). 子版本的基本理念是源代码和修订本保存在服务器的''资源库''中。用户可以使用''client''程序,连接到资源库,''client''程序能够使用户检查,浏览,编辑,修补,更改源代码文件(这取决于client的权限级别;在WordPress项目中,只有几个人拥有更改资源库的权限)。 The WordPress repository is at [http://svn.automattic.com/wordpress/ http://svn.automattic.com/wordpress/]. Within the repository, there are three sections: WordPress资源库在[http://svn.automattic.com/wordpress/ http://svn.automattic.com/wordpress/]。在资源库的内部,拥有三个部分: * '''trunk''': [http://svn.automattic.com/wordpress/trunk/ http://svn.automattic.com/wordpress/trunk/]always contains the latest development code * '''trunk''': [http://svn.automattic.com/wordpress/trunk/ http://svn.automattic.com/wordpress/trunk/]通常包含最近开发的代码 * '''tags''': When a version is released to the public, the source code is "tagged" with the version number. So for instance, WordPress 2.0.7 can be found at [http://svn.automattic.com/wordpress/tags/2.0.7/ http://svn.automattic.com/wordpress/tags/2.0.7/] * '''tags''':当一个版本公开发行的时候,源代码就会"标上"版本数字。因此,例如,WordPress2.0.7可以在[http://svn.automattic.com/wordpress/tags/2.0.7/ http://svn.automattic.com/wordpress/tags/2.0.7/]中找到。 * '''branches''': Sometimes when major new versions of WordPress are created, the WordPress development team makes a committment to maintain the previous release with bug fixes (usually limited to major bugs and security issues). So, for instance, the latest development code on the 2.0 branch of WordPress can be found at [http://svn.automattic.com/wordpress/branches/2.0/ http://svn.automattic.com/wordpress/branches/2.0/] * '''branches''':有时候,当新的WordPress版本创建的时候,WordPress开发小组承诺维护先前的版本,解决先前版本的程序错误(通过仅限于主要的程序错误和安全问题)。因此,例如,WordPress2.0版本的开发代码,可以在[http://svn.automattic.com/wordpress/branches/2.0/ http://svn.automattic.com/wordpress/branches/2.0/]中找到。 == Checking Out the Code == ==检查代码== Once you have Subversion installed, the first step you'll need to do is to ''check out'' the code, which basically means that you will download a version from the repository to your computer. To do this, make an empty directory for your copy of the code, change to that directory, and execute the [http://svnbook.red-bean.com/en/1.1/ch03s04.html checkout command] on the trunk, branch, or tag you are interested in. For instance, to check out the <tt>trunk</tt> (latest development version): 安装好了子版本,你需要做的第一步是''检查代码'',基本的意思就是你会从资源库中将版本下载到你的电脑上。要做到这一点,为你的代码制作一个空目录,更改到那个目录,然后在trunk,branch,或者你感兴趣的标签上执行[http://svnbook.red-bean.com/en/1.1/ch03s04.html checkout command],来check out <tt>trunk</tt>(最近发展的版本): <pre> svn co http://svn.automattic.com/wordpress/trunk/ </pre> <pre> svn co http://svn.automattic.com/wordpress/trunk/ </pre> After a short wait (depending on your Internet connection speed), the result will be that the directory is filled with all of the WordPress files, as well as some hidden <tt>.svn</tt> sub-directories containing Subversion information. 等待了一会后(等待时间取决于网络连接的速度),结果是目录填满了所有的WordPress文件,而且一些隐藏的<tt>.svn</tt>子目录包含了子版本信息。 == Updating Your Copy of the Code == == 更新你的那份代码 == If some time has passed since you checked out the code, and you would like to update to the latest version now available, use the [http://svnbook.red-bean.com/en/1.1/ch03s05.html#svn-ch-3-sect-5.1 update command], after first changing to the directory where you checked out the code originally: 如果你checked out代码后,已经过去了一段时间,而且你想要更新到现在的最新的版本,在切换到到你最初checked out代码的目录之后,使用[http://svnbook.red-bean.com/en/1.1/ch03s05.html#svn-ch-3-sect-5.1 更新命令]: <pre> svn update </pre> <pre> svn update </pre> == Exporting the Code == == 导出代码 == If you are not planning to do any editing, updating, hacking, or bug fixing in the WordPress code, but just want to download the latest version so you can install it somewhere, you can use the ''export'' command (after first creating a new directory to hold the results, and changing to that directory): 如果你不准备编辑,更新,hacking,或者解决WordPress代码的程序错误,只是想要下载最新的WordPress版本,将其安装在某个位置,你可以使用''导出''命令(首先创建一个新的目录保存结果,然后再转换为那个目录): <pre> svn export http://svn.automattic.com/wordpress/trunk/ </pre> <pre> svn export http://svn.automattic.com/wordpress/trunk/ </pre> This will give you the same WordPress code as using <tt>svn co</tt>, but without the hidden <tt>.svn</tt> directories. None of the other Subversion commands will work after an export -- you need to do a checkout if you want to use the other Subversion commands. 如使用<tt>svn co</tt>,这会给你提供同样的WordPress代码,但是没有隐藏的<tt>.svn</tt>目录。导出后,其它的任何子版本命令都不会运行—如果你想要使用其它的子版本命令,你需要checkout。 == Browsing the Code == == 浏览代码 == To list all the files in the repository, without updating, checking out, etc, you can use the <tt>list</tt> command: 在资源库中列出所有的文件,checking out,等等,你可以使用<tt>list</tt>命令: <pre>svn list http://svn.automattic.com/wordpress/trunk/</pre> To list files in a sub-directory, such as wp-includes: <pre>svn list http://svn.automattic.com/wordpress/trunk/wp-includes/</pre> <pre>svn list http://svn.automattic.com/wordpress/trunk/</pre> 在子目录中列出列表文件, 如 wp-includes: <pre>svn 列表http://svn.automattic.com/wordpress/trunk/wp-includes/</pre> There is also an [http://trac.wordpress.org/browser/ online browser] for the WordPress Subversion repository. 对于WordPress子版本资源库,也有一个[http://trac.wordpress.org/browser/ 在线浏览器]。 == Developer's commands == == 开发人员的命令 == If you are fixing bugs in WordPress, edit the files in the directory where you checked out the code. When you are ready to submit your fixes for inclusion in an upcoming version of WordPress, read [[WordPress:Reporting Bugs]] to find out how to create a bug ticket on [http://trac.wordpress.org/ Trac] (the WordPress bug tracking system), and then use the commands below. You may need to change to a sub-directory (such as <tt>trunk</tt>) to execute these commands. 如果你解决WordPress中的程序错误,在你check out代码的目录中编辑文件。当你准备将程序错误的解决方法递交到即将发行的WordPress版本的时候,请阅读[[WordPress:Reporting Bugs|报告程序错误]]找出怎样在[http://trac.wordpress.org/ Trac]创建程序错误ticket(WordPress程序错误追踪系统),然后使用下面的命令。 你可能要切换到一个子目录(例如 <tt>trunk</tt>)来执行这些命令。 * To get a list of the files you have changed, use the [http://svnbook.red-bean.com/en/1.1/ch03s05.html#svn-ch-3-sect-5.3.1 status command]: <pre> svn status </pre> *要得到你已经更改的文件的列表,请使用[http://svnbook.red-bean.com/en/1.1/ch03s05.html#svn-ch-3-sect-5.3.1 status command]: <pre> svn status </pre> * To show the changes you have made in a line-by-line ''patch'' format, use the [http://svnbook.red-bean.com/en/1.1/ch03s05.html#svn-ch-3-sect-5.3.2 diff command]. This will output a [http://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html#Detailed%20Unified unified diff] of all the changes you have made to the entire tree of source code: <pre> svn diff </pre> *要显示你对每行''patch''格式更改的内容,请使用[http://svnbook.red-bean.com/en/1.1/ch03s05.html#svn-ch-3-sect-5.3.2 diff command]。这会输出[http://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html#Detailed%20Unified unified diff]关于你对整个源代码树做的更改。 * To show the differences for just one source file: <pre> svn diff path/to/file </pre> *显示一个源文件的不同之处: <pre> svn diff path/to/file </pre> * To save the output of a <tt>diff</tt> into a file (so that you can attach it as a patch to a [http://trac.wordpress.org/ Trac] report), use [http://www.linux.com/article.pl?sid=04/05/02/1758211 redirection]: <pre> svn diff > my-patch-file.diff </pre> *将<tt>diff</tt>输出保存到一个文件中(这样你可以将其配置到[http://trac.wordpress.org/ Trac]报告中,作为一个补丁),请使用[http://www.linux.com/article.pl?sid=04/05/02/1758211 redirection]: <pre> svn diff > my-patch-file.diff </pre> * To reset your working copy to the code you checked out (to throw away any changes you've made): <pre>svn revert . -R</pre> *重新将你的working copy设置为你checked out的代码(去除任何你已经更改的内容): <pre>svn revert . -R</pre> * You can also do a <tt>revert</tt> for just a single file: <pre>svn revert path/to/file</pre> *你也可以为一个单一的文件,做一个<tt>revert</tt>: <pre>svn revert path/to/file</pre> * If you already have a working copy of the trunk, but you want to switch back to one of the released versions, you can use the ''''svn switch'''' command to bring all the files in your working copy back to the state of the released version. For instance, to switch back to version 2.0: *如果你已经有一个trunk的working copy,但是你想要转回到某个已经发行的版本,你可以使用''''svn switch''''命令将你的working copy中的所有文件,返回到已经发行的版本的状态。例如,转回到2.0版本: <pre> svn switch http://svn.automattic.com/wordpress/tags/2.0</pre> <pre> svn switch http://svn.automattic.com/wordpress/tags/2.0</pre> == Other Resources == == 其它的资源 == * [http://comox.textdrive.com/pipermail/wp-hackers/2007-April/012146.html How Mark Jaquith reverted the code related to tags in April 2007] * [http://markjaquith.wordpress.com/2005/11/02/my-wordpress-toolbox/ Mark Jaquith's Toolbox with Linux/Mac command-line explanations] * [http://blog.ftwr.co.uk/archives/2005/11/03/windows-wordpress-toolbox/ Westi's blog post on using Tortise SVN in Windows] * [http://comox.textdrive.com/pipermail/wp-hackers/2007-April/012146.html 2007年4月,Mark怎样回复与标签相关的代码] * [http://markjaquith.wordpress.com/2005/11/02/my-wordpress-toolbox/ Mark Jaquith的Toolbox 带有 Linux/Mac command-line 解释] * [http://blog.ftwr.co.uk/archives/2005/11/03/windows-wordpress-toolbox/ Westi的博客文章,关于在Windows中使用Tortise SVN]
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)