从CVS转移到git:$ Id:$ equivalent? [英] Moving from CVS to git: $Id:$ equivalent?

查看:98
本文介绍了从CVS转移到git:$ Id:$ equivalent?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读了一大堆关于简单的源代码控制工具的问题,git看起来像是一个合理的选择。我已经开始运行,迄今为止效果很好。我喜欢CVS的一个方面是版本号的自动增量。

据我所知,这在分布式存储库中的意义不大,但作为开发人员,我想要/需要类似这样的东西。让我解释一下为什么:



我使用Emacs。我会定期查看第三方软件包的lisp源文件的新版本。假设我有一个文件foo.el,根据标题是1.3版;如果我查看最新版本并且看到它是1.143或2.6或者其他什么,我知道我远远落后。相反,如果我看到一对40个字符的哈希,我不知道后面哪个或后面有多少。如果我必须手动检查ChangeLogs才能了解我过期的情况,我绝对会讨厌它。



作为一名开发人员,我想扩展此礼节,正如我所看到的那样,对于那些使用我的输出的人(也许我在开玩笑说,任何人都在,但让我们暂且搁置一会儿)。我不希望每次都记住自己增加该死的数字,或者时间戳或类似的东西。这是一个真正的PITA,我从经验中知道。



那么我有什么替代方案?如果我无法获得$ Id:$等价物,我还能如何提供我所寻找的?感谢您的帮助!

编辑:我应该提到,我的期望是最终用户不会安装git,即使他们这样做,也不会有本地存储库(实际上,我希望不会以这种方式提供)。感谢您的答复!

解决方案

SHA只是一个版本的表示(虽然是规范)。 git describe 命令提供了其他功能,并且非常好。

例如,当我运行 git describe 在我的 java memcached客户端的主分支中 a> source,我得到这个:

  2.2-16-gc0cd61a 

这说明了两件重要的事:


  1. 自从2.2开始在这棵树上

  2. 精确的源代码树可以显示在任何其他的克隆上。


    比方说,您打包了一个包含源代码的版本文件(甚至为了发布而重写了所有内容)以显示该数字。假设打包版本为 2.2-12-g6c4ae7a (不是发行版,而是有效版本)。



    您现在可以看到究竟有多远(4次提交),,您可以看到确切的4次提交:

     #..的RHS可以是起源/主或空,或任何你想要的。 
    %git log --pretty = format:%h%an%s2.2-12-g6c4ae7a..2.2-16-gc0cd61a
    c0cd61a Dustin Sallings更多试图获得超时。
    8c489ff Dustin Sallings对每个协议上的每个协议进行超时测试
    fb326d5 Dustin Sallings添加了对bug 35的测试。
    fba04e9 Valeri Felberg支持将到期日期传递到CAS操作。


    I read through a bunch of questions asking about simple source code control tools and git seemed like a reasonable choice. I have it up and running and it works well so far. One aspect that I like about CVS is the automatic incrementation of a version number.

    I understand that this makes less sense in a distributed repository, but as a developer I want/need something like this. Let me explain why:

    I use Emacs. Periodically I go through and look for new versions of the lisp source files for 3rd-party packages. Say I've got a file foo.el which according to the header is version 1.3; if I look up the latest version and see it's 1.143 or 2.6 or whatever, I know I'm pretty far behind. If instead I see a couple of 40-character hashes, I won't know which is later or get any idea of how much later it is. I would absolutely hate it if I had to manually check ChangeLogs just to get an idea of how out of date I am.

    As a developer, I want to extend this courtesy, as I see it, to the people that use my output (and maybe I'm kidding myself that anyone is, but let's leave that aside for a moment). I don't want to have to remember to increment the damn number myself every time, or a timestamp or something like that. That's a real PITA, and I know that from experience.

    So what alternatives do I have? If I can't get an $Id:$ equivalent, how else can I provide what I'm looking for? Thanks for the help!

    EDIT: I should mention that my expectation is that the end user will NOT have git installed and even if they do, will not have a local repository (indeed, I expect not to make it available that way). Thanks for the answers so far!

    解决方案

    The SHA is just one representation of a version (albeit canonical). The git describe command offers others, and does so quite well.

    For example, when I run git describe in my master branch of my java memcached client source, I get this:

    2.2-16-gc0cd61a
    

    That says two important things:

    1. There have been exactly 16 commits in this tree since 2.2
    2. The exact source tree can be displayed on anyone else's clone.

    Let's say, for example, you packaged a version file with the source (or even rewrote all the content for distribution) to show that number. Let's say that packaged version was 2.2-12-g6c4ae7a (not a release, but a valid version).

    You can now see exactly how far behind you are (4 commits), and you can see exactly which 4 commits:

    # The RHS of the .. can be origin/master or empty, or whatever you want.
    % git log --pretty=format:"%h %an %s" 2.2-12-g6c4ae7a..2.2-16-gc0cd61a
    c0cd61a Dustin Sallings More tries to get a timeout.
    8c489ff Dustin Sallings Made the timeout test run on every protocol on every bui
    fb326d5 Dustin Sallings Added a test for bug 35.
    fba04e9 Valeri Felberg Support passing an expiration date into CAS operations.
    

    这篇关于从CVS转移到git:$ Id:$ equivalent?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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