如何使用Mercurial进行文本文档的版本控制? [英] How to use Mercurial for version control of text documents?

查看:98
本文介绍了如何使用Mercurial进行文本文档的版本控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这并非完全是一个编程问题,但是我认为它比 TeX小组

This is not exactly a programming question, however I think it fits here better than in the TeX group

我想使用版本控制来跟踪文本文件的更改(这些文本用于创建LaTeX输出.(由于我不是程序员,所以我对版本控制系统没有更深的经验.) 我想为此使用Mercurial,并且我正在MacOS X 10.6上工作.

I want to use version control for keeping track of changes of text files (which are used to create LaTeX output. (As I am no programmer, I don't have deeper experience with version control system yet.) I'd like to use Mercurial for that, and I'm working on MacOS X 10.6.

这些文件是关于求职申请的,因此每个公司主要有3个文件:

The files are about job applications, so mostly 3 files for each company:

  • 一封激励书
  • 简历
  • 和一份包含文凭,证书等的文件...

关于实际问题,我有几个问题:

I have several questions concerning practical things:

  1. 我已经有一个包含许多子目录的目录(每个公司一个).每个子目录包含2个或3个* .tex文件以及辅助文件和生成的pdf. (有时还有一些其他文件,其中包含有关公司的信息).
    如果要在新存储库中添加现有文件并从每个文件创建一个修订版(大约15个不同版本),该怎么做?
    当然,父母"和孩子"之间的关系是不可见的,但是至少我可以做一个比较,看看有什么变化,每个都有一个修订号.
  2. 我可以将这些文件保留在原始目录中,然后将它们添加到版本控制系统中,还是必须将它们放在特殊的位置?
    (我想将其他文件添加到这些目录中,而这些文件不会添加到版本控件中,我想知道
  3. 我可以为修订版本(例如公司名称)指定一个名称",以便以后更容易找到它们吗?
  4. 创建新修订的最佳工作流程是什么?
    我会从存储库中选择一个现有版本,将其导出到新公司的新文件夹中,更改tex文件,然后将其提交回存储库?!
  1. I have already one directory containing many subdirectories (one for each company). Each subdirectory contains those 2 or 3 *.tex files as well as the auxiliary files and the resulting pdfs. (and sometimes some other files with information about the company).
    If I want to add the already existing files in the new repository and creating a revision from each one (there about 15 different versions), how can I do that?
    Sure, the relations of "parent" and "child" will not be visible, but at least I can do a diff and see what changed and each one would have a revision number.
  2. Can I leave those files in the original directories and add them to the version control system, or do they have to be in a special place?
    (I'd like to add other files to those directories, which will not be added to the version control and I wonder
  3. Can I give a "name" to a revision (e. g. the company name) for easier finding them afterwards?
  4. What would be the best workflow for creating new revisions?
    I'd choose an exisiting revision from the repository, export it to a new folder for the new company, change the tex files and then commit it back to the repo?!

推荐答案

首先,我会推荐两个有关Mercurial的免费在线资源: hginit 以及 Mercurial:权威指南.

At first, I would recommend two free online sources about Mercurial: hginit and the book Mercurial: The Definitive Guide.

现在,您的问题.

我将从第三个开始.是的,可以将名称附加到修订版,它们称为标签.

I'll start with the third. Yes, it is possible to attach names to revisions, they are called tags.

要将现有版本提交到一个存储库中的线性历史记录,请执行以下操作:

To commit your existing versions into a linear history in one repository do the following:

mkdir myNewRepo
cd myNewRepo
hg init

现在您有了一个新的存储库.对于每个公司目录,重复以下步骤,以将文件复制到存储库中,使其成为hg已知的文件,提交它们并用名称标记该新修订版.

Now you have a new repository. For every company directory repeat the following steps in order to copy your files into the repository, make them known to hg, commit them and tag that new revision with a name.

cp ../oldVersionA/* .
hg add letter.tex resume.tex diploma.pdf
hg commit -m "Job application to A Inc."
hg tag companyA

请注意,您只需将每个文件路径添加到存储库一次即可.

Note, that you only have to add every file path once to a repository.

这篇关于如何使用Mercurial进行文本文档的版本控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆