Mercurial:如何从存储库中仅导入部分变更集?

发布于 2024-11-03 15:32:15 字数 670 浏览 1 评论 0原文

我有一个名为“我的项目”的存储库,基于一个名为“框架”的框架。他们两个都有各自的存储库,它们之间不相关,每个分支和标签。我想在我的存储库中接收“框架”的更新,但仅来自“默认”分支,而不是其他分支。当然,我不想在我的存储库中包含“框架”的标签,因为它是一个完全不同的项目。

我有 Mercurial HG,并且我希望能够直接从我的“管理存储库”页面从“框架”存储库中提取更改。

此外,我只想下载最新的变更集,因为我不久前开始了我的项目。如果我可以将“框架”的默认分支重命名为我的存储库中的其他名称(例如“框架变更集”),那就完美了。

注意:我没有“框架”存储库的写入权限。

我尝试按照 Mercurial wiki 所说的操作:

hg pull -f -r default "framework"

没关系,直到我意识到我已经从“框架”存储库下载了所有标签,并且我已经从远程存储库下载了所有变更集。此外,当在TortoiseHG->配置->同步中时,我将“框架”存储库作为该项目的远程存储库,并从远程存储库中拉出,我从该存储库中获取了所有分支。

当然,我无法更改默认分支名称,并更新了我的默认分支,即使我尝试使用 hg Convert --branchmap (但我不知道如何使用它)。

我的问题有什么解决办法吗?甚至是部分解决方案?

I have a repository, called "my project" based in a framework called "framework". The two of them have each it's repository, unrelated between them, with each branches and tags. I want to receive "framework"'s updates in my repository, but only from "default" branch and not from others. And, of course, I do not want to have "framework"'s tags in my repository, as it is a totally different project.

I have Mercurial HG, and I would like to be able to pull changes from "framework" repository directly from my "Manage repository" page.

Furthermore, I only want to download latest changesets, since I started my project not long ago. And It would be perfect if I could rename the "framework"'s default branch to other name in my repo, e.g. "Framework Changesets".

Note: I do not have write access to the "framework" repository.

I tried to do what mercurial wiki said:

hg pull -f -r default "framework"

It was OK, until I realised I had downloaded all the tags from the "framework" repository, and I had downloaded all the changesets from the remote repository. Furthermore, when in TortoiseHG->Configuration->Synchronization I put the "framework" repository as a remote repository for that project, and pulled from the remote repository, I got all the branches from that repository.

Of course I wasn't able to change default branch name, and updated my default branch, even though I tried to use hg convert --branchmap (but I didn't know how to use it).

Is there any solution to my problem? or even a partial solution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傲娇萝莉攻 2024-11-10 15:32:15

我认为你可以通过以下方法的组合来解决这个问题:

拉取特定分支

使用命令行: hg pull -r

使用 TortoiseHg v1.1.X:

  1. 使用标记为下载并查看传入变更集的按钮检查传入的变更集,
  2. 右键单击要拉取的分支的尖端,然后选择拉取到这里
  3. 使用拒绝按钮拒绝其余变更集

删除现有标签

您始终可以手动编辑 .hgtags 文件以删除在“framework”分支上创建的标签,但我不这样做不知道如何在没有标签的情况下提取变更集。

更改分支名称

使用 mq 扩展,您可以更改新“框架”更改集的命名分支继续生活。有关如何在 TortoiseHg v1 中执行此操作的说明,请参阅“在分支中应用补丁”的答案。 1.X,以及 CLI。这里的基本思想是创建一个具有您想要的名称的命名分支,导入您拉入补丁队列的所有“框架”变更集,然后将它们应用到新的命名分支。他们将从“框架”中摆脱分支名称,并使用您应用它们的分支的分支名称。

如果您要多次从“框架”中拉取,则需要使用补丁队列在每次拉取时仅移动新的变更集。应该很容易看出哪些变更集尚未移动。

I think you can address this issue through a combination of these things:

Pulling specific branches

Using the command line: hg pull -r <branch name>

Using TortoiseHg v1.1.X:

  1. Check for incoming changesets by using the button labeled Download and view incoming changesets
  2. Right-click on the tip of the branch you want to pull and select Pull to here
  3. Reject the rest of the changesets using the Reject button

Removing existing tags

You can always hand-edit the .hgtags file to remove tags created on the "framework" branch, but I don't know of a way to pull changesets without the tags.

Changing branch name

Using the mq extension you can change the named branch that your new "framework" changesets live on. See answer to "Apply patches in branch" for instructions on how to do this in TortoiseHg v1.1.X, as well as the CLI. The basic idea here is to create a named branch with the name you want, import all of the "framework" changesets you pulled into a patch queue, and then apply them to the new named branch. They will shed the branch name from "framework" and use the branch name of the branch you applied them to.

If you are going to pull from "framework" more than once, you would need to use the patch queue to move only the new changesets with each pull. It should be easy to see which changesets you haven't moved yet.

看透却不说透 2024-11-10 15:32:15

我们可以通过在克隆 url 中附加分支名称和 # 符号来指定分支名称。

例如

hg clone --verbose https://user@cloneurl/my_product#MY_BRANCH "C:\myCode"

We can specify the branch name by appending branch name with a # symbol in the clone url.

e.g.

hg clone --verbose https://user@cloneurl/my_product#MY_BRANCH "C:\myCode"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文