`
sunxboy
  • 浏览: 2883682 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

Using Subversion via TextPad

 
阅读更多

If you edit with TextPad a lot, you probably want to keep back ups of the in between versions. Instead of making a zip at the end of the day, I recommend to use a version control system, like Subversion. Moreover, it's very easy to call it from Textpad itself, and hence you can make it part of the editing process itself.

Since TextPad runs in a Windows environment, I decided to use TortoiseSVN, a client for subversion implemented as a Windows shell extension, and hence comes with a graphical user interface (GUI). This article explains how to integrate TortoiseSVN into TextPad. I have also planned an article on getting started with Subversion, so either check back now and then, or subscribe to the RSS feed for this site.

How to call an external program from TextPad

In order to call an external program from within TextPad a "tool" has to be created. Tools are added to the, surprise, Tools menu, and to make life easier you can also associate a key combination to call the tool.

Definition for tools are made via the Preferences dialog window. Either press Ctrl+Q followed by P to open this window, or select the Preferences... entry in the Configure menu of TextPad.

Preferences dialog of TextPad
Preferences dialog of TextPad

When the Tools entry is selected in the left part of the dialog window, the center part shows a list of Tools already defined, with an Add button to the right. You are now ready to define your first tool.

Committing a file to the repository: Commit

Although it may sound counterintuitive to start with commit, it's probably the tool you're going to use the most. Also, TortoiseProc.exe, the program we are going to use in each tool, is able to do the add and commit to the repository in one go.

Press the Add button, and in the drop down menu select "Program". Browse to the bin folder inside the installation folder of TortoiseSVN, which is on my system:

C:\Program Files\TortoiseSVN\bin

Select the TortoiseProc program, and press the Open button. You should now see a new entry added to the list in the center of the Preferences dialog: TortoiseProc. Now put the mouse pointer on the already selected entry, and click the left mouse button once and wait. If you do it right, you now can edit the name. Change it into Commit.

Notice that the new tool you just created doesn't show up under the Tools entry on the left side of the Preferences Dialog yet. Press the Apply button, and it should appear.

The Commit tool
The Commit tool

Select the Commit entry under the Tools entry (left side of Preferences Dialog) and change the Parameters field into the following:

/command:commit /path:"$File" /notempfile /closeonend

Note the quotes around $File, those are needed. Also, because the $File variable is used in the Parameter field, TextPad saves the file before the tool is actually executed. Finally, the /notempfile is mandatory, as explained in "Appendix C: Automating TortoiseSVN" of the help file that comes with TortoiseSVN.

By following /closeonend by a : and a number you can override the Autoclose setting (Tortoise SVN Settings, Look and Feel, Dialogs) of TortoiseSVN as follows:

  • /closeonend:0 don't close the dialog automatically
  • /closeonend:1 auto close if no errors
  • /closeonend:2 auto close if no conflicts
  • /closeonend:3 auto close if no merges

For example, with this tool you might decide to use /closeonend:1 instead of the default selected by /closeonend.

After you changed the Parameters field, and optionally changed the /closeonend, press the OK button.

Important: when you commit a file, make a habit of entering a meaningful into the log message input field. This might sound like a lot of work, and with small edits even superfluous, but trust me on this, better safe now then sorry later. And make sure it's meaningful, not only at the moment itself, but also after months and months. Just "fixed some bugs" is as bad as nothing at all.

The Commit tool has been added to the Tools menu
The Commit tool has been added to the Tools menu

If you now open the Tools menu, the tool you just created should be visible, followed by a key combination, which is default Ctrl+1. At the end of this article I explain how to change the key combination, and other customizations you might want to do.

Information on a file: Show Log

Once a file is in the repository, you can view the log of it. I recommend to create the Show Log tool for two reasons: first it makes it possible to view each message that has been entered in the commit step. Secondly, you can compare any revision with the current file in the editor.

Repeat the steps as given in the previous section, but use "Show Log" as the name of the tool, and use the following for "Parameters" field:

/command:log /path:"$File" /notempfile

You can compare the current file (working copy) against a previous revision by selecting the revision entry in the Log Messages window, pressing the right mouse button, and selecting the "Compare with working copy" entry in the context menu.

Which changes have been made: Diff

Now and then I want to see which changes I made to the file I am editing, compared to the last version committed (head revision). The Show Low tool, as described in the previous section, provides for a diff with any revision, including the head one.

However, to make life easier you might want to add the Diff tool with the following value of the "Parameters" field:

/command:diff /path:"$File" /notempfile

Falling back to the head revision: Revert

Even though TextPad has excellent undo facilities, sometimes I want to fall back to the last revision I committed (head), which is called a revert to the head version.

Again, repeat the steps as given before, use "Revert" as the name of the tool, and use the following for the "Parameters" field:

/command:revert /path:"$File" /notempfile

Note that with the Show Log tool you can fall back to any revision.

Changing the shortcut key for a tool

Default, the first tool you define can be activated by pressing Ctr+1, the second one by pressing Ctrl+2, etc. In case you want to change this, open the Preferences dialog of TextPad, and select the Keyboard option. Next, select the Tools category, and select the tool of which you want to customize the shortcut key.

Assigning a shortcut key to the Commit tool
Assigning a shortcut key to the Commit tool

Then, click in the "Press new shortcut" field and press the shortcut key you want to use. Remember that TextPad uses Ctrl+Q as an extra meta key, so I decided to assign Ctrl+Q, C to commit. Note that if a shortcut is already in use, TextPad reports this under the "Press new shortcut" field.

Important: make sure you press the Assign button in order to confirm the change. If you just press OK, nothing will be changed. Also, you might want to remove the default shortcut.

Organizing the Tools menu

Note that you can organize the tools you created in the Tools menu. You can either move them up or down in order to group them. Also, you can insert menu separators for easy recognition of groups.

Select the Tools entry in the Preferences dialog window. Above the list of available tools you see three icons which are linked to the following actions: delete, move up, move down. A menu separator can be added by pressing the Add button and selecting the Menu Separator option. A separator, displayed as ----------- can also be moved up and down, and deleted.

分享到:
评论

相关推荐

    Pragmatic Version Control Using Subversion, 2nd Edition

    This book tells you how to improve the effectiveness of your software development process using version control. Version control, sometimes called source code control, is the first leg of our...

    mac subversion

    svn, version 1.9.0 (r1692801) compiled Jul 29 2015,...* ra_serf : Module for accessing a repository via WebDAV protocol using serf. - using serf 1.3.8 - handles 'http' scheme - handles 'https' scheme

    Subversion

    Subversion Subversion Subversion Subversion Subversion

    Pragmatic Version Control With Subversion

    ### Pragmatic Version Control Using Subversion #### 一、引言 版本控制系统是现代软件开发不可或缺的一部分,它帮助团队管理代码的变化历史,并确保项目能够稳定地进行迭代与更新。本书《Pragmatic Version ...

    Jenkins subversion 插件和所有依赖说明:依赖安装顺序

    Jenkins Subversion 插件使得Jenkins能够与Subversion仓库进行交互,进行代码的检出、更新和提交等操作。在设置Jenkins与Subversion的集成时,正确安装和配置相关插件至关重要。 首先,我们需要了解Jenkins ...

    subversion

    Subversion 是一个开源的版本控制系统,它用于管理文件和目录的变更历史,使得多人协作开发成为可能。在给定的压缩包文件中,包含了 `subversion-1.7.2.tar.gz` 和 `subversion-deps-1.6.1.tar.gz` 两个文件,它们是...

    Subversion Edge详细安装与使用手册

    ### Subversion Edge 详细安装与使用手册 #### 一、Subversion Edge 下载与安装 ##### 1.1 下载地址 Subversion Edge 的下载地址为:[http://www.collab.net/svnedge](http://www.collab.net/svnedge)。 ##### ...

    subversion-1.6.1.tar.gz

    Subversion 是一个开源的版本控制系统,它用于管理文件和目录的变更历史,使得多人协作开发成为可能。在软件开发过程中,Subversion 提供了版本控制功能,允许开发者追踪和恢复代码的不同版本,避免了文件冲突,并有...

    Apache-Subversion-1.14.0.zip

    Apache Subversion(简称SVN)是一个开源的版本控制系统,用于管理软件项目的源代码和其他文件的变更。这个"Apache-Subversion-1.14.0.zip"压缩包包含的是Subversion 1.14.0版本的命令行工具,适用于Windows操作系统...

    SubVersion的应用详解

    **SubVersion 应用详解** SubVersion(简称SVN)是一种广泛使用的版本控制系统,它能够跟踪文件和目录的变更,使多个用户协同工作在同一个项目上成为可能。本讲解将深入探讨SubVersion的基础概念、安装配置、基本...

    Subversion1.5.1发布- Subversion中文站SVN_TortoiseSVN_教程_文档_培训

    Subversion(简称SVN)是一款开源的版本控制系统,它用于管理对文件和目录的更改,以便在多人协作的环境中保持数据的一致性和完整性。Subversion 1.5.1是Subversion项目的一个重要版本更新,它带来了许多改进和新...

    Subversion快速入门教程

    Subversion,快速入门教程,本文是使用Subversion最快速的教程,在最短的时间里帮助您建立起一套可用的服务器环境,只需略加调整就可以应用到实际项目当中。

    subversion1.2x 插件

    Subversion 1.2x 插件是针对Eclipse集成开发环境的一个版本控制系统插件,主要用于支持Subversion(SVN)版本控制系统的操作。Subversion是一个开源的版本控制系统,允许用户跟踪文件和目录的更改历史,便于团队协作...

    subversion-1.14.2.tar.gz

    Subversion(SVN)是一个广泛使用的版本控制系统,用于管理和跟踪文件和目录的变更。这个"subversion-1.14.2.tar.gz"文件是一个压缩包,包含了Subversion 1.14.2版本的源代码。这个版本的发布可能包含了一些新特性、...

    Apache-Subversion-1.8.13

    Subversion是一个自由开源的版本控制系统。在Subversion管理下,文件和目录可以超越时空。Subversion将文件存放在中心版本库里,这个版本库很像一个普通的文件服务器,不同的是,它可以记录每一次文件和目录的修改...

Global site tag (gtag.js) - Google Analytics