使用Mercurial克隆或拉到标签后,如何获取标签变更集? [英] How to get the tag changeset after you clone or pull to a tag using mercurial?

查看:92
本文介绍了使用Mercurial克隆或拉到标签后,如何获取标签变更集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为明确指南,正确地指出了(搜索标签和克隆"):

As the definite guide aptly points out (search for "Tags and cloning"):

当您运行hg clone -r foo来克隆标记为foo的存储库时,新的 克隆将不包含任何比该标记所指的版本新的修订, 包括创建标记的版本.结果是你会 在新版本中获得项目历史的正确子集 存储库,但可能不是您想要的不是标记.

When you run hg clone -r foo to clone a repository as of tag foo, the new clone will not contain any revision newer than the one the tag refers to, including the revision where the tag was created. The result is that you'll get exactly the right subset of the project's history in the new repository, but not the tag you might have expected.

这意味着新克隆中的hg tags不显示foo标记.如果您在添加foo标记之前进行了克隆并且执行了hg pull -r foo,也会发生同样的事情.

It means hg tags in your new clone does NOT show the foo tag. Same thing happens if you had cloned before foo tag was added, and you do hg pull -r foo.

(离题:标记是我唯一不了解汞的事情.我知道将其放入变更集中有很多优势(例如合并),但是将元数据与源代码混合总是很奇怪)

(Digression: tag is about the only thing I don't quite get in hg. I understand there are advantages (e.g. merge) in putting it in a changeset, but it always feels weird to have meta data mixed with source code.)

很明显,我是在寻求一种自动化的方法,而不是将标记变更集作为一个单独的手动步骤来提取.

It should be obvious that I'm asking for an automated way, instead of pulling the tag changeset as a separate manual step.

我知道我可以在incoming钩子中检查这种情况(因此它适用于克隆和提取),也可以包装clonepull.

I know I could check for this scenario in an incoming hook (so it works for both clone and pull), or wrap clone and pull.

但是有没有更好/更简便的方法?

But is there a better/easier way?

UPDATE汞臭虫跟踪器已经具有此问题.

UPDATE hg bug tracker already has this issue.

推荐答案

是的,可以通过克隆后/拉动钩子来完成,但是有一些骗子.

Yes it can be done by post-clone/pull hooks, but there are a couple of crooks.

首先,它仅适用于本地存储库,因为您无法获取远程存储库中的标签列表.

First, it only works for local repo, since you can't get the list of tags in a remote repo.

第二,处理克隆/拉参数和选项并非易事. (对于克隆,我需要获取目标存储库-r-u-U.对于拉取,我需要-r-u.)我尝试使用fancyopts,但是它不能处理全局选项,将在分派中处理掉.我设法修改了调度程序,只给了我一个命令的args和opts,但感觉却很丑.

Second, dealing with clone/pull arguments and options is not trivial. (For clone I need to get the target repo, -r, -u, -U. For pull I need -r and -u.) I tried to use fancyopts, but it can't deal with global options, which are processed away in dispatch. I managed to hack dispatch to give me only the args and opts of a command, but it feels and looks ugly.

使用命令包装程序可以消除第二个问题.

Using command wrapper would eliminate the second problem.

我希望有一天hg会添加一个选项,以克隆并干净地完成它.

I hope one day hg will add an option to clone and pull to do it cleanly.

这篇关于使用Mercurial克隆或拉到标签后,如何获取标签变更集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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